uchicago.src.sim.analysis
Class OpenHistogramStat

java.lang.Object
  extended by uchicago.src.sim.analysis.OpenStats
      extended by uchicago.src.sim.analysis.OpenHistogramStat

public class OpenHistogramStat
extends OpenStats

The Statistics class for histogram data. Operates as the backend for a Histogram, manipulating the HistogramItems. Can be created without a Histogram class to generate histogram data without displaying such.

Version:
$Revision: 1.7 $ $Date: 2004/11/03 19:51:00 $
Author:
Nick Collier
See Also:
Histogram, HistogramItem

Field Summary
 
Fields inherited from class uchicago.src.sim.analysis.OpenStats
CSV, data, fileFormat, fileName, lastColUpdate, lastPrinted, model, title
 
Constructor Summary
OpenHistogramStat(int numBins, long lowerBound)
          Constructs a HistogramStatistic with the specified number of bins and the specified lower bound.
 
Method Summary
 void createHistogramItem(java.lang.String name, java.util.List list, BinDataSource source)
          Creates a HistogramItem with specified name, list and BinDataSource.
 void createHistogramItem(java.lang.String name, java.util.List list, BinDataSource source, int maxIntegerDigits, int maxFractionDigits)
          Creates a HistogramItem with specified name, list and BinDataSource.
 void createHistogramItem(java.lang.String name, java.util.List list, java.lang.String methodName)
          Creates a HistogramItem.
 void createHistogramItem(java.lang.String name, java.util.List list, java.lang.String methodName, int maxIntegerDigits, int maxFractionDigits)
          Creates a HistogramItem.
 void record()
          Calculates a new histogram over the data supplied by a HistogramItem
 void setPointLabels(java.lang.String[] labels)
          Sets the histogram labels (the x - axis legend).
 void writeToFile()
          Write the histogram data to a file.
 
Methods inherited from class uchicago.src.sim.analysis.OpenStats
getDataItem, getDataTable, getName, getNumRows, getPointLabels, getRow, getSeriesLabel, getSeriesName, renameFile, setSimModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenHistogramStat

public OpenHistogramStat(int numBins,
                         long lowerBound)
Constructs a HistogramStatistic with the specified number of bins and the specified lower bound.

Parameters:
numBins - the number of bins
lowerBound - the lower bound
Method Detail

createHistogramItem

public void createHistogramItem(java.lang.String name,
                                java.util.List list,
                                java.lang.String methodName)
Creates a HistogramItem. The HistogramItem iterates over the specified list calling the specified method on each object in the list. This method must return a value that can be cast into a double (i.e. float, int, double, short, etc.). These values are then distributed across the bins according to the number of bins, the lower bound, and the maximum value. For example, given 2 bins, a lower bound of 0 and a maximum value of 4. The first bin will contain all the values from 0 up to but not including 2, and the final bin will contain all the values from 2 up to and including 4. The displayed bin value (i.e. the height of the bar in the chart) is the number of values that fall within this bin.

Parameters:
name - the name of this item
list - the list of object on which the specified method is called
methodName - the name of the method to call on the objects. Should return a Number value.
See Also:
HistogramItem

createHistogramItem

public void createHistogramItem(java.lang.String name,
                                java.util.List list,
                                java.lang.String methodName,
                                int maxIntegerDigits,
                                int maxFractionDigits)
Creates a HistogramItem. The HistogramItem iterates over the specified list calling the specified method on each object in the list. This method must return a value that can be cast into a double (i.e. float, int, double, short, etc.). These values are then distributed across the bins according to the number of bins, the lower bound, and the maximum value. For example, given 2 bins, a lower bound of 0 and a maximum value of 4. The first bin will contain all the values from 0 up to but not including 2, and the final bin will contain all the values from 2 up to and including 4. The displayed bin value (i.e. the height of the bar in the chart) is the number of values that fall within this bin.

Parameters:
name - the name of this item
list - the list of object on which the specified method is called
methodName - the name of the method to call on the objects. Should return a Number value.
maxIntegerDigits - the maximum number of digits before the decimal point in the bin labels. A value of -1 will record all the digits.
maxFractionDigits - the maximum number of digits after the decimal point in the bin labels. A value of -1 will record all the digits.
See Also:
HistogramItem

createHistogramItem

public void createHistogramItem(java.lang.String name,
                                java.util.List list,
                                BinDataSource source)
Creates a HistogramItem with specified name, list and BinDataSource. The HistogramItem iterates over the specified list passing each Object in the list as argument to the getBinValue method of the BinDataSource. This getBinValue method returns a double. All these doubles are then distributed across the bins according to the number of bins, the lower bound, and the maximum value. For example, given 2 bins, a lower bound of 0 and a maximum value of 4. The first bin will contain all the values from 0 up to but not including 2, and the final bin will contain all the values from 2 up to and including 4. The displayed bin value (i.e. the height of the bar in the chart) is the number of values that fall within this bin.

Parameters:
name - the name of the item
list - the list of objects that provided the data for the item
source - the BinDataSource used to get the data from the objects in the list.

createHistogramItem

public void createHistogramItem(java.lang.String name,
                                java.util.List list,
                                BinDataSource source,
                                int maxIntegerDigits,
                                int maxFractionDigits)
Creates a HistogramItem with specified name, list and BinDataSource. The HistogramItem iterates over the specified list passing each Object in the list as argument to the getBinValue method of the BinDataSource. This getBinValue method returns a double. All these doubles are then distributed across the bins according to the number of bins, the lower bound, and the maximum value. For example, given 2 bins, a lower bound of 0 and a maximum value of 4. The first bin will contain all the values from 0 up to but not including 2, and the final bin will contain all the values from 2 up to and including 4. The displayed bin value (i.e. the height of the bar in the chart) is the number of values that fall within this bin.

Parameters:
name - the name of the item
list - the list of objects that provided the data for the item
source - the BinDataSource used to get the data from the objects in the list.
maxIntegerDigits - the maximum number of digits before the decimal point in the bin labels. A value of -1 will record all the digits.
maxFractionDigits - the maximum number of digits after the decimal point in the bin labels. A value of -1 will record all the digits.

record

public void record()
Calculates a new histogram over the data supplied by a HistogramItem

Specified by:
record in class OpenStats

setPointLabels

public void setPointLabels(java.lang.String[] labels)
Sets the histogram labels (the x - axis legend).


writeToFile

public void writeToFile()
Write the histogram data to a file. This method is not yet implemented.

Specified by:
writeToFile in class OpenStats