public final class Table extends java.lang.Object implements Codable
Modifier and Type | Field and Description |
---|---|
java.lang.String[] |
cols |
java.lang.String |
name |
java.util.Vector |
rows |
java.lang.String[] |
sizes |
Constructor and Description |
---|
Table()
Empty constructor.
|
Table(java.lang.String[] cols)
Initializes a table object with column names.
|
Table(java.lang.String name,
java.lang.String[] cols)
Initializes a table object with a name and column names.
|
Table(java.lang.String name,
java.lang.String[] cols,
java.lang.String[] sizes)
Initializes a table object with a name, a set of
column names and the corresponding sizes of each column.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(java.lang.Object[] o)
Adds a row to this table.
|
void |
addRow(Values v)
Converts a Values object into a row and adds it to this table.
|
void |
appendRows(Values[] v)
Converts a Values[] into rows and appends the rows to this table.
|
void |
deleteRow(int idx)
Deletes the row at the specified index from this table.
|
java.lang.String[] |
getColumnNames()
Gets the column names of this table.
|
IData |
getIData()
Converts this table into an IData object.
|
Values |
getRow(int idx)
Gets the row at the given index as a Values object.
|
int |
getRowCount()
Returns the current number of rows in this table.
|
java.lang.Object |
getValue(java.lang.String key)
Implements the Codable interface.
|
java.lang.String[] |
getValueKeys()
Implements the Codable interface
|
Values[] |
getValues()
Retrieves all rows of this table and returns them as a Values[],
where each element in the array corresponds to a row in this table.
|
void |
insertRow(int idx,
Values v)
Converts a Values object into a row and inserts it at the
given index this table.
|
void |
setIData(IData id)
Initializes this Table object from an IData object.
|
void |
setRows(Values[] v)
Converts a Values[] into rows that are appended to this table.
|
void |
setValue(java.lang.String key,
java.lang.Object value)
Implements the Codable interface.
|
java.lang.String |
toString()
Retrieves the table schema and content as a string
for display purposes.
|
Values |
toValues()
Converts this table into a Values object.
|
void |
updateRow(int idx,
Values v)
Replaces a row at the given index with elements defined
in a Values object.
|
public java.lang.String name
public java.lang.String[] cols
public java.lang.String[] sizes
public java.util.Vector rows
public Table()
public Table(java.lang.String[] cols)
cols
- column names of the new table object.public Table(java.lang.String name, java.lang.String[] cols)
name
- name of the new table object.cols
- column names of the new table object.public Table(java.lang.String name, java.lang.String[] cols, java.lang.String[] sizes)
name
- name of the new table object.cols
- column names of the new table object.sizes
- size of each column for the new table object.public void addRow(Values v)
v
- Values object to add as a row of data.public void addRow(java.lang.Object[] o)
o
- array of Objects to be added.public void deleteRow(int idx)
idx
- index of row to remove.public void updateRow(int idx, Values v)
idx
- index of row to be replaced.v
- new row values.public void insertRow(int idx, Values v)
idx
- index to insert new row.v
- row values to insert.public java.lang.String[] getColumnNames()
public Values getRow(int idx)
idx
- index of row to retrieve.public Values[] getValues()
public Values toValues()
name - name of the table as String data - table content as Values[] cols - column names as String[] sizes - table size array as String[]
public void appendRows(Values[] v)
v
- array of Values objects to add to this table.public void setRows(Values[] v)
v
- array of Values objects to add to this table.appendRows(Values[])
public int getRowCount()
public java.lang.String toString()
toString
in class java.lang.Object
public IData getIData()
name - name of the table as String data - table content as Values[] cols - column names as String[] sizes - table size array as String[]
public void setIData(IData id)
id
- IData object from which this Table will be initialized. The IData must contain the following keys:
name - name of the table as String data - table content as Values[] (if generated by 6.0.1) rows - table contents as a Vector of Object[]'s. (all other releases) cols - column names as String[] sizes - table size array as String[]
public java.lang.Object getValue(java.lang.String key)
getValue
in interface Codable
key
- name of value to retrieve.Codable.getValue(java.lang.String)
public void setValue(java.lang.String key, java.lang.Object value)
setValue
in interface Codable
key
- name of value to set.value
- object value to set.Codable.setValue(java.lang.String, java.lang.Object)
public java.lang.String[] getValueKeys()
getValueKeys
in interface Codable
setValue(java.lang.String, java.lang.Object)
,
Codable.getValueKeys()