001package algs13.xbacktrack.xsudoku; 002 003/** 004 * A cell in a Sudoku grid. 005 * 006 * Each cell has an x (row) coordinate and y (column) coordinate, and is part of 007 * a subgrid. These properties are fixed at the time a cell is constructed. 008 */ 009abstract class XSudokuCell { 010 final int x; 011 final int y; 012 final int subgridId; 013 014 XSudokuCell(final int x, final int y) { 015 this.x = x; 016 this.y = y; 017 this.subgridId = (x / MySudoku.SUBGRID_DIMENSION) + MySudoku.SUBGRID_DIMENSION * (y / MySudoku.SUBGRID_DIMENSION); 018 } 019 020 /** 021 * Get the digit currently associated with this cell. 022 * @return the digit associated with this cell 023 */ 024 abstract int getDigit(); 025}