Package de.tilman_neumann.jml.base
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
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-axisxStart
- The start value for the x-axis-valuesyLabel
- The letter to use for the y-axisyStart
- 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-axisxStart
- The start value for the x-axis-valuesxIncrement
- The increment for the x-axis-valuesyLabel
- The letter to use for the y-axisyStart
- The start value for the y-axis-valuesyIncrement
- The increment for the y-axis-values
-
-
Method Details
-
add
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
- Returns:
- list of rows
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
- Returns:
- this array as a most compressed print table
-
toList
- Returns:
- This triangle converted into a list read by rows.
-