Beispiel #1
0
  @Override
  public void updateState(boolean fullUpdate) {
    for (int x = 0; x < ISudoku.BOARD_SIZE; x++) {
      for (int y = 0; y < ISudoku.BOARD_SIZE; y++) {
        int block = sudoku.getBlock(x, y);
        String prefix = "";
        if (!(sudoku.isLegalBlock(block) && sudoku.isLegalColumn(x) && sudoku.isLegalRow(y))) {
          prefix = CELL_INVALID_INDICATOR;
        }
        if (x == selectedX && y == selectedY) {
          prefix = CELL_SELECTED_INDICATOR;
        }
        if (sudoku.isAssignable(x, y)) {
          prefix = CELL_ASSIGNABLE_INDICATOR + prefix;
        }

        Integer value = sudoku.getCellValue(x, y);
        String content = value != null ? Integer.toString(value) : "";

        setCell(x, y, prefix + content);
      }
    }

    updateMessage();
  }