这是一个数独程序的一部分,classSudokuEntry里面的next是什么意思呢?如果有大神愿意帮忙讲解一下该程序的其他部分就更好了,跪求答案!!packageserie7;importserie6.SudokuCheck;c...
这是一个数独程序的一部分,class SudokuEntry里面的next是什么意思呢? 如果有大神愿意帮忙讲解一下该程序的其他部分就更好了, 跪求答案!!
package serie7;
import serie6.SudokuCheck;
class SudokuEntry {
int column, row, value;
SudokuEntry next;}
class SudokuMatch {
int[][] field;
SudokuEntry first, last;}
class SudokuManual {
static SudokuMatch create(int[][] field) { // hier field: schon Werte gibt
SudokuMatch spielfeld = new SudokuMatch();
spielfeld.field = new int[field.length][field[0].length];
for (int i = 0; i < field.length; i++) {
for (int j = 0; j < field[0].length; j++) {
spielfeld.field[i][j] = field[i][j];
}}
return spielfeld; }
static boolean move(SudokuMatch match, SudokuEntry entry) {
if (match.field[entry.row][entry.column] != 0) {
return false;}
if (entry.value < 0 || entry.value > 9) {
return false;}
match.field[entry.row][entry.column] = entry.value;
if (SudokuCheck.isValidSudoku(match.field) == false) {
match.field[entry.row][entry.column] = 0;
return false;}
if (match.last != null) {
match.last.next = entry;}
if (match.first == null) {
match.first = entry;}
match.last = entry;
return true;}
void printMoves(SudokuMatch match) {
if (match.first != null) {
SudokuEntry entry = match.first;
boolean isNotLast = true;
while (isNotLast) {
System.out.println(entry.row + " " + entry.column + " "
+ entry.value);
if (entry == match.last) {
isNotLast = false;
} else {
entry = entry.next;}}}}}
展开