package sudoku; import org.checkerframework.checker.units.qual.C; import java.util.ArrayList; import java.util.List; public abstract class Cell { protected static int NOSYMBOL = -1; protected int symbolIndex; protected Block block = null; //protected List blockContainers = null; //protected List sudokuContainers = null; public Cell(int symbolIndex) { this.symbolIndex = symbolIndex; } /** * @brief Default constructor, empty square */ public Cell() { this(NOSYMBOL); } /* public Cell(Cell cell) { this.symbolIndex = cell.symbolIndex; this.sudokuContainers = cell.sudokuContainers; this.blockContainers = cell.blockContainers; } public Cell(List sudokuContainers, List blockContainers) { super(); this.sudokuContainers = new ArrayList<>(sudokuContainers); this.blockContainers = new ArrayList<>(blockContainers); } */ public int getSymbolIndex() { return symbolIndex; } public Block getBlock() { return this.block; } /* public List getBlockContainers() { return this.blockContainers; } public void setBlockContainers(List block) { this.blockContainers = block; } public List getSudokuContainers() { return this.sudokuContainers; } */ // only SudokuFactory and SudokuSerializer should access this public void setBlock(Block block) { this.block = block; } /* public void setSudokuContainers(List sudoku) { this.sudokuContainers = sudoku; } */ public boolean isEmpty() { return this.symbolIndex == Cell.NOSYMBOL; } public boolean equalsValue(Cell otherCell) { return otherCell.getSymbolIndex() == this.getSymbolIndex(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("| "); if (this.symbolIndex != NOSYMBOL){ sb.append(this.symbolIndex); } else { sb.append(" "); } sb.append(" |"); return sb.toString(); } }