uchicago.src.sim.analysis
Class HistogramItem

java.lang.Object
  extended by uchicago.src.sim.analysis.HistogramItem

public class HistogramItem
extends java.lang.Object

An item to be displayed in a histogram. A HistogramItem iterates over a 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 value the fall within this bin. This class is created through the Histogram or HistogramStatistic classes and under normal circumstance should not be created by a user.

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

Field Summary
protected  java.lang.String[] labels
           
protected  java.util.List list
           
protected  long lowerBound
           
protected  int numBins
           
protected  BinDataSource source
           
 
Constructor Summary
HistogramItem(java.util.List list, BinDataSource source, int numBins, long lowerBound)
          Constructs a HistogramItem whose bins are constructed from the specified list of objects, the specified BinDataSource, number of bins, and the specified lower bound.
HistogramItem(java.util.List list, BinDataSource source, int numBins, long lowerBound, int maxIntegerDigits, int maxFractionDigits)
          Constructs a HistogramItem whose bins are constructed from the specified list of objects, the specified BinDataSource, number of bins, and the specified lower bound.
HistogramItem(java.util.List list, java.lang.String methodName, int numBins, long lowerBound)
          Constructs a HistogramItem with the specified list of objects, the specified method to call on these objects, the specified number of bins, and the specified lower bound.
HistogramItem(java.util.List list, java.lang.String methodName, int numBins, long lowerBound, int maxIntegerDigits, int maxFractionDigits)
          Constructs a HistogramItem with the specified list of objects, the specified method to call on these objects, the specified number of bins, and the specified lower bound.
 
Method Summary
 java.lang.String[] getBinLabels()
          Gets the bin labels.
 java.util.Vector getBinValues()
          Gets a Vector of the bin values (ie how many items are in each bin).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected java.util.List list

numBins

protected int numBins

lowerBound

protected long lowerBound

labels

protected java.lang.String[] labels

source

protected BinDataSource source
Constructor Detail

HistogramItem

public HistogramItem(java.util.List list,
                     java.lang.String methodName,
                     int numBins,
                     long lowerBound)
Constructs a HistogramItem with the specified list of objects, the specified method to call on these objects, the specified number of bins, and the specified lower bound.

Parameters:
list - the list of objects on which to call the method
methodName - the name of the method to call on the objects
numBins - the number of bins in the histogram
lowerBound - the lower bound of the histogram

HistogramItem

public HistogramItem(java.util.List list,
                     java.lang.String methodName,
                     int numBins,
                     long lowerBound,
                     int maxIntegerDigits,
                     int maxFractionDigits)
Constructs a HistogramItem with the specified list of objects, the specified method to call on these objects, the specified number of bins, and the specified lower bound.

Parameters:
list - the list of objects on which to call the method
methodName - the name of the method to call on the objects
numBins - the number of bins in the histogram
lowerBound - the lower bound of the histogram
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.

HistogramItem

public HistogramItem(java.util.List list,
                     BinDataSource source,
                     int numBins,
                     long lowerBound)
Constructs a HistogramItem whose bins are constructed from the specified list of objects, the specified BinDataSource, number of bins, and the specified lower bound.

Parameters:
list - the list of objects on which to call the method
source - the BinDataSource that gets the bin values from the object in the list
numBins - the number of bins in the histogram
lowerBound - the lower bound of the histogram

HistogramItem

public HistogramItem(java.util.List list,
                     BinDataSource source,
                     int numBins,
                     long lowerBound,
                     int maxIntegerDigits,
                     int maxFractionDigits)
Constructs a HistogramItem whose bins are constructed from the specified list of objects, the specified BinDataSource, number of bins, and the specified lower bound.

Parameters:
list - the list of objects on which to call the method
source - the BinDataSource that gets the bin values from the object in the list
numBins - the number of bins in the histogram
lowerBound - the lower bound of the histogram
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.
Method Detail

getBinValues

public java.util.Vector getBinValues()
Gets a Vector of the bin values (ie how many items are in each bin).

Returns:
a Vector of the bin values.

getBinLabels

public java.lang.String[] getBinLabels()
Gets the bin labels. The bin labels are calculated each time getBinValues() is called.

Returns:
the bin labels
See Also:
getBinValues()