RePast
v. 2.0

uchicago.src.sim.analysis
Class Statistics

java.lang.Object
  |
  +--jclass.chart.ChartDataSupport
        |
        +--uchicago.src.sim.analysis.Statistics
All Implemented Interfaces:
jclass.chart.Chartable, jclass.chart.ChartData, Graphable, Serializable
Direct Known Subclasses:
HistogramStatistic, SequenceStatistic

public abstract class Statistics
extends jclass.chart.ChartDataSupport
implements Graphable

Statistics: base class for the statistics classes that form the model (MVC) for SimGraphs.

See Also:
Serialized Form

Field Summary
static int CSV
           
protected  ArrayData data
           
protected  int fileFormat
           
protected  String fileName
           
protected  int lastColUpdate
           
protected  long lastPrinted
           
protected  SimModel model
           
protected  String title
           
 
Fields inherited from interface jclass.chart.Chartable
ARRAY, GENERAL
 
Constructor Summary
Statistics(SimModel model)
          Construct a Statistics class with the specified model
Statistics(String fileName, int fileFormat, String title, SimModel model)
          Constructs a Statistic with the specified title, file name, and file format, and model.
 
Method Summary
 void addChartAsListener(SimGraph chart)
          Adds the specified graph as a listener to this data
 int getDataInterpretation()
           
 Object getDataItem(int row, int col)
           
 Vector getDataTable()
           
 String getName()
           
 int getNumRows()
           
 String[] getPointLabels()
           
 Vector getRow(int row)
           
 String getSeriesLabel(int parm1)
           
 String getSeriesName(int parm1)
           
abstract  void record()
          Calculates the next item in the sequence
protected  void renameFile()
           
 void setSimModel(SimModel model)
          Sets the simulation model.
abstract  void step()
          Calculates the next item in the sequence and tells the chart to update itself.
protected  void updateGraph()
          Updates the graph
abstract  void writeToFile()
          Writes the data stored by this call to a file specified in the constructor.
 
Methods inherited from class jclass.chart.ChartDataSupport
addChartDataListener, fireChartDataEvent, fireChartDataEvent, removeChartDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSV

public static final int CSV
See Also:
Constant Field Values

data

protected ArrayData data

fileName

protected String fileName

fileFormat

protected int fileFormat

lastPrinted

protected long lastPrinted

title

protected String title

model

protected SimModel model

lastColUpdate

protected int lastColUpdate
Constructor Detail

Statistics

public Statistics(SimModel model)
Construct a Statistics class with the specified model


Statistics

public Statistics(String fileName,
                  int fileFormat,
                  String title,
                  SimModel model)
Constructs a Statistic with the specified title, file name, and file format, and model.

Parameters:
fileName - the name of the file to write the sequence data to
fileFormat - the format of the file - i.e. Statistics.CSV
title - the title
model - the model
Method Detail

step

public abstract void step()
Calculates the next item in the sequence and tells the chart to update itself.


updateGraph

protected void updateGraph()
Updates the graph


record

public abstract void record()
Calculates the next item in the sequence


getDataTable

public Vector getDataTable()

addChartAsListener

public void addChartAsListener(SimGraph chart)
Adds the specified graph as a listener to this data

Specified by:
addChartAsListener in interface Graphable
Parameters:
chart - the listening graph

renameFile

protected void renameFile()
                   throws IOException
IOException

writeToFile

public abstract void writeToFile()
Writes the data stored by this call to a file specified in the constructor.


setSimModel

public void setSimModel(SimModel model)
Sets the simulation model.


getDataInterpretation

public int getDataInterpretation()
Specified by:
getDataInterpretation in interface jclass.chart.Chartable

getDataItem

public Object getDataItem(int row,
                          int col)
Specified by:
getDataItem in interface jclass.chart.Chartable

getName

public String getName()
Specified by:
getName in interface jclass.chart.Chartable

getNumRows

public int getNumRows()
Specified by:
getNumRows in interface jclass.chart.Chartable

getPointLabels

public String[] getPointLabels()
Specified by:
getPointLabels in interface jclass.chart.Chartable

getRow

public Vector getRow(int row)
Specified by:
getRow in interface jclass.chart.Chartable

getSeriesLabel

public String getSeriesLabel(int parm1)
Specified by:
getSeriesLabel in interface jclass.chart.Chartable

getSeriesName

public String getSeriesName(int parm1)
Specified by:
getSeriesName in interface jclass.chart.Chartable

RePast
v. 2.0

Bug reports and feature requests to RePast