@@ -1,10 +1,17 @@
|
||||
package sudoku;
|
||||
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Cell {
|
||||
|
||||
protected static int NOSYMBOLE = -1;
|
||||
protected static int NOSYMBOL = -1;
|
||||
protected int symbolIndex;
|
||||
protected Block block = null;
|
||||
//protected List<Block> blockContainers = null;
|
||||
//protected List<Sudoku> sudokuContainers = null;
|
||||
|
||||
public Cell(int symbolIndex) {
|
||||
this.symbolIndex = symbolIndex;
|
||||
@@ -14,9 +21,25 @@ public abstract class Cell {
|
||||
* @brief Default constructor, empty square
|
||||
*/
|
||||
public Cell() {
|
||||
this(NOSYMBOLE);
|
||||
this(NOSYMBOL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public Cell(Cell cell) {
|
||||
this.symbolIndex = cell.symbolIndex;
|
||||
this.sudokuContainers = cell.sudokuContainers;
|
||||
this.blockContainers = cell.blockContainers;
|
||||
}
|
||||
|
||||
public Cell(List<Sudoku> sudokuContainers, List<Block> blockContainers) {
|
||||
super();
|
||||
this.sudokuContainers = new ArrayList<>(sudokuContainers);
|
||||
this.blockContainers = new ArrayList<>(blockContainers);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public int getSymbolIndex() {
|
||||
return symbolIndex;
|
||||
}
|
||||
@@ -25,11 +48,30 @@ public abstract class Cell {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
/*
|
||||
public List<Block> getBlockContainers() {
|
||||
return this.blockContainers;
|
||||
}
|
||||
|
||||
public void setBlockContainers(List<Block> block) {
|
||||
this.blockContainers = block;
|
||||
}
|
||||
|
||||
public List<Sudoku> getSudokuContainers() {
|
||||
return this.sudokuContainers;
|
||||
}
|
||||
*/
|
||||
// only SudokuFactory and SudokuSerializer should access this
|
||||
public void setBlock(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
/*
|
||||
public void setSudokuContainers(List<Sudoku> sudoku) {
|
||||
this.sudokuContainers = sudoku;
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean equalsValue(Cell otherCell) {
|
||||
return otherCell.getSymbolIndex() == this.getSymbolIndex();
|
||||
}
|
||||
@@ -38,7 +80,7 @@ public abstract class Cell {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("| ");
|
||||
if (this.symbolIndex != NOSYMBOLE){
|
||||
if (this.symbolIndex != NOSYMBOL){
|
||||
sb.append(this.symbolIndex);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user