Class GenericObjectTable<T>
- java.lang.Object
-
- org.pentaho.reporting.libraries.base.util.ObjectTable<T>
-
- org.pentaho.reporting.libraries.base.util.GenericObjectTable<T>
-
- All Implemented Interfaces:
Serializable
public class GenericObjectTable<T> extends ObjectTable<T>
A generic table storing objects in an fast array backend. This generic class provides public getter and setters for the contents of the table.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericObjectTable()
Creates a new object table.GenericObjectTable(int increment)
Creates a new table.GenericObjectTable(int rowIncrement, int colIncrement)
Creates a new table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyColumn(int oldColumn, int newColumn)
Copys the contents of the old column to the new column.void
copyRow(int oldRow, int newRow)
Copys the contents of the old row to the new row.T
getObject(int row, int column)
Returns the object from a particular cell in the table.void
setObject(int row, int column, T object)
Sets the object for a cell in the table.-
Methods inherited from class org.pentaho.reporting.libraries.base.util.ObjectTable
clear, clearRow, ensureCapacity, ensureRowCapacity, equals, getColumnCount, getColumnIncrement, getData, getRowCount, getRowIncrement, hashCode, readSerializedData, setData, writeSerializedData
-
-
-
-
Constructor Detail
-
GenericObjectTable
public GenericObjectTable()
Creates a new object table.
-
GenericObjectTable
public GenericObjectTable(int increment)
Creates a new table.- Parameters:
increment
- the row and column size increment.
-
GenericObjectTable
public GenericObjectTable(int rowIncrement, int colIncrement)
Creates a new table.- Parameters:
rowIncrement
- the row size increment.colIncrement
- the column size increment.
-
-
Method Detail
-
getObject
public T getObject(int row, int column)
Returns the object from a particular cell in the table. Returns null, if there is no object at the given position. Note: throws IndexOutOfBoundsException if row or column is negative.- Overrides:
getObject
in classObjectTable<T>
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The object.
-
setObject
public void setObject(int row, int column, T object)
Sets the object for a cell in the table. The table is expanded if necessary.- Overrides:
setObject
in classObjectTable<T>
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).object
- the object.
-
copyColumn
public void copyColumn(int oldColumn, int newColumn)
Copys the contents of the old column to the new column.- Overrides:
copyColumn
in classObjectTable<T>
- Parameters:
oldColumn
- the index of the old (source) columnnewColumn
- the index of the new column
-
copyRow
public void copyRow(int oldRow, int newRow)
Copys the contents of the old row to the new row. This uses raw access to the data and is remarkably faster than manual copying.- Overrides:
copyRow
in classObjectTable<T>
- Parameters:
oldRow
- the index of the old rownewRow
- the index of the new row
-
-