Package de.xima.fc.common.data.table
Interface IHeaderTable<T>
-
- Type Parameters:
T
- The type of the cell values.
- All Superinterfaces:
Iterable<IHeaderTable.ITableRowEntry<T>>
- All Known Implementing Classes:
AbstractHeaderTable
,ImmutableListHeaderTable
public interface IHeaderTable<T> extends Iterable<IHeaderTable.ITableRowEntry<T>>
Represents a table with rows and a header.- Since:
- 8.2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
IHeaderTable.ITableRowEntry<T>
Represents a row in a table.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
cell(int row, int column)
Gets the value at the given row and column.T
cell(int row, String column)
Gets the value at the given row and column.int
columnCount()
Returns the number of columns in the table.List<String>
columnNames()
Gets the names of each column.Map<Integer,T>
columnsByIndex(int row)
Gets a view of the given row as a map.Map<String,T>
columnsByName(int row)
Gets a view of the given row as a map.int
columnToIndex(String column)
Converts a column name to an index.boolean
hasColumn(int column)
Checks if the table has a column at the given index.boolean
hasColumn(String column)
Checks if the table has a column with the given name.boolean
hasRow(int row)
Checks if the table has a row at the given index.String
indexToColumn(int index)
Converts an index to a column name.default Iterator<IHeaderTable.ITableRowEntry<T>>
iterator()
List<T>
row(int index)
Returns a view of the given row.int
rowCount()
Returns the number of rows in the table.Iterator<IHeaderTable.ITableRowEntry<T>>
rowIterator()
Returns an iterator over the rows of the table.List<List<T>>
rows()
Returns all rows;List<T>
rows(int column)
Returns a view of all rows at the given column.List<T>
rows(String column)
Returns a view of all rows at the given column.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
cell
T cell(int row, String column)
Gets the value at the given row and column.- Parameters:
row
- The row index.column
- The column name.- Returns:
- The value at the given row and column.
-
cell
T cell(int row, int column)
Gets the value at the given row and column.- Parameters:
row
- The row index.column
- The column index.- Returns:
- The value at the given row and column.
-
columnCount
int columnCount()
Returns the number of columns in the table.- Returns:
- The number of columns.
-
columnNames
List<String> columnNames()
Gets the names of each column.- Returns:
- The names of each column.
-
columnToIndex
int columnToIndex(String column)
Converts a column name to an index.- Parameters:
column
- The column name.- Returns:
- The index of the column.
- Throws:
IndexOutOfBoundsException
- When the column does not exist.
-
columnsByIndex
Map<Integer,T> columnsByIndex(int row)
Gets a view of the given row as a map. The keys are the column indices.- Parameters:
row
- Index of a row.- Returns:
- A view of the given row as a map.
-
columnsByName
Map<String,T> columnsByName(int row)
Gets a view of the given row as a map. The keys are the column names.- Parameters:
row
- Index of a row.- Returns:
- A view of the given row as a map.
-
hasColumn
boolean hasColumn(int column)
Checks if the table has a column at the given index.- Parameters:
column
- The name of the column.- Returns:
true
if the table has a column at the given index,false
otherwise.
-
hasColumn
boolean hasColumn(String column)
Checks if the table has a column with the given name.- Parameters:
column
- The name of the column.- Returns:
true
if the table has a column with the given name,false
otherwise.
-
hasRow
boolean hasRow(int row)
Checks if the table has a row at the given index.- Parameters:
row
- The index of the row.- Returns:
true
if the table has a row at the given index,false
otherwise.
-
indexToColumn
String indexToColumn(int index)
Converts an index to a column name.- Parameters:
index
- The index of the column.- Returns:
- The column name.
- Throws:
IndexOutOfBoundsException
- When the column does not exist.
-
iterator
default Iterator<IHeaderTable.ITableRowEntry<T>> iterator()
-
row
List<T> row(int index)
Returns a view of the given row. The list will have the same number of elements as there are columns in the table.- Parameters:
index
- The index of the row.- Returns:
- A view of the given row.
-
rowCount
int rowCount()
Returns the number of rows in the table.- Returns:
- The number of rows.
-
rowIterator
Iterator<IHeaderTable.ITableRowEntry<T>> rowIterator()
Returns an iterator over the rows of the table.- Returns:
- An iterator over the rows of the table.
-
rows
List<T> rows(String column)
Returns a view of all rows at the given column. The list will have the same number of elements as there are rows.- Parameters:
column
- The name of the column.- Returns:
- A view of all rows at the given column.
-
rows
List<T> rows(int column)
Returns a view of all rows at the given column. The list will have the same number of elements as there are rows.- Parameters:
column
- The index of the column.- Returns:
- A view of all rows at the given column.
-
-