Class NumberGrid<U>

  • Type Parameters:
    U - element class
    All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    BigIntGrid

    public class NumberGrid<U>
    extends Object
    implements Serializable
    A two-dimensional number grid with pretty-print method.
    Author:
    Tilman Neumann
    See Also:
    Serialized Form
    • Constructor Detail

      • NumberGrid

        public NumberGrid​(String xLabel,
                          int xStart,
                          String yLabel,
                          int yStart)
        Simplified constructor with offsets 1.
        Parameters:
        xLabel - The letter to use for the x-axis
        xStart - The start value for the x-axis-values
        yLabel - The letter to use for the y-axis
        yStart - The start value for the y-axis-values
      • NumberGrid

        public NumberGrid​(String xLabel,
                          int xStart,
                          int xIncrement,
                          String yLabel,
                          int yStart,
                          int yIncrement)
        Full constructor with all options.
        Parameters:
        xLabel - The letter to use for the x-axis
        xStart - The start value for the x-axis-values
        xIncrement - The increment for the x-axis-values
        yLabel - The letter to use for the y-axis
        yStart - The start value for the y-axis-values
        yIncrement - The increment for the y-axis-values
    • Method Detail

      • add

        public void add​(List<U> row)
        Adds a new row of numbers to this grid.
        Parameters:
        row - The new row.
      • getNumberOfColumns

        public int getNumberOfColumns()
        Returns:
        Maximum number of elements in a row.
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        this array as a most compressed print table
      • toList

        public ArrayList<U> toList()
        Returns:
        This triangle converted into a list read by rows.