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 columnList<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 parameterT
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.
-
Constructor Details
-
AbstractTable
Constructs a table object from the given file.- Parameters:
file
-
-
AbstractTable
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
returns the content of a cell accessed by column identifier and row index if available, otherwise null.- Parameters:
columnIdentifier
-row
-- Returns:
- cell content
-
getIndex
returns the column index of a identifier.- Parameters:
columnIdentifier
-- Returns:
- index
-
available
checks the availability of a column- Parameters:
columnIdentifier
-- Returns:
- availability
-
columns
returns a list of all available columns.- Returns:
- column list
-
addIndex
inserts a column identifier in association with the column index.- Parameters:
columnIdentifier
-columnIndex
-- Returns:
- identifier
-
format
This method has to be implemented depending on the type of generic parameterT
- Parameters:
value
-- Returns:
- the formatted object
-
generateArray
This method must create the array T[][].- Parameters:
i
-j
-- Returns:
- array i x j
-
data
This method returns the array.- Returns:
- array
-