This commit is contained in:
33
app/src/main/java/sudoku/Coordinate.java
Normal file
33
app/src/main/java/sudoku/Coordinate.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package sudoku;
|
||||
|
||||
public class Coordinate {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
|
||||
public Coordinate(int row, int col) {
|
||||
this.x = row;
|
||||
this.y = col;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int calculateIndex(int size) {
|
||||
return this.y * size + this.x;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user