Class AbstractHeaderTable<T>

java.lang.Object
de.xima.fc.common.data.table.AbstractHeaderTable<T>
Type Parameters:
T - The type of the cell values.
All Implemented Interfaces:
IHeaderTable<T>, Serializable, Iterable<IHeaderTable.ITableRowEntry<T>>
Direct Known Subclasses:
ImmutableListHeaderTable

public abstract class AbstractHeaderTable<T> extends Object implements IHeaderTable<T>, Serializable
Abstract implementation of IHeaderTable. Implements all methods that can be derived from other methods. You only need to implement IHeaderTable.columnNames() and IHeaderTable.rows(). You should also implement columnToIndex(String) and hasColumn(String) for performance reasons. All other methods cannot are final and cannot be overridden.
Since:
8.2.0
See Also:
  • Constructor Details

    • AbstractHeaderTable

      public AbstractHeaderTable()
  • Method Details

    • cell

      public final T cell(int row, String column)
      Description copied from interface: IHeaderTable
      Gets the value at the given row and column.
      Specified by:
      cell in interface IHeaderTable<T>
      Parameters:
      row - The row index.
      column - The column name.
      Returns:
      The value at the given row and column.
    • cell

      public final T cell(int row, int column)
      Description copied from interface: IHeaderTable
      Gets the value at the given row and column.
      Specified by:
      cell in interface IHeaderTable<T>
      Parameters:
      row - The row index.
      column - The column index.
      Returns:
      The value at the given row and column.
    • columnCount

      public final int columnCount()
      Description copied from interface: IHeaderTable
      Returns the number of columns in the table.
      Specified by:
      columnCount in interface IHeaderTable<T>
      Returns:
      The number of columns.
    • columnToIndex

      public int columnToIndex(String column)
      Description copied from interface: IHeaderTable
      Converts a column name to an index.
      Specified by:
      columnToIndex in interface IHeaderTable<T>
      Parameters:
      column - The column name.
      Returns:
      The index of the column.
    • columnsByIndex

      public final Map<Integer,T> columnsByIndex(int row)
      Description copied from interface: IHeaderTable
      Gets a view of the given row as a map. The keys are the column indices.
      Specified by:
      columnsByIndex in interface IHeaderTable<T>
      Parameters:
      row - Index of a row.
      Returns:
      A view of the given row as a map.
    • columnsByName

      public final Map<String,T> columnsByName(int row)
      Description copied from interface: IHeaderTable
      Gets a view of the given row as a map. The keys are the column names.
      Specified by:
      columnsByName in interface IHeaderTable<T>
      Parameters:
      row - Index of a row.
      Returns:
      A view of the given row as a map.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hasColumn

      public final boolean hasColumn(int column)
      Description copied from interface: IHeaderTable
      Checks if the table has a column at the given index.
      Specified by:
      hasColumn in interface IHeaderTable<T>
      Parameters:
      column - The name of the column.
      Returns:
      true if the table has a column at the given index, false otherwise.
    • hasColumn

      public boolean hasColumn(String column)
      Description copied from interface: IHeaderTable
      Checks if the table has a column with the given name.
      Specified by:
      hasColumn in interface IHeaderTable<T>
      Parameters:
      column - The name of the column.
      Returns:
      true if the table has a column with the given name, false otherwise.
    • hasRow

      public final boolean hasRow(int row)
      Description copied from interface: IHeaderTable
      Checks if the table has a row at the given index.
      Specified by:
      hasRow in interface IHeaderTable<T>
      Parameters:
      row - The index of the row.
      Returns:
      true if the table has a row at the given index, false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • indexToColumn

      public final String indexToColumn(int index)
      Description copied from interface: IHeaderTable
      Converts an index to a column name.
      Specified by:
      indexToColumn in interface IHeaderTable<T>
      Parameters:
      index - The index of the column.
      Returns:
      The column name.
    • row

      public final List<T> row(int index)
      Description copied from interface: IHeaderTable
      Returns a view of the given row. The list will have the same number of elements as there are columns in the table.
      Specified by:
      row in interface IHeaderTable<T>
      Parameters:
      index - The index of the row.
      Returns:
      A view of the given row.
    • rowCount

      public final int rowCount()
      Description copied from interface: IHeaderTable
      Returns the number of rows in the table.
      Specified by:
      rowCount in interface IHeaderTable<T>
      Returns:
      The number of rows.
    • rowIterator

      public final Iterator<IHeaderTable.ITableRowEntry<T>> rowIterator()
      Description copied from interface: IHeaderTable
      Returns an iterator over the rows of the table.
      Specified by:
      rowIterator in interface IHeaderTable<T>
      Returns:
      An iterator over the rows of the table.
    • rows

      public final List<T> rows(String column)
      Description copied from interface: IHeaderTable
      Returns a view of all rows at the given column. The list will have the same number of elements as there are rows.
      Specified by:
      rows in interface IHeaderTable<T>
      Parameters:
      column - The name of the column.
      Returns:
      A view of all rows at the given column.
    • rows

      public final List<T> rows(int column)
      Description copied from interface: IHeaderTable
      Returns a view of all rows at the given column. The list will have the same number of elements as there are rows.
      Specified by:
      rows in interface IHeaderTable<T>
      Parameters:
      column - The index of the column.
      Returns:
      A view of all rows at the given column.