pl.edu.agh.cast.importer.base.data
Class TabularData

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<DataRow>
                  extended by pl.edu.agh.cast.importer.base.data.TabularData
All Implemented Interfaces:
Serializable, Cloneable, Iterable<DataRow>, Collection<DataRow>, Deque<DataRow>, List<DataRow>, Queue<DataRow>, ITabularData<DataRow>, IImportDataMonitorable

public class TabularData
extends LinkedList<DataRow>
implements IImportDataMonitorable, ITabularData<DataRow>

Class, which represents the data read from the source data file in a form of a table with already-analyzed records. It extends LinkedList of DataRows.

Author:
AGH CAST Team
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
TabularData()
          The default constructor.
 
Method Summary
 void clear()
          
 TabularData copyDataLeavingColumns(List<Integer> colIndices)
          Copies the current tabular data, leaving only the columns with the specified column indices.
 boolean equals(Object obj)
          
 IAnalyzer getColumnAnalyzer(int index)
          Returns IAnalyzer for column from input index.
 List<String> getColumnCaptions()
          Retrieves the captions of columns of the tabular data.
 int getColumnsCount()
          Retrieves the number of columns of the tabular data.
 List<Class<?>> getColumnTypes()
          Retrieves the column types of the tabular data columns.
 List<String> getFormatters()
          Retrieves the formatters of the tabular data columns.
 int getHeaderRowIdx()
           
 int getInputColumnForIndex(int index)
          Sets the input column reference for column with specified index.
 List<IImportDataObserver> getObservers()
          Retrieves the list of all registered observers.
 DataRow getRowByIndex(int rowIndex)
          Retrieves row with specified index.
 int hashCode()
          
 boolean isRedoAvailable()
          Checks whether the redo operation is available.
 boolean isUndoAvailable()
          Checks whether the undo operation is available.
 List<DataRow> redoOperation()
          Redoes row removal operation by removing again the rows that had previously been removed and restored with use of an undo operation.
 void registerObserver(IImportDataObserver observer)
          Registers a new observer.
 DataRow remove(int row)
          
 boolean remove(Object obj)
          
 DataRow removeFirst()
          
 void removeHeaderRow()
          Removes the data header row.
 DataRow removeLast()
          
 void removeRows(List<DataRow> rows)
          Delegate method with default ignored flag set to true.
 void removeRows(List<DataRow> rows, boolean ignored)
          Removes list of data rows and either saves them to an undo cache in order for an undo operation to be available (if the ignored flag is not set), or saves the rows to the ignored rows cache in order for them to be available if the ignored option is turned off.
 DataRow removeRowWithIndex(int rowIndex)
          Removes row with specified index.
 List<DataRow> restoreIgnoredRows(int rowCount)
          Restores a specified number of ignored data rows.
 TabularData retrieveDataPreview(int size)
          Retrieves tabular data preview of specified size (number of data rows to include in the preview).
 void setColumnCaptions(List<String> captions)
          Sets the column captions for the tabular data columns.
 void setColumns(List<TabularDataColumn> columns)
           
 void setFormatters(List<String> formatters)
          Sets the formatters for the tabular data columns.
 void setHeaderRowIdx(int rowIdx)
           
 List<DataRow> undoOperation()
          Undoes row removal operation by restoring the rows that were removed last.
 void unregisterObserver(IImportDataObserver observer)
          Unregisters an existing observer.
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, removeFirstOccurrence, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, retainAll, set, size, subList, toArray, toArray
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

TabularData

public TabularData()
The default constructor.

Method Detail

registerObserver

public void registerObserver(IImportDataObserver observer)
Registers a new observer. If the specified observer is already registered it is not added again.

Specified by:
registerObserver in interface IImportDataMonitorable
Parameters:
observer - the observer to register
See Also:
#registerObserver(pl.edu.agh.cast.importer.base.logging.IImportDataObserver)

unregisterObserver

public void unregisterObserver(IImportDataObserver observer)
Unregisters an existing observer. The method ignores unregistered observers.

Specified by:
unregisterObserver in interface IImportDataMonitorable
Parameters:
observer - the observer to unregister
See Also:
#unregisterObserver(pl.edu.agh.cast.importer.base.logging.IImportDataObserver)

getObservers

public List<IImportDataObserver> getObservers()
Retrieves the list of all registered observers.

Specified by:
getObservers in interface IImportDataMonitorable
Returns:
the registered observers
See Also:
IImportDataMonitorable.getObservers()

undoOperation

public List<DataRow> undoOperation()
Undoes row removal operation by restoring the rows that were removed last.

Returns:
data rows that had been restored

redoOperation

public List<DataRow> redoOperation()
Redoes row removal operation by removing again the rows that had previously been removed and restored with use of an undo operation.

Returns:
data rows that had been removed again

removeRows

public void removeRows(List<DataRow> rows,
                       boolean ignored)
Removes list of data rows and either saves them to an undo cache in order for an undo operation to be available (if the ignored flag is not set), or saves the rows to the ignored rows cache in order for them to be available if the ignored option is turned off.

Parameters:
rows - the rows to be removed
ignored - flag indicating whether the removed rows should be ignored (or deleted)

removeRows

public void removeRows(List<DataRow> rows)
Delegate method with default ignored flag set to true.

See Also:
removeRows(List, boolean)

restoreIgnoredRows

public List<DataRow> restoreIgnoredRows(int rowCount)
Restores a specified number of ignored data rows.

Parameters:
rowCount - the number of rows to restore
Returns:
list of restored rows

copyDataLeavingColumns

public TabularData copyDataLeavingColumns(List<Integer> colIndices)
Copies the current tabular data, leaving only the columns with the specified column indices.

Parameters:
colIndices - the indices of columns to leave in the copied tabular data
Returns:
tabular data copy with only the specified columns

retrieveDataPreview

public TabularData retrieveDataPreview(int size)
Retrieves tabular data preview of specified size (number of data rows to include in the preview).

Parameters:
size - the preview size
Returns:
tabular data preview

removeRowWithIndex

public DataRow removeRowWithIndex(int rowIndex)
Removes row with specified index.

Parameters:
rowIndex - the index of row to be removed
Returns:
the data row removed

getRowByIndex

public DataRow getRowByIndex(int rowIndex)
Retrieves row with specified index.

Parameters:
rowIndex - the index of row to be returned
Returns:
the data row with specified index

removeHeaderRow

public void removeHeaderRow()
Removes the data header row.


equals

public boolean equals(Object obj)

Specified by:
equals in interface Collection<DataRow>
Specified by:
equals in interface List<DataRow>
Overrides:
equals in class AbstractList<DataRow>
See Also:
AbstractList.equals(java.lang.Object)

hashCode

public int hashCode()

Specified by:
hashCode in interface Collection<DataRow>
Specified by:
hashCode in interface List<DataRow>
Overrides:
hashCode in class AbstractList<DataRow>
See Also:
AbstractList.hashCode()

remove

public DataRow remove(int row)

Specified by:
remove in interface List<DataRow>
Overrides:
remove in class LinkedList<DataRow>
See Also:
LinkedList.remove(int)

remove

public boolean remove(Object obj)

Specified by:
remove in interface Collection<DataRow>
Specified by:
remove in interface Deque<DataRow>
Specified by:
remove in interface List<DataRow>
Overrides:
remove in class LinkedList<DataRow>
See Also:
LinkedList.remove(java.lang.Object)

removeFirst

public DataRow removeFirst()

Specified by:
removeFirst in interface Deque<DataRow>
Overrides:
removeFirst in class LinkedList<DataRow>
See Also:
LinkedList.removeFirst()

removeLast

public DataRow removeLast()

Specified by:
removeLast in interface Deque<DataRow>
Overrides:
removeLast in class LinkedList<DataRow>
See Also:
LinkedList.removeLast()

clear

public void clear()

Specified by:
clear in interface Collection<DataRow>
Specified by:
clear in interface List<DataRow>
Overrides:
clear in class LinkedList<DataRow>
See Also:
LinkedList.clear()

getColumnsCount

public int getColumnsCount()
Retrieves the number of columns of the tabular data.

Specified by:
getColumnsCount in interface ITabularData<DataRow>
Returns:
the columns count
See Also:
ITabularData.getColumnsCount()

getColumnCaptions

public List<String> getColumnCaptions()
Retrieves the captions of columns of the tabular data.

Specified by:
getColumnCaptions in interface ITabularData<DataRow>
Returns:
the columns' captions
See Also:
ITabularData.getColumnCaptions()

getColumnTypes

public List<Class<?>> getColumnTypes()
Retrieves the column types of the tabular data columns.

Returns:
the column types

setFormatters

public void setFormatters(List<String> formatters)
Sets the formatters for the tabular data columns.

Parameters:
formatters - the column formatters

getFormatters

public List<String> getFormatters()
Retrieves the formatters of the tabular data columns.

Returns:
the column formatters

getColumnAnalyzer

public IAnalyzer getColumnAnalyzer(int index)
Returns IAnalyzer for column from input index.

Parameters:
index - column index
Returns:
analyzer

getInputColumnForIndex

public int getInputColumnForIndex(int index)
Sets the input column reference for column with specified index.

Parameters:
index - the column index
Returns:
the input column reference

setColumnCaptions

public void setColumnCaptions(List<String> captions)
Sets the column captions for the tabular data columns.

Parameters:
captions - the column captions

isUndoAvailable

public boolean isUndoAvailable()
Checks whether the undo operation is available.

Returns:
true if undo available, false otherwise

isRedoAvailable

public boolean isRedoAvailable()
Checks whether the redo operation is available.

Returns:
true if redo available, false otherwise

setColumns

public void setColumns(List<TabularDataColumn> columns)

setHeaderRowIdx

public void setHeaderRowIdx(int rowIdx)

getHeaderRowIdx

public int getHeaderRowIdx()


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