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:
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 Summary
Constructors Constructor Description NumberGrid(String xLabel, int xStart, int xIncrement, String yLabel, int yStart, int yIncrement)
Full constructor with all options.NumberGrid(String xLabel, int xStart, String yLabel, int yStart)
Simplified constructor with offsets 1.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(List<U> row)
Adds a new row of numbers to this grid.int
getNumberOfColumns()
LinkedList<List<U>>
getRows()
ArrayList<U>
toList()
String
toString()
-
-
-
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-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(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-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 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.
-
getRows
public LinkedList<List<U>> getRows()
- Returns:
- list of rows
-
toString
public String toString()
-
-