Package de.sfuhrm.sudoku
Class QuadraticArrays
java.lang.Object
de.sfuhrm.sudoku.QuadraticArrays
Helper methods for working on two-dimensional arrays.
- Author:
- Stephan Fuhrmann
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[][]parse(GameSchema gameSchema, String... rows) Parses a string based field descriptor.static byte[][]Parses a string based field descriptor.
-
Method Details
-
parse
Parses a string based field descriptor.
Example usage:
byte data[][] =
QuadraticArrays.parse(
"100000000",
"020100000",
"000320100",
"010000456",
"000010000",
"000000010",
"001000000",
"000001000",
"000000001"
);
GameMatrix matrix = ...
matrix.setAll(data);
- Parameters:
gameSchema- the game schema that defines the input data dimensions.rows- array of strings with each string describing a row. Digits get converted to the element values, everything else gets converted to UNSET. Example for one row: "126453780".- Returns:
- the parsed array.
- Throws:
IllegalArgumentException- if one of the rows has a wrong size.
-
parse
Parses a string based field descriptor.
Example usage:
byte data[][] =
QuadraticArrays.parse(
"100000000",
"020100000",
"000320100",
"010000456",
"000010000",
"000000010",
"001000000",
"000001000",
"000000001"
);
GameMatrix matrix = ...
matrix.setAll(data);
- Parameters:
rows- array of strings with each string describing a row. Digits get converted to the element values, everything else gets converted to UNSET. Example for one row: "126453780".- Returns:
- the parsed array.
- Throws:
IllegalArgumentException- if one of the rows has a wrong size.
-