edu.brook.ascape.util
Class DataGroup

java.lang.Object
  |
  +--java.util.Observable
        |
        +--edu.brook.ascape.util.DataGroup

public class DataGroup
extends java.util.Observable
implements java.io.Serializable

A group of data points and their cooresponding series (pl) of measurements.

Since:
1.0
Version:
1.0.2
See Also:
Serialized Form

Field Summary
protected  DataSeries[] dataSeries
          The data series (pl) that record a measure for a statistic for every iteration.
protected  java.util.Vector periods
          A vector of Doubles for each iteration; typically a series {s, s + 1, s + 2 ...
protected  Scape scape
          The scape that this data group belongs to.
protected  StatCollector[] stats
          The stats that make up the data group.
 
Constructor Summary
DataGroup()
           
 
Method Summary
 void add(StatCollector[] addStatCollectors)
          Adds the supplied stats to this group, creating all appropriate data series for them.
 void clear()
          Clears all data for the group.
 int getIndexOfSeries(DataSeries series)
          Returns the internal index of the series.
 int getIndexOfSeries(java.lang.String name)
          Returns the internal index of the series from the series name.
protected  int getIndexOfStatCollector(java.lang.String name)
          Returns the internal index of the stat from the stat name.
 java.util.Vector getPeriods()
          Returns a vector of periods for which statistics have been collected.
 Scape getScape()
          Returns the scape that this data group is primarily related to.
 DataSeries getSeries(int index)
          Returns the series at the provided index.
 DataSeries getSeries(java.lang.String name)
          Returns the series with the provided name.
 java.lang.String[] getSeriesNames()
          Returns the names of every data series in this group.
 int getSize()
          Returns the total number of data series that comprise this group.
 StatCollector getStatCollector(int index)
          Returns the stat at the provided index.
 StatCollector getStatCollector(java.lang.String name)
          Returns the stat with the provided name.
 java.lang.String[] getStatCollectorNames()
          Returns the names of every statistic in this group.
 StatCollector[] getStatCollectors()
          Return the stats that comprise this group of data.
 void setScape(Scape scape)
          Sets the scape that this data group is primarily related to.
 void update()
          Called when all data has been collected for a data group for a given period.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scape

protected Scape scape
The scape that this data group belongs to. May be null; only used to track collection periods, so this class can be used outside of ascape engine.

stats

protected StatCollector[] stats
The stats that make up the data group.

periods

protected java.util.Vector periods
A vector of Doubles for each iteration; typically a series {s, s + 1, s + 2 ... s + n}, where s is the start period, and s + n is the current period.

dataSeries

protected DataSeries[] dataSeries
The data series (pl) that record a measure for a statistic for every iteration.
Constructor Detail

DataGroup

public DataGroup()
Method Detail

add

public void add(StatCollector[] addStatCollectors)
Adds the supplied stats to this group, creating all appropriate data series for them. The order and index of existing value stats and data series will be retained.
Parameters:
addStatCollectors - the value stat to add to this group

getStatCollectors

public StatCollector[] getStatCollectors()
Return the stats that comprise this group of data.

update

public void update()
Called when all data has been collected for a data group for a given period. If scape not null, adds an element to periods for current scape period. Updates data series statistics.

clear

public void clear()
Clears all data for the group. Called when it is time to collect a new set of data. Creates a new blank periods, and clears all data series data and statistics.

setScape

public void setScape(Scape scape)
Sets the scape that this data group is primarily related to.
Parameters:
scape - the scape this agent is belongs to

getScape

public Scape getScape()
Returns the scape that this data group is primarily related to.

getPeriods

public java.util.Vector getPeriods()
Returns a vector of periods for which statistics have been collected.

getSize

public int getSize()
Returns the total number of data series that comprise this group.

getIndexOfSeries

public int getIndexOfSeries(java.lang.String name)
Returns the internal index of the series from the series name.
Parameters:
name - the name of the series to get the index for
Returns:
the index in this group, -1 if not in this group

getIndexOfSeries

public int getIndexOfSeries(DataSeries series)
Returns the internal index of the series.
Parameters:
series - the series to get the index for, -1 if not in this group
Returns:
the index in this group, -1 if not in this group

getSeries

public DataSeries getSeries(int index)
Returns the series at the provided index.

getSeries

public DataSeries getSeries(java.lang.String name)
Returns the series with the provided name.
Throws:
ArrayIndexOutOfBounds - if the named stat doesn't exist

getSeriesNames

public java.lang.String[] getSeriesNames()
Returns the names of every data series in this group.

getIndexOfStatCollector

protected int getIndexOfStatCollector(java.lang.String name)
Returns the internal index of the stat from the stat name.

getStatCollector

public StatCollector getStatCollector(int index)
Returns the stat at the provided index.

getStatCollector

public StatCollector getStatCollector(java.lang.String name)
Returns the stat with the provided name.
Throws:
ArrayIndexOutOfBounds - if the named stat doesn't exist

getStatCollectorNames

public java.lang.String[] getStatCollectorNames()
Returns the names of every statistic in this group.

(c) 1998-2000 The Brookings Insitution
Webpage