Holger's
Java API

com.antelmann.math
Class TimeDataGrid<T>

java.lang.Object
  extended by com.antelmann.math.TimeDataGrid<T>
Type Parameters:
T - the type of Objects that are processed by this grid
All Implemented Interfaces:
Cloneable

public class TimeDataGrid<T>
extends Object
implements Cloneable

provides aggregated data based on a TimeDataParser

Since:
07/04/08
Author:
Holger Antelmann
See Also:
TimeDataParser, TimeDataGraphics

Constructor Summary
TimeDataGrid()
           
TimeDataGrid(DataMatrix<T> matrix, int timeAxis, int groupAxis)
           
TimeDataGrid(TimeDataParser<? super T> parser)
           
TimeDataGrid(TimeDataParser<? super T> parser, Filter<? super T> filter)
           
 
Method Summary
 void addData(Enumeration<? extends T> e)
          loads the data by parsing the given Enumeration and extracting the relevant values through the parser
 void addData(Enumeration<? extends T> e, Monitor mon)
          min and max from the given Monitor remain untouched; a disabled Monitor will lead to CancellationWarning
 void addPoint(Date date, Object group, Number n)
           
 void addPropertyChangeListener(PropertyChangeListener listener)
          allows to be notified when new data is loaded or cleared; the property key on the event is 'data'
 HashMap<Object,Map<Date,BigDecimal>> aggregateTopMaps(int maxGroups, DataPoint.ValueType type, Object remainderKey)
           
 TableModel asTableModel(String dateHeader, DataPoint.ValueType type)
          generates a TableModel based on the data of this grid; if new data is loaded or the grid is cleared, the model will fire a table structure changed event to its listeners.
 TableModel asTableModel(String dateHeader, DataPoint.ValueType type, int maxGroups, String remainderColumn)
          generates a TableModel that is based on an aggregated data structure from this grid; otherwise it works just as the non-aggregated TableModel
 void clearData()
           
 Object clone()
           
 Vector<TimeDataGrid<? super T>> getAdditionalGrids()
          access to a list where other grids can be added, so that one Enumeration can run through multiple grids
 DataPoint getDataPoint(Date date, Object group)
           
 SortedSet<Date> getDates()
          provides an unmodifiable view of the data
 HashMap<Date,DataPoint> getDatesSum()
          generates a new data structure holding the data present at the time of calling
 Filter<? super T> getFilter()
           
 Map<Date,DataPoint> getGroupData(Object group)
          provides an unmodifiable view of the data
 Set<Object> getGroups()
          provides an unmodifiable view of the data
 HashMap<Object,DataPoint> getGroupSums()
          generates a new data structure holding the data present at the time of calling
 TimeDataParser<? super T> getParser()
           
 PropertyChangeListener[] getPropertyChangeListeners()
           
 DataPoint getSum(Date date)
           
 DataPoint getSum(Object groupCriteria)
           
 DataPoint getTopGroupsSum(int maxEntries)
           
 HashMap<Object,Double> getTopGroupSums(int maxEntries, DataPoint.ValueType type, Object remainderKey)
           
 DataPoint getTotalSum()
           
protected  void processElement(T entry)
          data is processed here by summing up the relevant number for each date/group pair
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void setFilter(Filter<? super T> filter)
           
 void setParser(TimeDataParser<? super T> parser)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeDataGrid

public TimeDataGrid()

TimeDataGrid

public TimeDataGrid(TimeDataParser<? super T> parser)

TimeDataGrid

public TimeDataGrid(TimeDataParser<? super T> parser,
                    Filter<? super T> filter)

TimeDataGrid

public TimeDataGrid(DataMatrix<T> matrix,
                    int timeAxis,
                    int groupAxis)
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
allows to be notified when new data is loaded or cleared; the property key on the event is 'data'


removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners()

getParser

public TimeDataParser<? super T> getParser()

setParser

public void setParser(TimeDataParser<? super T> parser)

getFilter

public Filter<? super T> getFilter()

setFilter

public void setFilter(Filter<? super T> filter)

getAdditionalGrids

public Vector<TimeDataGrid<? super T>> getAdditionalGrids()
access to a list where other grids can be added, so that one Enumeration can run through multiple grids


clearData

public void clearData()

addData

public void addData(Enumeration<? extends T> e)
loads the data by parsing the given Enumeration and extracting the relevant values through the parser


addData

public void addData(Enumeration<? extends T> e,
                    Monitor mon)
             throws CancellationWarning
min and max from the given Monitor remain untouched; a disabled Monitor will lead to CancellationWarning

Throws:
CancellationWarning

processElement

protected void processElement(T entry)
data is processed here by summing up the relevant number for each date/group pair


addPoint

public void addPoint(Date date,
                     Object group,
                     Number n)

getDates

public SortedSet<Date> getDates()
provides an unmodifiable view of the data


getGroups

public Set<Object> getGroups()
provides an unmodifiable view of the data


getGroupData

public Map<Date,DataPoint> getGroupData(Object group)
provides an unmodifiable view of the data


getGroupSums

public HashMap<Object,DataPoint> getGroupSums()
generates a new data structure holding the data present at the time of calling


getDatesSum

public HashMap<Date,DataPoint> getDatesSum()
generates a new data structure holding the data present at the time of calling


getDataPoint

public DataPoint getDataPoint(Date date,
                              Object group)

getTotalSum

public DataPoint getTotalSum()

getSum

public DataPoint getSum(Date date)

getSum

public DataPoint getSum(Object groupCriteria)

getTopGroupsSum

public DataPoint getTopGroupsSum(int maxEntries)

getTopGroupSums

public HashMap<Object,Double> getTopGroupSums(int maxEntries,
                                              DataPoint.ValueType type,
                                              Object remainderKey)

aggregateTopMaps

public HashMap<Object,Map<Date,BigDecimal>> aggregateTopMaps(int maxGroups,
                                                             DataPoint.ValueType type,
                                                             Object remainderKey)

asTableModel

public TableModel asTableModel(String dateHeader,
                               DataPoint.ValueType type)
generates a TableModel based on the data of this grid; if new data is loaded or the grid is cleared, the model will fire a table structure changed event to its listeners. The groups serve as column headings while the first column displays the date (using the given String for the dateHeader). Then there is a row for each date while the other columns for each row are filled with the given value from the associated DataPoint.


asTableModel

public TableModel asTableModel(String dateHeader,
                               DataPoint.ValueType type,
                               int maxGroups,
                               String remainderColumn)
generates a TableModel that is based on an aggregated data structure from this grid; otherwise it works just as the non-aggregated TableModel

See Also:
asTableModel(String, com.antelmann.math.DataPoint.ValueType)


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads