gov.usda.gdpc.util
Class GenericTable

java.lang.Object
  extended bygov.usda.gdpc.util.GenericTable
All Implemented Interfaces:
Table

public class GenericTable
extends java.lang.Object
implements Table

Author:
terryc

Constructor Summary
GenericTable()
          GenericTable constructor.
GenericTable(java.lang.Object[][] data)
          GenericTable constructor.
GenericTable(Table table)
          GenericTable constructor.
 
Method Summary
 java.lang.Object get(int columnIndex, int rowIndex)
          Get the data associated with the specified indices.
 java.lang.Object get(java.lang.Object columnHeading, java.lang.Object rowHeading)
          Unsupported operation.
 java.lang.Object[] getColumn(int columnIndex)
          Get the column for the given column index.
 java.lang.Object[] getColumn(java.lang.Object columnHeading)
          Unsupported operation.
 java.lang.Object getColumnHeading(int index)
          Unsupported operation.
 java.lang.Object[] getColumnHeadings()
          Unsupported operation.
 java.lang.Object[][] getData()
           
 java.lang.Object[] getRow(int rowIndex)
          Get the row for the given row index.
 java.lang.Object[] getRow(java.lang.Object rowHeading)
          Unsupported operation.
 java.lang.Object getRowHeading(int index)
          Unsupported operation.
 java.lang.Object[] getRowHeadings()
          Unsupported operation.
 int numColumns()
          Returns number of columns in this table.
 int numRows()
          Returns number of rows in this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericTable

public GenericTable()
GenericTable constructor.


GenericTable

public GenericTable(Table table)
GenericTable constructor. Copy constructor that copies only the table data. The headers are not used.

Parameters:
table - table to copy

GenericTable

public GenericTable(java.lang.Object[][] data)
GenericTable constructor.

Parameters:
data - this table's data
Method Detail

get

public final java.lang.Object get(int columnIndex,
                                  int rowIndex)
Get the data associated with the specified indices. Indices start with zero.

Specified by:
get in interface Table
Parameters:
columnIndex - column index
rowIndex - row index
Returns:
data.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (columnIndex < 0 || columnIndex >= numColumns()) or (rowIndex < 0 || rowIndex >= numRows()).

get

public java.lang.Object get(java.lang.Object columnHeading,
                            java.lang.Object rowHeading)
Unsupported operation.

Specified by:
get in interface Table
Parameters:
columnHeading - column heading
rowHeading - row heading
Returns:
data. null if not found.

getColumn

public java.lang.Object[] getColumn(java.lang.Object columnHeading)
Unsupported operation.

Specified by:
getColumn in interface Table
Parameters:
columnHeading - column heading
Returns:
data. null if not found.

getColumn

public java.lang.Object[] getColumn(int columnIndex)
Get the column for the given column index.

Specified by:
getColumn in interface Table
Parameters:
columnIndex - column index
Returns:
data. null if not found.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (columnIndex < 0 || columnIndex >= numColumns()).

getColumnHeading

public java.lang.Object getColumnHeading(int index)
Unsupported operation.

Specified by:
getColumnHeading in interface Table
Parameters:
index - column index
Returns:
column heading

getColumnHeadings

public java.lang.Object[] getColumnHeadings()
Unsupported operation.

Specified by:
getColumnHeadings in interface Table
Returns:
column headings

getRow

public java.lang.Object[] getRow(java.lang.Object rowHeading)
Unsupported operation.

Specified by:
getRow in interface Table
Parameters:
rowHeading - row heading
Returns:
data. null if not found.

getRow

public java.lang.Object[] getRow(int rowIndex)
Get the row for the given row index.

Specified by:
getRow in interface Table
Parameters:
rowIndex - row index
Returns:
data. null if not found.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (rowIndex < 0 || rowIndex >= numRows()).

getRowHeading

public java.lang.Object getRowHeading(int index)
Unsupported operation.

Specified by:
getRowHeading in interface Table
Parameters:
index - row index
Returns:
row heading

getRowHeadings

public java.lang.Object[] getRowHeadings()
Unsupported operation.

Specified by:
getRowHeadings in interface Table
Returns:
row headings

numColumns

public int numColumns()
Returns number of columns in this table.

Specified by:
numColumns in interface Table
Returns:
number of columns

numRows

public int numRows()
Returns number of rows in this table.

Specified by:
numRows in interface Table
Returns:
number of rows

getData

public java.lang.Object[][] getData()