public class Table extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, java.lang.Iterable<RowView>
TableEntry
types.
Tables are used in YouScope to e.g. communicate between jobs, or to log states of jobs.Modifier | Constructor and Description |
---|---|
|
Table(java.lang.String tableName,
java.lang.String tableDescription,
ColumnDefinition<?>... columnDefinitions)
Constructor using information on the column names and types.
|
|
Table(java.lang.String tableName,
java.lang.String tableDescription,
long creationTime,
ColumnDefinition<?>... columnDefinitions)
Constructor using information on the column names and types.
|
|
Table(java.lang.String tableName,
java.lang.String tableDescription,
long creationTime,
PositionInformation positionInformation,
ExecutionInformation executionInformation,
ColumnDefinition<?>... columnDefinitions)
Constructor using information on the column names and types.
|
|
Table(java.lang.String tableName,
java.lang.String tableDescription,
PositionInformation positionInformation,
ExecutionInformation executionInformation,
ColumnDefinition<?>... columnDefinitions)
Constructor using information on the column names and types.
|
protected |
Table(Table other)
Protected Copy constructor.
|
|
Table(TableDefinition tableDefinition)
Constructor using an already available
TableDefinition . |
|
Table(TableDefinition tableDefinition,
long creationTime)
Constructor using an already available
TableDefinition . |
|
Table(TableDefinition tableDefinition,
long creationTime,
PositionInformation positionInformation,
ExecutionInformation executionInformation)
Constructor using an already available
TableDefinition . |
|
Table(TableDefinition tableDefinition,
PositionInformation positionInformation,
ExecutionInformation executionInformation)
Constructor using an already available
TableDefinition . |
Modifier and Type | Method and Description |
---|---|
void |
addRow(java.io.Serializable... values)
Adds a row to the table.
|
void |
addRow(TemporaryRow temporaryRow)
Adds a temporary row to this table.
|
void |
addRows(Table table)
Adds all rows of the table at the end of the rows of this table.
|
Table |
clone() |
TemporaryRow |
createTemporaryRow()
Creates a temporary row.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getColumnName(int column)
Returns the name (title) of the column with the given index.
|
java.lang.String[] |
getColumnNames()
Returns the names (titles) of all columns.
|
<T extends java.io.Serializable> |
getColumnView(ColumnDefinition<T> columnDefinition)
Returns a view on the column which equals (only name and value type) a given, already known, column definition.
|
ColumnView<?> |
getColumnView(int column)
Returns a view on the column with the given index.
|
<T extends java.io.Serializable> |
getColumnView(int column,
java.lang.Class<T> valueType)
Returns a view on the column with the given index, having the given value type.
|
ColumnView<?> |
getColumnView(java.lang.String columnName)
Returns a view on the column with the given name.
|
<T extends java.io.Serializable> |
getColumnView(java.lang.String columnName,
java.lang.Class<T> valueType)
Returns a view on the column with the given name, having the given value type.
|
long |
getCreationTime()
Returns the time in milliseconds after January 1, 1970 00:00:00 GMT, when the content of this table was created.
|
<T extends java.io.Serializable> |
getEntry(int row,
ColumnDefinition<T> columnDefinition)
Returns the entry at the given row corresponding to the given columnDefinition.
|
TableEntry<?> |
getEntry(int row,
int column)
Returns the entry at the given row and column.
|
<T extends java.io.Serializable> |
getEntry(int row,
int column,
java.lang.Class<T> valueType)
Returns the entry at the given row and column, having the given value type.
|
TableEntry<?> |
getEntry(int row,
java.lang.String columnName)
Returns the entry at the given row and column.
|
<T extends java.io.Serializable> |
getEntry(int row,
java.lang.String columnName,
java.lang.Class<T> valueType)
Returns the entry at the given row and column, having the given value type.
|
ExecutionInformation |
getExecutionInformation()
Returns logical information of when during the measurement execution the table was created.
|
int |
getNumColumns()
Returns the number of columns in this table.
|
int |
getNumRows()
Returns the number of rows in this table.
|
PositionInformation |
getPositionInformation()
Returns the logical position information in the measurement where this table was created.
|
RowView |
getRowView(int row)
Returns a row view for the given row index.
|
TableDefinition |
getTableDefinition()
Returns the definition (number, type and names of columns) of this table.
|
<T extends java.io.Serializable> |
getValue(int row,
ColumnDefinition<T> columnDefinition)
Returns the value of the entry at the given row corresponding to the given columnDefinition.
|
java.io.Serializable |
getValue(int row,
int column)
Returns the table entry's value at the given row and column.
|
<T extends java.io.Serializable> |
getValue(int row,
int column,
java.lang.Class<T> valueType)
Returns the entry's value at the given row and column, having the given value type.
|
java.io.Serializable |
getValue(int row,
java.lang.String columnName)
Returns the entry's value at the given row and column.
|
<T extends java.io.Serializable> |
getValue(int row,
java.lang.String columnName,
java.lang.Class<T> valueType)
Returns the entry's value at the given row and column, having the given value type.
|
int |
hashCode() |
void |
insertRow(int row,
java.io.Serializable... values)
Inserts a row to the table at the given row.
|
void |
insertRow(int row,
TemporaryRow temporaryRow)
Inserts a temporary row at the given row index to this table.
|
java.util.Iterator<RowView> |
iterator() |
void |
removeRow(int row)
Removes the row at the given index.
|
void |
setCreationTime(long creationTime)
Sets the time in milliseconds after January 1, 1970 00:00:00 GMT, when the content of this table was created.
|
void |
setExecutionInformation(ExecutionInformation executionInformation)
Sets logical information of when during the measurement execution the table was created.
|
void |
setPositionInformation(PositionInformation positionInformation)
Sets the logical position information in the measurement where this table was created.
|
Table |
toTable(TableDefinition tableDefinition)
Creates a table containing conforming to the provided table definition.
|
protected Table(Table other)
clone()
from outside, and copy constructor from sub-classes.other
- object to copy.public Table(TableDefinition tableDefinition, long creationTime, PositionInformation positionInformation, ExecutionInformation executionInformation) throws java.lang.NullPointerException
TableDefinition
.tableDefinition
- The table definition, defining the number, names and types of the columns.executionInformation
- The execution of the measurement where this table was created.positionInformation
- The logical position in the measurement where this table was created.creationTime
- The time (in milliseconds since January 1, 1970, 00:00:00 GMT) when the content of this table was created (see Date.getTime()
).java.lang.NullPointerException
- Thrown if the table definition is null.public Table(TableDefinition tableDefinition) throws java.lang.NullPointerException
TableDefinition
.
The creation time of the table is set to the current time, the position and execution information to null.tableDefinition
- The table definition, defining the number, names and types of the columns.java.lang.NullPointerException
- Thrown if the table definition is null.public Table(TableDefinition tableDefinition, long creationTime) throws java.lang.NullPointerException
TableDefinition
.
The position and execution information is set to null.tableDefinition
- The table definition, defining the number, names and types of the columns.creationTime
- The time (in milliseconds since January 1, 1970, 00:00:00 GMT) when the content of this table was created (see Date.getTime()
).java.lang.NullPointerException
- Thrown if the table definition is null.public Table(TableDefinition tableDefinition, PositionInformation positionInformation, ExecutionInformation executionInformation) throws java.lang.NullPointerException
TableDefinition
.
The creation time of the table is set to the current time.tableDefinition
- The table definition, defining the number, names and types of the columns.executionInformation
- The execution of the measurement where this table was created.positionInformation
- The logical position in the measurement where this table was created.java.lang.NullPointerException
- Thrown if the table definition is null.public Table(java.lang.String tableName, java.lang.String tableDescription, ColumnDefinition<?>... columnDefinitions) throws TableException, java.lang.NullPointerException
TableHelper
for supported column types.
The creation time of the table is set to the current time, the position and execution information to null.tableName
- The name (title) of the table. Should be a single short line.tableDescription
- Description of the meaning and intended usage of the table. Might contain multiple lines (separated by line breaks).columnDefinitions
- The columns of the table.TableException
- Thrown if given column definitions are currently not supported by YouScope.java.lang.NullPointerException
- Thrown if one of the columns is null, or the title is null.public Table(java.lang.String tableName, java.lang.String tableDescription, long creationTime, PositionInformation positionInformation, ExecutionInformation executionInformation, ColumnDefinition<?>... columnDefinitions) throws TableException, java.lang.NullPointerException
TableHelper
for supported column types.tableName
- The name (title) of the table. Should be a single short line.tableDescription
- Description of the meaning and intended usage of the table. Might contain multiple lines (separated by line breaks).creationTime
- The time (in milliseconds since January 1, 1970, 00:00:00 GMT) when the content of this table was created (see Date.getTime()
).executionInformation
- The execution of the measurement where this table was created.positionInformation
- The logical position in the measurement where this table was created.columnDefinitions
- The columns of the table.TableException
- Thrown if given column definitions are currently not supported by YouScope.java.lang.NullPointerException
- Thrown if one of the columns is null, or the title is null.public Table(java.lang.String tableName, java.lang.String tableDescription, long creationTime, ColumnDefinition<?>... columnDefinitions) throws TableException, java.lang.NullPointerException
TableHelper
for supported column types.
The position and execution information is set to null.tableName
- The name (title) of the table. Should be a single short line.tableDescription
- Description of the meaning and intended usage of the table. Might contain multiple lines (separated by line breaks).creationTime
- The time (in milliseconds since January 1, 1970, 00:00:00 GMT) when the content of this table was created (see Date.getTime()
).columnDefinitions
- The columns of the table.TableException
- Thrown if given column definitions are currently not supported by YouScope.java.lang.NullPointerException
- Thrown if one of the columns is null, or the title is null.public Table(java.lang.String tableName, java.lang.String tableDescription, PositionInformation positionInformation, ExecutionInformation executionInformation, ColumnDefinition<?>... columnDefinitions) throws TableException, java.lang.NullPointerException
TableHelper
for supported column types.
The creation time of the table is set to the current time.tableName
- The name (title) of the table. Should be a single short line.tableDescription
- Description of the meaning and intended usage of the table. Might contain multiple lines (separated by line breaks).executionInformation
- The execution of the measurement where this table was created.positionInformation
- The logical position in the measurement where this table was created.columnDefinitions
- The columns of the table.TableException
- Thrown if given column definitions are currently not supported by YouScope.java.lang.NullPointerException
- Thrown if one of the columns is null, or the title is null.public Table toTable(TableDefinition tableDefinition) throws TableException, java.lang.NullPointerException
tableDefinition
- The table definition of the new table.TableException
- Thrown if the new table could not be constructed due to the reasons stated in the text.java.lang.NullPointerException
- Thrown if tableDefinition is null.public void addRow(java.io.Serializable... values) throws TableException
values
- The values of the row.TableException
- Thrown if number or types of values is wrong, or if a value corresponding to a column not allowing null entries is null.public TemporaryRow createTemporaryRow() throws TableException
addRow(TemporaryRow)
or insertRow(int, TemporaryRow)
.TableException
- Thrown if temporary row could not be constructed.public void addRow(TemporaryRow temporaryRow) throws TableException, java.lang.NullPointerException
temporaryRow
- The temporary row containing the values to add.TableException
- thrown if any of the conditions is violated.java.lang.NullPointerException
- Thrown if temporaryRow is null.public void addRows(Table table) throws TableException, java.lang.NullPointerException
table
- Table whose rows should be copied.TableException
- Thrown if table definitions do not match.java.lang.NullPointerException
- Thrown if table is null.public void insertRow(int row, TemporaryRow temporaryRow) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- The index where to add this row. Must be bigger or equal to 0, and smaller than getNumRows()
.temporaryRow
- The temporary row containing the values to insert.TableException
- thrown if any of the conditions is violated.java.lang.NullPointerException
- Thrown if temporaryRow is null.java.lang.IndexOutOfBoundsException
- thrown if row index is invalid.public void insertRow(int row, java.io.Serializable... values) throws TableException, java.lang.IndexOutOfBoundsException
row
- The index where to add this row. Must be bigger or equal to 0, and smaller than getNumRows()
.values
- The values of the row.TableException
- Thrown if number or types of values is wrong, or if a value corresponding to a column not allowing null entries is null.java.lang.IndexOutOfBoundsException
- thrown if row index is invalid.public void removeRow(int row) throws java.lang.IndexOutOfBoundsException
row
- The index of the row to remove. Must be bigger or equal to 0, and smaller than getNumRows()
.java.lang.IndexOutOfBoundsException
public TableDefinition getTableDefinition()
public int getNumColumns()
public int getNumRows()
public RowView getRowView(int row) throws java.lang.IndexOutOfBoundsException
row
- row index.java.lang.IndexOutOfBoundsException
- Thrown if row index is invalid.public TableEntry<?> getEntry(int row, int column) throws java.lang.IndexOutOfBoundsException
row
- Row of the entry.column
- Column of the entry.java.lang.IndexOutOfBoundsException
- thrown, if row or column index is invalid.public java.io.Serializable getValue(int row, int column) throws java.lang.IndexOutOfBoundsException
row
- Row of the entry.column
- Column of the entry.java.lang.IndexOutOfBoundsException
- thrown, if row or column index is invalid.public TableEntry<?> getEntry(int row, java.lang.String columnName) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- Row of the entry.columnName
- Name of the column.java.lang.IndexOutOfBoundsException
- thrown, if row index is invalid.TableException
- Thrown if table does not contain column with given name.java.lang.NullPointerException
- Thrown if columnName is null.public java.io.Serializable getValue(int row, java.lang.String columnName) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- Row of the entry.columnName
- Name of the column.java.lang.IndexOutOfBoundsException
- thrown, if row index is invalid.TableException
- Thrown if table does not contain column with given name.java.lang.NullPointerException
- Thrown if columnName is null.public <T extends java.io.Serializable> TableEntry<? extends T> getEntry(int row, java.lang.String columnName, java.lang.Class<T> valueType) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- Row of the entry.columnName
- Name of the column.valueType
- value type of entry. Must be a super-class of the actual value type.java.lang.IndexOutOfBoundsException
- thrown, if row index is invalid.TableException
- Thrown if table does not contain column with given name.java.lang.NullPointerException
- Thrown if columnName or valueType is null.public <T extends java.io.Serializable> TableEntry<T> getEntry(int row, ColumnDefinition<T> columnDefinition) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- Row of the entry.columnDefinition
- Definition of the column whose entry at the given row should be returned.TableException
- Thrown if table does not contain column corresponding to the given definition, or if column has different value types.java.lang.NullPointerException
- Thrown if columnDefinition is null.java.lang.IndexOutOfBoundsException
- Thrown if row is invalid.public <T extends java.io.Serializable> T getValue(int row, ColumnDefinition<T> columnDefinition) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- Row of the entry.columnDefinition
- Definition of the column whose entry's value at the given row should be returned.TableException
- Thrown if table does not contain column corresponding to the given definition, or if column has different value types.java.lang.NullPointerException
- Thrown if columnDefinition is null.java.lang.IndexOutOfBoundsException
- thrown if row is invalid.public <T extends java.io.Serializable> T getValue(int row, java.lang.String columnName, java.lang.Class<T> valueType) throws TableException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
row
- Row of the entry.columnName
- Name of the column.valueType
- value type of entry. Must be a super-class of the actual value type.java.lang.IndexOutOfBoundsException
- thrown, if row index is invalid.TableException
- Thrown if table does not contain column with given name.java.lang.NullPointerException
- Thrown if columnName or valueType is null.public <T extends java.io.Serializable> TableEntry<? extends T> getEntry(int row, int column, java.lang.Class<T> valueType) throws java.lang.IndexOutOfBoundsException, TableException, java.lang.NullPointerException
row
- Row of the entry.column
- Column of the entry.valueType
- value type of entry. Must be a super-class of the actual value type.java.lang.IndexOutOfBoundsException
- thrown, if row or column index is invalid.TableException
- Thrown if the entry's value type is incompatible with given valueType.java.lang.NullPointerException
- Thrown if valueType is null.public <T extends java.io.Serializable> T getValue(int row, int column, java.lang.Class<T> valueType) throws java.lang.IndexOutOfBoundsException, TableException, java.lang.NullPointerException
row
- Row of the entry.column
- Column of the entry.valueType
- value type of entry. Must be a super-class of the actual value type.java.lang.IndexOutOfBoundsException
- thrown, if row or column index is invalid.TableException
- Thrown if the entry's value type is incompatible with given valueType.java.lang.NullPointerException
- Thrown if valueType is null.public ColumnView<?> getColumnView(int column) throws java.lang.IndexOutOfBoundsException
column
- index of column.java.lang.IndexOutOfBoundsException
- Thrown if index is invalid.public java.lang.String getColumnName(int column) throws java.lang.IndexOutOfBoundsException
column
- index of column.java.lang.IndexOutOfBoundsException
- Thrown if index is invalid.public java.lang.String[] getColumnNames()
public ColumnView<?> getColumnView(java.lang.String columnName) throws java.lang.NullPointerException, TableException
columnName
- Name of the column (case sensitive).java.lang.NullPointerException
- Thrown if columnName is null.TableException
- Thrown if table does not contain column with given name.public <T extends java.io.Serializable> ColumnView<? extends T> getColumnView(int column, java.lang.Class<T> valueType) throws java.lang.IndexOutOfBoundsException, TableException, java.lang.NullPointerException
column
- index of column.valueType
- value type of column. Must be a super-class of the actual value type.java.lang.IndexOutOfBoundsException
- Thrown if index is invalid.TableException
- Thrown if column at given index does not contain entries with value type valueType.java.lang.NullPointerException
- Thrown if valueType is null.public <T extends java.io.Serializable> ColumnView<? extends T> getColumnView(java.lang.String columnName, java.lang.Class<T> valueType) throws TableException, java.lang.NullPointerException
columnName
- Name of the column (case sensitive).valueType
- value type of column.TableException
- Thrown if table does not contain a column with given name, or if column with the given name does not contain entries with value type valueType.java.lang.NullPointerException
- Thrown if columnName or valueType is null.public <T extends java.io.Serializable> ColumnView<T> getColumnView(ColumnDefinition<T> columnDefinition) throws TableException, java.lang.NullPointerException
columnDefinition
- The definition of the column.TableException
- Thrown if table does not contain corresponding column, or if corresponding column has different valueType.java.lang.NullPointerException
- Thrown if columnDefinition is null.public Table clone()
clone
in class java.lang.Object
public PositionInformation getPositionInformation()
public void setPositionInformation(PositionInformation positionInformation)
positionInformation
- position information where this table was created.public ExecutionInformation getExecutionInformation()
public void setExecutionInformation(ExecutionInformation executionInformation)
executionInformation
- logical execution information when the table was created.public long getCreationTime()
Date.Date(long)
.public void setCreationTime(long creationTime)
Date.getTime()
.creationTime
- Time in ms when content was created.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object