org.pentaho.reporting.libraries.base.util

Class GenericObjectTable

public class GenericObjectTable extends ObjectTable

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

Constructor Summary
GenericObjectTable()
Creates a new object table.
GenericObjectTable(int increment)
Creates a new table.
GenericObjectTable(int rowIncrement, int colIncrement)
Creates a new table.
Method Summary
voidcopyColumn(int oldColumn, int newColumn)
Copys the contents of the old column to the new column.
voidcopyRow(int oldRow, int newRow)
Copys the contents of the old row to the new row.
ObjectgetObject(int row, int column)
Returns the object from a particular cell in the table.
voidsetObject(int row, int column, Object object)
Sets the object for a cell in the table.

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

copyColumn

public void copyColumn(int oldColumn, int newColumn)
Copys the contents of the old column to the new column.

Parameters: oldColumn the index of the old (source) column newColumn 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.

Parameters: oldRow the index of the old row newRow the index of the new row

getObject

public Object 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.

Parameters: row the row index (zero-based). column the column index (zero-based).

Returns: The object.

setObject

public void setObject(int row, int column, Object object)
Sets the object for a cell in the table. The table is expanded if necessary.

Parameters: row the row index (zero-based). column the column index (zero-based). object the object.