Module omix.api
Package omix.lang.io

Class AbstractTable<T>

java.lang.Object
omix.lang.io.AbstractTable<T>
Type Parameters:
T - The interpreted content of the table.
Direct Known Subclasses:
AbstractCSVTable

public abstract class AbstractTable<T>
extends Object
This class represents a general table format with cells which are accessible by the horizontal header text and an index. Subclasses can implement concrete file filters extracting data from files.
Author:
Dr. Peter Droste, Omix Visualization
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected AbstractTable​(File file)
    Constructs a table object from the given file.
    protected AbstractTable​(InputStream inputStream)
    Constructs a table object from the given input stream.
  • Method Summary

    Modifier and Type Method Description
    protected Integer addIndex​(String columnIdentifier, Integer columnIndex)
    inserts a column identifier in association with the column index.
    boolean available​(String columnIdentifier)
    checks the availability of a column
    List<String> columns()
    returns a list of all available columns.
    protected abstract T[][] data()
    This method returns the array.
    protected abstract T format​(String value)
    This method has to be implemented depending on the type of generic parameter T
    protected abstract T[][] generateArray​(int i, int j)
    This method must create the array T[][].
    T get​(String columnIdentifier, int row)
    returns the content of a cell accessed by column identifier and row index if available, otherwise null.
    protected Integer getIndex​(String columnIdentifier)
    returns the column index of a identifier.
    int length()
    returns the length of the data set i.e. the number of rows.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractTable

      protected AbstractTable​(File file)
      Constructs a table object from the given file.
      Parameters:
      file -
    • AbstractTable

      protected AbstractTable​(InputStream inputStream)
      Constructs a table object from the given input stream.
      Parameters:
      inputStream -
  • Method Details

    • length

      public int length()
      returns the length of the data set i.e. the number of rows.
      Returns:
      length
    • get

      public T get​(String columnIdentifier, int row)
      returns the content of a cell accessed by column identifier and row index if available, otherwise null.
      Parameters:
      columnIdentifier -
      row -
      Returns:
      cell content
    • getIndex

      protected Integer getIndex​(String columnIdentifier)
      returns the column index of a identifier.
      Parameters:
      columnIdentifier -
      Returns:
      index
    • available

      public boolean available​(String columnIdentifier)
      checks the availability of a column
      Parameters:
      columnIdentifier -
      Returns:
      availability
    • columns

      public List<String> columns()
      returns a list of all available columns.
      Returns:
      column list
    • addIndex

      protected Integer addIndex​(String columnIdentifier, Integer columnIndex)
      inserts a column identifier in association with the column index.
      Parameters:
      columnIdentifier -
      columnIndex -
      Returns:
      identifier
    • format

      protected abstract T format​(String value)
      This method has to be implemented depending on the type of generic parameter T
      Parameters:
      value -
      Returns:
      the formatted object
    • generateArray

      protected abstract T[][] generateArray​(int i, int j)
      This method must create the array T[][].
      Parameters:
      i -
      j -
      Returns:
      array i x j
    • data

      protected abstract T[][] data()
      This method returns the array.
      Returns:
      array