Class QuadraticArrays

java.lang.Object
de.sfuhrm.sudoku.QuadraticArrays

public final class QuadraticArrays extends Object
Helper methods for working on two-dimensional arrays.
Author:
Stephan Fuhrmann
  • Method Details

    • parse

      public static byte[][] parse(GameSchema gameSchema, String... rows)
      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

      public static byte[][] parse(String... rows)
      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.