merge
All checks were successful
Linux arm64 / Build (push) Successful in 24m8s

This commit is contained in:
Melvyn
2025-01-24 16:17:56 +01:00
parent 981bf8529d
commit 8f4330f710
21 changed files with 42 additions and 45 deletions

View File

@@ -0,0 +1,80 @@
package sudoku.structure;
import java.util.ArrayList;
import java.util.List;
public class Cell {
public static int NOSYMBOL = -1;
private Block blockContainer;
private int symbolIndex = Cell.NOSYMBOL;
private final List<Integer> possibleSymbols;
private boolean isMutable = true;
public Cell() {
this.possibleSymbols = new ArrayList<>();
}
public Cell(int symbolIndex) {
this.symbolIndex = symbolIndex;
this.possibleSymbols = new ArrayList<>();
}
public Cell(int symbolIndex, boolean isMutable) {
this.symbolIndex = symbolIndex;
this.possibleSymbols = new ArrayList<>();
this.isMutable = isMutable;
}
public int getSymbolIndex() {
return this.symbolIndex;
}
public void setSymbolIndex(int symbolIndex) {
this.symbolIndex = symbolIndex;
}
public void setPossibleSymbols(List<Integer> possibleSymbols) {
this.possibleSymbols.clear();
this.possibleSymbols.addAll(possibleSymbols);
}
public void setImmutable() {
this.isMutable = false;
}
public Block getBlock() {
return this.blockContainer;
}
public void setBlock(Block block) {
this.blockContainer = block;
}
/**
* Remove the current symbolIndex and returns it
* @return integer symbolIndex cleared
*/
public int clearCurrentSymbol() {
int i = this.symbolIndex;
setSymbolIndex(NOSYMBOL);
return i;
}
public boolean isEmpty() {
return this.symbolIndex == Cell.NOSYMBOL;
}
public void removeSymbolFromPossibilities(int indexSymbol) {
possibleSymbols.remove(indexSymbol);
}
public List<Integer> getPossibleSymbols() {
return this.possibleSymbols;
}
public boolean isMutable() {
return this.isMutable;
}
}