Class NumberGrid<U>

java.lang.Object
de.tilman_neumann.jml.base.NumberGrid<U>
Type Parameters:
U - element class
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BigIntGrid

public class NumberGrid<U>
extends java.lang.Object
implements java.io.Serializable
A two-dimensional number grid with pretty-print method.
See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    NumberGrid​(java.lang.String xLabel, int xStart, int xIncrement, java.lang.String yLabel, int yStart, int yIncrement)
    Full constructor with all options.
    NumberGrid​(java.lang.String xLabel, int xStart, java.lang.String yLabel, int yStart)
    Simplified constructor with offsets 1.
  • Method Summary

    Modifier and Type Method Description
    void add​(java.util.List<U> row)
    Adds a new row of numbers to this grid.
    int getNumberOfColumns()  
    java.util.LinkedList<java.util.List<U>> getRows()  
    java.util.ArrayList<U> toList()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NumberGrid

      public NumberGrid​(java.lang.String xLabel, int xStart, java.lang.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​(java.lang.String xLabel, int xStart, int xIncrement, java.lang.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 Details

    • add

      public void add​(java.util.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.
    • getRows

      public java.util.LinkedList<java.util.List<U>> getRows()
      Returns:
      list of rows
    • toString

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

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