com.act365.sudoku
Class SuDokuUtils

java.lang.Object
  extended bycom.act365.sudoku.SuDokuUtils

public class SuDokuUtils
extends java.lang.Object

SuDokuUtils contains utility functions that are called from several other classes.


Field Summary
static int ALPHANUMERIC
          Controls whether integers greater than or equal to 10 are displayed as numbers or letters.
static int CELL_STATE
           
static java.lang.String[] copyTypes
           
static int defaultCopyType
           
static int defaultFormat
          The default display format for values greater than or equal to 10.
static java.lang.String[] featuredGrades
           
static java.lang.String[] labels
           
static int LIBRARY_BOOK
           
static int NEIGHBOUR_STATE
           
static int NUMBER_STATE
           
static int NUMERIC
          Controls whether integers greater than or equal to 10 are displayed as numbers or letters.
static int PLAIN_TEXT
           
static int TEXT
          Controls whether integers greater than or equal to 10 are displayed as numbers or letters.
 
Constructor Summary
SuDokuUtils()
           
 
Method Summary
static java.lang.String libraryBookFooter()
          Writes out the XML header for Pappocom library books.
static java.lang.String libraryBookHeader(java.lang.String className, int cellsInRow, int boxesAcross, java.lang.String[] featuredGrades)
          Writes out the XML header for Pappocom library books.
static byte parse(java.lang.String s)
          Converts a string representation of a cell in the default format into a data value.
static byte parse(java.lang.String s, int format)
          Converts a string representation of a cell in the given format into a data value.
static void populate(byte[][] data, java.lang.String s)
          Populates a data array according to a string in the default format.
static void populate(byte[][] data, java.lang.String s, int format)
          Populates a data array according to a string in the given format.
static void setDefaultText(int cellsInRow)
          Sets a default text string.
static void setText(java.lang.String newText, int cellsInRow)
          Sets the text string to be used in TEXT mode.
static java.lang.String toString(byte[][] data, int boxesAcross)
          Creates a string representation of a two-dimensional integer array with a maximum value equal to the grid size.
static java.lang.String toString(byte[][] data, int boxesAcross, int maxDatum)
          Creates a string representation of a two-dimensional integer array.
static java.lang.String toString(byte[][] data, int boxesAcross, int maxDatum, int format)
          Creates a string representation of a two-dimensional integer array.
static java.lang.String toString(int datum)
          Writes out a single item of data in the default format.
static java.lang.String toString(int datum, int format)
          Writes out a single item of data in the specified format.
static java.lang.String toString(java.lang.String[][] data, int boxesAcross, int[] maxLength)
          Creates a string representation of a two-dimensional string array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMERIC

public static final int NUMERIC
Controls whether integers greater than or equal to 10 are displayed as numbers or letters.

See Also:
Constant Field Values

ALPHANUMERIC

public static final int ALPHANUMERIC
Controls whether integers greater than or equal to 10 are displayed as numbers or letters.

See Also:
Constant Field Values

TEXT

public static final int TEXT
Controls whether integers greater than or equal to 10 are displayed as numbers or letters.

See Also:
Constant Field Values

labels

public static final java.lang.String[] labels

defaultFormat

public static int defaultFormat
The default display format for values greater than or equal to 10.


PLAIN_TEXT

public static final int PLAIN_TEXT
See Also:
Constant Field Values

LIBRARY_BOOK

public static final int LIBRARY_BOOK
See Also:
Constant Field Values

CELL_STATE

public static final int CELL_STATE
See Also:
Constant Field Values

NUMBER_STATE

public static final int NUMBER_STATE
See Also:
Constant Field Values

NEIGHBOUR_STATE

public static final int NEIGHBOUR_STATE
See Also:
Constant Field Values

copyTypes

public static final java.lang.String[] copyTypes

defaultCopyType

public static int defaultCopyType

featuredGrades

public static final java.lang.String[] featuredGrades
Constructor Detail

SuDokuUtils

public SuDokuUtils()
Method Detail

setText

public static void setText(java.lang.String newText,
                           int cellsInRow)
                    throws java.lang.Exception
Sets the text string to be used in TEXT mode.

Throws:
java.lang.Exception

setDefaultText

public static void setDefaultText(int cellsInRow)
Sets a default text string.


toString

public static java.lang.String toString(byte[][] data,
                                        int boxesAcross,
                                        int maxDatum,
                                        int format)
Creates a string representation of a two-dimensional integer array.

Parameters:
maxDatum - maximum permitted value in the data array
format - format for numbers greater than or equal to 10

toString

public static java.lang.String toString(byte[][] data,
                                        int boxesAcross,
                                        int maxDatum)
Creates a string representation of a two-dimensional integer array.

Parameters:
maxDatum - maximum permitted value in the data array

toString

public static java.lang.String toString(byte[][] data,
                                        int boxesAcross)
Creates a string representation of a two-dimensional integer array with a maximum value equal to the grid size.


toString

public static java.lang.String toString(java.lang.String[][] data,
                                        int boxesAcross,
                                        int[] maxLength)
Creates a string representation of a two-dimensional string array.

Parameters:
maxLength - length of the longest string in the array

populate

public static void populate(byte[][] data,
                            java.lang.String s,
                            int format)
Populates a data array according to a string in the given format.


populate

public static void populate(byte[][] data,
                            java.lang.String s)
Populates a data array according to a string in the default format.


parse

public static byte parse(java.lang.String s,
                         int format)
Converts a string representation of a cell in the given format into a data value.


parse

public static byte parse(java.lang.String s)
Converts a string representation of a cell in the default format into a data value.


toString

public static java.lang.String toString(int datum,
                                        int format)
Writes out a single item of data in the specified format.


toString

public static java.lang.String toString(int datum)
Writes out a single item of data in the default format.


libraryBookHeader

public static java.lang.String libraryBookHeader(java.lang.String className,
                                                 int cellsInRow,
                                                 int boxesAcross,
                                                 java.lang.String[] featuredGrades)
Writes out the XML header for Pappocom library books.


libraryBookFooter

public static java.lang.String libraryBookFooter()
Writes out the XML header for Pappocom library books.