org.omegahat.Graphics.Plots.DataStructures
Class HistogramContents

java.lang.Object
  |
  +--org.omegahat.Graphics.Plots.DataStructures.HistogramContents
All Implemented Interfaces:
HistogramContentsInt, Subsettable

public class HistogramContents
extends java.lang.Object
implements HistogramContentsInt, Subsettable

a class is used to store the description of a histogram in terms of its bins and the maximum height of all bins.

The main data content of this class is typically an array of HistogramBin objects describing the individual bins. This information is computed from a batch of numeric data via the UnivariateSummary object. The information can then be used to form the standard Histogram object.


Constructor Summary
HistogramContents(double[] data)
           
HistogramContents(NumericVariableInt variable)
           
HistogramContents(UnivariateSummary summary)
           
 
Method Summary
 HistogramBin[] bins()
           
 HistogramBin[] bins(HistogramBin[] b)
           
 int computeBins(double[] data)
           
 int computeBins(double[] data, boolean sort)
           
 int computeBins(UnivariateSummary summary)
           
 UnivariateSummary createSummary(NumericVariableInt v)
          Creates the summary object from the variable.
 HistogramBinInt getBin(int which)
          Get the ith HistogramBinInt containing the range and height of that bin.
 long getNumObservations()
           
 double maxHeight()
          The maximum height of a bar in the coordinates of the y-axis for the histogram.
 double maxHeight(double max)
           
 int numBins()
          The number of bins in the histogram.
 long numObservations()
          Return the total number of data values that make up this point.
 long setNumObservations(long val)
           
 java.lang.Object subset(java.lang.Object indices, boolean keepStructure)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HistogramContents

public HistogramContents(double[] data)

HistogramContents

public HistogramContents(UnivariateSummary summary)

HistogramContents

public HistogramContents(NumericVariableInt variable)
Method Detail

getBin

public HistogramBinInt getBin(int which)
Description copied from interface: HistogramContentsInt
Get the ith HistogramBinInt containing the range and height of that bin.
Specified by:
getBin in interface HistogramContentsInt

createSummary

public UnivariateSummary createSummary(NumericVariableInt v)
Creates the summary object from the variable. This allows derived classes to override this mechanism and this class also allows users to create their own and pass the object as an argument to the constructor.

computeBins

public int computeBins(UnivariateSummary summary)

computeBins

public int computeBins(double[] data)

computeBins

public int computeBins(double[] data,
                       boolean sort)

maxHeight

public double maxHeight()
Description copied from interface: HistogramContentsInt
The maximum height of a bar in the coordinates of the y-axis for the histogram.
Specified by:
maxHeight in interface HistogramContentsInt

maxHeight

public double maxHeight(double max)

bins

public HistogramBin[] bins()

bins

public HistogramBin[] bins(HistogramBin[] b)

numBins

public int numBins()
Description copied from interface: HistogramContentsInt
The number of bins in the histogram.
Specified by:
numBins in interface HistogramContentsInt

numObservations

public long numObservations()
Description copied from interface: HistogramContentsInt
Return the total number of data values that make up this point.
Specified by:
numObservations in interface HistogramContentsInt

getNumObservations

public long getNumObservations()

setNumObservations

public long setNumObservations(long val)

subset

public java.lang.Object subset(java.lang.Object indices,
                               boolean keepStructure)
Specified by:
subset in interface Subsettable