pl.edu.agh.cast.rawdata
Class TabularData

java.lang.Object
  extended by pl.edu.agh.cast.rawdata.logging.AbstractRawDataMonitorable
      extended by pl.edu.agh.cast.rawdata.TabularData
All Implemented Interfaces:
IRawDataMonitorable

public class TabularData
extends AbstractRawDataMonitorable

Contains list of rows. Rows don't need to have the same count of columns.

Author:
AGH CAST Team

Field Summary
protected  LinkedList<DataRow> rows
          List containing table rows.
 
Constructor Summary
TabularData()
          Default constructor.
 
Method Summary
 void addRow(DataRow newRow)
          Add a specified row to the end of table.
 void addRows(List<DataRow> newRows)
          Adds list of rows on the end of data table.
 DataRow get(int row)
          Gets row in table by row number.
 List<DataRow> getAllRows()
           
 Set<String> getAllRowValues(int columnIndex, int numberOfRowsToIgnore)
          Returns distinct values from all rows specified columns.
 int getColumnsCount()
          Returns column count.
 boolean isEmpty()
          Checks if table is empty.
 boolean removeRow(DataRow toDelete)
          Removes the specified row from table.
 void restoreAsFirst(DataRow row)
          Restores specified rows as first row in table.
 int size()
          Returns table rows count.
 
Methods inherited from class pl.edu.agh.cast.rawdata.logging.AbstractRawDataMonitorable
getObservers, registerObserver, unregisterObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rows

protected LinkedList<DataRow> rows
List containing table rows.

Constructor Detail

TabularData

public TabularData()
Default constructor.

Method Detail

addRow

public void addRow(DataRow newRow)
Add a specified row to the end of table.

Parameters:
newRow - row to add

restoreAsFirst

public void restoreAsFirst(DataRow row)
Restores specified rows as first row in table. Notifies attached monitors if row is successfully restored.

Parameters:
row - row to restore
Throws:
IllegalArgumentException - when specified row has unspecified row number

getAllRowValues

public Set<String> getAllRowValues(int columnIndex,
                                   int numberOfRowsToIgnore)
Returns distinct values from all rows specified columns.

Parameters:
columnIndex - column index
numberOfRowsToIgnore - number of rows to ignore
Returns:
set of distinct values

addRows

public void addRows(List<DataRow> newRows)
Adds list of rows on the end of data table.

Parameters:
newRows - rows to add

getAllRows

public List<DataRow> getAllRows()

removeRow

public boolean removeRow(DataRow toDelete)
Removes the specified row from table. Notifies attached monitors.

Parameters:
toDelete - row to delete
Returns:
true if row was successfully removed

getColumnsCount

public int getColumnsCount()
Returns column count.

Returns:
column count which is maximum size of all rows.

size

public int size()
Returns table rows count.

Returns:
table rows count

get

public DataRow get(int row)
Gets row in table by row number.

Parameters:
row - row number
Returns:
row

isEmpty

public boolean isEmpty()
Checks if table is empty.

Returns:
true if table is empty, false otherwise.


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.