org.omnaest.utils.structure.table.concrete
Class ArrayTable<E>

java.lang.Object
  extended by org.omnaest.utils.structure.table.concrete.TableAbstract<E>
      extended by org.omnaest.utils.structure.table.concrete.TableBasic<E>
          extended by org.omnaest.utils.structure.table.concrete.ArrayTable<E>
All Implemented Interfaces:
Serializable, Iterable<Table.Row<E>>, TableAdaptable<E>, TableCloneable<E>, TableCore<E>, TableCoreImmutable<E>, TableDataSource<E>, TableSelectable<E>, TableSerializable<E>, Table<E>
Direct Known Subclasses:
SelectionExecutor.ArrayTableWithAccessibleTableInternal

public class ArrayTable<E>
extends TableBasic<E>

Implementation of Table which has a rich underlying structure based on ArrayLists, HashSet and HashMap.

Author:
Omnaest
See Also:
Table, Serialized Form

Nested Class Summary
 class ArrayTable.ArrayTableInternal
           
 
Nested classes/interfaces inherited from interface org.omnaest.utils.structure.table.Table
Table.Cell<E>, Table.CellImmutable<E>, Table.Column<E>, Table.Row<E>, Table.Stripe<E>, Table.TableCellConverter<FROM,TO>, Table.TableCellVisitor<E>, Table.TableComponent, Table.TableSize
 
Nested classes/interfaces inherited from interface org.omnaest.utils.structure.table.subspecification.TableCloneable
TableCloneable.TableCloner<E>
 
Nested classes/interfaces inherited from interface org.omnaest.utils.structure.table.subspecification.TableSelectable
TableSelectable.Predicate<E>, TableSelectable.Selection<E>, TableSelectable.SelectionJoin<E>, TableSelectable.Where<E>
 
Nested classes/interfaces inherited from interface org.omnaest.utils.structure.table.subspecification.TableSerializable
TableSerializable.TableSerializer<E>
 
Nested classes/interfaces inherited from interface org.omnaest.utils.structure.table.subspecification.TableAdaptable
TableAdaptable.TableAdapterProvider<E>
 
Field Summary
protected  TableInternal.CellAndStripeResolver<E> cellAndStripeResolver
           
protected  StripeFactory<E> stripeFactory
           
protected  TableInternal.TableContent<E> tableContent
           
protected  TableInternal.TableContentResolver<E> tableContentResolver
           
protected  TableInternal<E> tableInternal
           
protected  Object tableName
           
 
Fields inherited from class org.omnaest.utils.structure.table.concrete.TableBasic
tableAdapterProvider, tableCloner, tableSerializer
 
Constructor Summary
ArrayTable()
           
ArrayTable(E[][] elementArray)
           
 
Method Summary
 Table.Column<E> addColumnCellElements(int columnIndexPosition, List<? extends E> columnCellElementList)
          Adds a Table.Column to the Table with the given Table.CellImmutable.getElement()s at the given index position of the Table.Columns.
 Table.Column<E> addColumnCellElements(List<? extends E> columnCellElementList)
          Adds a Table.Column to the Table with the given Table.CellImmutable.getElement()s at the end of the Table.Columns.
 Table.Row<E> addRowCellElements(int rowIndexPosition, List<? extends E> rowCellElementList)
          Adds a new Table.Row to the Table at the given index position.
 Table.Row<E> addRowCellElements(List<? extends E> rowCellElementList)
          Adds a new row to the table.
 Table<E> clear()
          Clears the table, so that there are no elements left.
 Table.Cell<E> getCell(int cellIndexPosition)
          Returns the Table.Cell determined by the given Table.Cell index position.
 Table.Cell<E> getCell(int rowIndexPosition, int columnIndexPosition)
          Resolves the Table.Cell for the given index positions.
 Table.Cell<E> getCell(int rowIndexPosition, Object columnTitleValue)
           
 Table.Cell<E> getCell(Object rowTitleValue, int columnIndexPosition)
           
 Table.Cell<E> getCell(String rowTitleValue, String columnTitleValue)
           
 E getCellElement(int cellIndexPosition)
          Returns the Table.CellImmutable.getElement() for the given Table.Cell index position
 Table.Column<E> getColumn(int columnIndexPosition)
          Returns a Table.Column for the given Table.Column index position.
 Table.Column<E> getColumn(Object columnTitleValue)
          Returns a Table.Column for the given Table.Column title value.
 Table.Row<E> getRow(int rowIndexPosition)
          Returns a new list that holds the object of the row pointed to.
 Table.Row<E> getRow(Object rowTitleValue)
          Returns a Table.Row of the Table identified by the title of a row.
protected  Object getStripeTitleValue(Table.Stripe.StripeType stripeType, int indexPosition)
          Returns the Table.Stripe.Title.getValue() object for the given index position within the respective TableContent#getStripeDataList(StripeType)
protected  List<Object> getStripeTitleValueList(Table.Stripe.StripeType stripeType)
          Returns the Table.Stripe.Title.getValue() elements within a List
protected  TableInternal<E> getTableInternal()
           
 Object getTableName()
          Returns the name for the whole table.
 Table.TableSize getTableSize()
          Returns a Table.TableSize object for the table.
 List<E> removeColumn(int columnIndexPosition)
          Removes a Table.Column at the given index position from the Table.
 List<E> removeRow(int rowIndexPosition)
          Removes a Table.Row at the given index position from the Table.
 TableSelectable.Selection<E> select()
          A TableSelectable.Selection offers methods to select a subset of Table.Rows and Table.Columns of a Table and provide the result as further Table or TableView
 Table<E> setCellElement(int cellIndexPosition, E element)
          Puts a new element to the table at the defined cell index position.
 Table<E> setCellElement(int rowIndexPosition, int columnIndexPosition, E element)
          Puts a new element to the table at the defined index positions.
 Table<E> setColumnTitleValue(Object titleValue, int columnIndexPosition)
          Sets the title of a column for a given column index position.
 Table<E> setRowTitleValue(Object titleValue, int rowIndexPosition)
          Sets the Table.Stripe.Title for a Table.Row with the given index position.
protected  void setStripeTitleValueList(List<? extends Object> titleValueList, Table.Stripe.StripeType stripeType)
          Sets the Table.Stripe.Title.setValue(Object) of the Rows or Columns
 Table<E> setTableName(Object tableName)
          Sets the name of the whole table.
 Table<E> transpose()
          Transposes the whole table, which means to swap rows and columns.
 
Methods inherited from class org.omnaest.utils.structure.table.concrete.TableBasic
as, cells, clone, columns, convert, copyFrom, equals, equals, getColumnTitleValue, getColumnTitleValueList, getRowTitleValue, getRowTitleValueList, hashCode, iterator, iteratorCell, iteratorColumn, processTableCells, putArray, putTable, rows, serializer, setColumnTitleValues, setColumnTitleValues, setRowTitleValues, setRowTitleValues, toString
 
Methods inherited from class org.omnaest.utils.structure.table.concrete.TableAbstract
contains, convertFirstColumnToTitle, convertFirstRowToTitle, ensureNumberOfColumns, ensureNumberOfRows, getCellElement, getCellElementList, getCellList, getColumnList, getFirstColumn, getFirstRow, getLastColumn, getLastRow, getRowList, hasColumnTitles, hasRowTitles, hasTableName, removeColumn, removeRow, removeRows, setColumnCellElements, setNumberOfColumns, setNumberOfRows, setRowCellElements, truncateRows
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tableInternal

protected TableInternal<E> tableInternal

tableContentResolver

protected TableInternal.TableContentResolver<E> tableContentResolver

tableName

protected Object tableName

stripeFactory

protected StripeFactory<E> stripeFactory

tableContent

protected TableInternal.TableContent<E> tableContent

cellAndStripeResolver

protected TableInternal.CellAndStripeResolver<E> cellAndStripeResolver
Constructor Detail

ArrayTable

public ArrayTable()
See Also:
ArrayTable

ArrayTable

public ArrayTable(E[][] elementArray)
Parameters:
elementArray -
See Also:
TableBasic.putArray(Object[][], int, int)
Method Detail

setRowTitleValue

public Table<E> setRowTitleValue(Object titleValue,
                                 int rowIndexPosition)
Description copied from interface: TableCore
Sets the Table.Stripe.Title for a Table.Row with the given index position.

Returns:
this
See Also:
TableCoreImmutable.getRowTitleValue(int)

setStripeTitleValueList

protected void setStripeTitleValueList(List<? extends Object> titleValueList,
                                       Table.Stripe.StripeType stripeType)
Description copied from class: TableBasic
Sets the Table.Stripe.Title.setValue(Object) of the Rows or Columns

Specified by:
setStripeTitleValueList in class TableBasic<E>

setColumnTitleValue

public Table<E> setColumnTitleValue(Object titleValue,
                                    int columnIndexPosition)
Description copied from interface: TableCore
Sets the title of a column for a given column index position.

Returns:
this

getStripeTitleValueList

protected List<Object> getStripeTitleValueList(Table.Stripe.StripeType stripeType)
Description copied from class: TableBasic
Returns the Table.Stripe.Title.getValue() elements within a List

Specified by:
getStripeTitleValueList in class TableBasic<E>
Returns:

getStripeTitleValue

protected Object getStripeTitleValue(Table.Stripe.StripeType stripeType,
                                     int indexPosition)
Description copied from class: TableBasic
Returns the Table.Stripe.Title.getValue() object for the given index position within the respective TableContent#getStripeDataList(StripeType)

Specified by:
getStripeTitleValue in class TableBasic<E>
Returns:

getTableSize

public Table.TableSize getTableSize()
Description copied from interface: TableCoreImmutable
Returns a Table.TableSize object for the table. The object will have always actual results, that will change if the data of the Table is changed.

Returns:

setCellElement

public Table<E> setCellElement(int rowIndexPosition,
                               int columnIndexPosition,
                               E element)
Description copied from interface: TableCore
Puts a new element to the table at the defined index positions.


getCell

public Table.Cell<E> getCell(int rowIndexPosition,
                             int columnIndexPosition)
Description copied from interface: TableCoreImmutable
Resolves the Table.Cell for the given index positions.

Returns:

addColumnCellElements

public Table.Column<E> addColumnCellElements(List<? extends E> columnCellElementList)
Description copied from interface: TableCore
Adds a Table.Column to the Table with the given Table.CellImmutable.getElement()s at the end of the Table.Columns.

Returns:
this

addColumnCellElements

public Table.Column<E> addColumnCellElements(int columnIndexPosition,
                                             List<? extends E> columnCellElementList)
Description copied from interface: TableCore
Adds a Table.Column to the Table with the given Table.CellImmutable.getElement()s at the given index position of the Table.Columns. Already existing Table.Columns at this index position will be moved one index position further. If the index position is above the size of the current Table.Columns, as many Table.Columns are created as necessary to make the Table.Column available at the given index position.

Returns:

addRowCellElements

public Table.Row<E> addRowCellElements(List<? extends E> rowCellElementList)
Description copied from interface: TableCore
Adds a new row to the table.
If the row has more elements, than the table has columns, the table will be expanded with new empty columns to match the row element number.

Returns:
this

addRowCellElements

public Table.Row<E> addRowCellElements(int rowIndexPosition,
                                       List<? extends E> rowCellElementList)
Description copied from interface: TableCore
Adds a new Table.Row to the Table at the given index position. If there is already a Table.Row or following Table.Rows for the given index position, they are moved one index position forward. If the index position is out of bounds as many Table.Rows are created to make it possible to access the Table.Row at the given index position.

Returns:
this

removeRow

public List<E> removeRow(int rowIndexPosition)
Description copied from interface: TableCore
Removes a Table.Row at the given index position from the Table.

Returns:
List of Table.CellImmutable.getElement() instances of the removed Table.Row

removeColumn

public List<E> removeColumn(int columnIndexPosition)
Description copied from interface: TableCore
Removes a Table.Column at the given index position from the Table.

Returns:
List of Table.CellImmutable.getElement() instances of the removed Table.Column

getRow

public Table.Row<E> getRow(int rowIndexPosition)
Description copied from interface: TableCoreImmutable
Returns a new list that holds the object of the row pointed to.

Returns:

getRow

public Table.Row<E> getRow(Object rowTitleValue)
Description copied from interface: TableCoreImmutable
Returns a Table.Row of the Table identified by the title of a row. Before this can be used, the titles have to be set by #setRowTitleValues(List)

Returns:
See Also:
TableCoreImmutable.getRow(int)

getColumn

public Table.Column<E> getColumn(int columnIndexPosition)
Description copied from interface: TableCoreImmutable
Returns a Table.Column for the given Table.Column index position.

Returns:
See Also:
TableCoreImmutable.getColumn(Object)

getColumn

public Table.Column<E> getColumn(Object columnTitleValue)
Description copied from interface: TableCoreImmutable
Returns a Table.Column for the given Table.Column title value. The Table.Column titles have to be set before with #setColumnTitleValues(List)

Returns:
See Also:
TableCoreImmutable.getColumn(int)

clear

public Table<E> clear()
Description copied from interface: TableCore
Clears the table, so that there are no elements left.
This removes all indexes set.

Returns:

getTableName

public Object getTableName()
Description copied from interface: TableCoreImmutable
Returns the name for the whole table.

Returns:

setTableName

public Table<E> setTableName(Object tableName)
Description copied from interface: TableCore
Sets the name of the whole table.

Returns:
this

getCell

public Table.Cell<E> getCell(int cellIndexPosition)
Description copied from interface: TableCoreImmutable
Returns the Table.Cell determined by the given Table.Cell index position. The Table.Cell index position starts with 0 and increases horizontally with each Table.Column and this through every single Table.Row down to the bottom of the Table. Returns null if the Table.Cell index position is out of Table bounds.

Returns:

setCellElement

public Table<E> setCellElement(int cellIndexPosition,
                               E element)
Description copied from interface: TableCore
Puts a new element to the table at the defined cell index position.


transpose

public Table<E> transpose()
Description copied from interface: TableCore
Transposes the whole table, which means to swap rows and columns.

Returns:
this

getCell

public Table.Cell<E> getCell(String rowTitleValue,
                             String columnTitleValue)
Returns:
See Also:
TableCoreImmutable.getCell(int, int)

getCell

public Table.Cell<E> getCell(Object rowTitleValue,
                             int columnIndexPosition)
Returns:
See Also:
TableCoreImmutable.getCell(int, int)

getCell

public Table.Cell<E> getCell(int rowIndexPosition,
                             Object columnTitleValue)
Returns:
See Also:
TableCoreImmutable.getCell(int, int)

getCellElement

public E getCellElement(int cellIndexPosition)
Description copied from interface: TableCoreImmutable
Returns the Table.CellImmutable.getElement() for the given Table.Cell index position

Returns:
See Also:
TableCoreImmutable.getCellElement(int, int), TableCoreImmutable.getCellElementList()

select

public TableSelectable.Selection<E> select()
Description copied from interface: TableSelectable
A TableSelectable.Selection offers methods to select a subset of Table.Rows and Table.Columns of a Table and provide the result as further Table or TableView

See Also:
TableSelectable.Selection, Table

getTableInternal

protected TableInternal<E> getTableInternal()


Copyright © 2011. All Rights Reserved.