SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Public Attributes | List of all members
CustomHistogramDataset Class Reference

A dataset that can be used for creating histograms. More...

Inheritance diagram for CustomHistogramDataset:
[legend]
Collaboration diagram for CustomHistogramDataset:
[legend]

Public Member Functions

 CustomHistogramDataset ()
 Creates a new (empty) dataset with a default type of HistogramType.FREQUENCY.
 
HistogramType getType ()
 Returns the histogram type.
 
void setType (HistogramType type)
 Sets the histogram type and sends a DatasetChangeEvent to all registered listeners. More...
 
void addSeries (Comparable key, double values[], int bins)
 Adds a series to the dataset, using the specified number of bins. More...
 
void addSeries (Comparable key, double values[], int numPoints, int bins)
 Adds a series to the dataset, using the specified number of bins. More...
 
void addSeries (Comparable key, double values[], int bins, double minimum, double maximum)
 Adds a series to the dataset. More...
 
void addSeries (Comparable key, double values[], int numPoints, int bins, double minimum, double maximum)
 Adds a series to the dataset. More...
 
void addSeries (Comparable key, double values[], HistogramBin bins[])
 Adds a series to the dataset. More...
 
void addSeries (Comparable key, double values[], int numPoints, HistogramBin bins[])
 Adds a series to the dataset. More...
 
List getBins (int series)
 Returns the bins for a series. More...
 
void setBins (int series, int bins)
 Sets the bins for a series. More...
 
void setBins (int series, int bins, double minimum, double maximum)
 Sets the bins for a series. More...
 
void setBins (int series, HistogramBin bins[])
 Sets the bins for a series. More...
 
List getValuesList (int series)
 Returns the values for a series. More...
 
double [] getValues (int series)
 Returns the values for a series. More...
 
void setValues (int series, List valuesList)
 Sets the values for a series. More...
 
void setValues (int series, double values[])
 Sets the values for a series. More...
 
int getTotal (int series)
 Returns the total number of observations for a series. More...
 
double getBinWidth (int series)
 Returns the bin width for a series. More...
 
int getSeriesCount ()
 Returns the number of series in the dataset. More...
 
Comparable getSeriesKey (int series)
 Returns the key for a series. More...
 
int getItemCount (int series)
 Returns the number of data items for a series. More...
 
Number getX (int series, int item)
 Returns the X value for a bin. More...
 
Number getY (int series, int item)
 Returns the y-value for a bin (calculated to take into account the histogram type). More...
 
Number getStartX (int series, int item)
 Returns the start value for a bin. More...
 
Number getEndX (int series, int item)
 Returns the end value for a bin. More...
 
Number getStartY (int series, int item)
 Returns the start y-value for a bin (which is the same as the y-value). More...
 
Number getEndY (int series, int item)
 Returns the end y-value for a bin (which is the same as the y-value). More...
 
boolean equals (Object obj)
 Tests this dataset for equality with an arbitrary object. More...
 
Object clone () throws CloneNotSupportedException
 Returns a clone of the dataset. More...
 

Public Attributes

HistogramType type
 The histogram type. More...
 

Detailed Description

A dataset that can be used for creating histograms.

This class is inspired from JFreeChart HistogramDataset class, and provides tools to customize histogram bins.

Member Function Documentation

◆ addSeries() [1/6]

void addSeries ( Comparable  key,
double  values[],
int  bins 
)

Adds a series to the dataset, using the specified number of bins.

Parameters
keythe series key (null not permitted).
valuesthe values (null not permitted).
binsthe number of bins (must be at least 1).

◆ addSeries() [2/6]

void addSeries ( Comparable  key,
double  values[],
int  numPoints,
int  bins 
)

Adds a series to the dataset, using the specified number of bins.

Parameters
keythe series key (null not permitted).
valuesthe values (null not permitted).
numPointsonly the first numPoints values are used.
binsthe number of bins (must be at least 1).

◆ addSeries() [3/6]

void addSeries ( Comparable  key,
double  values[],
int  bins,
double  minimum,
double  maximum 
)

Adds a series to the dataset.

Any data value less than minimum will be assigned to the first bin, and any data value greater than maximum will be assigned to the last bin. Values falling on the boundary of adjacent bins will be assigned to the higher indexed bin.

Parameters
keythe series key (null not permitted).
valuesthe raw observations.
binsthe number of bins (must be at least 1).
minimumthe lower bound of the bin range.
maximumthe upper bound of the bin range.

◆ addSeries() [4/6]

void addSeries ( Comparable  key,
double  values[],
int  numPoints,
int  bins,
double  minimum,
double  maximum 
)

Adds a series to the dataset.

Any data value less than minimum will be assigned to the first bin, and any data value greater than maximum will be assigned to the last bin. Values falling on the boundary of adjacent bins will be assigned to the higher indexed bin. Only the first numPoints values are used.

Parameters
keythe series key (null not permitted).
valuesthe raw observations.
numPointsonly the first numPoints values are used.
binsthe number of bins (must be at least 1).
minimumthe lower bound of the bin range.
maximumthe upper bound of the bin range.

◆ addSeries() [5/6]

void addSeries ( Comparable  key,
double  values[],
HistogramBin  bins[] 
)

Adds a series to the dataset.

Values falling on the boundary of adjacent bins will be assigned to the higher indexed bin.

Parameters
keythe series key (null not permitted).
valuesthe raw observations.
binsnew bins (size must be at least 1).

◆ addSeries() [6/6]

void addSeries ( Comparable  key,
double  values[],
int  numPoints,
HistogramBin  bins[] 
)

Adds a series to the dataset.

Values falling on the boundary of adjacent bins will be assigned to the higher indexed bin.

Parameters
keythe series key (null not permitted).
valuesthe raw observations.
numPointsonly the first numPoints values are used.
binsnew bins (size must be at least 1).

◆ clone()

Object clone ( ) throws CloneNotSupportedException

Returns a clone of the dataset.

Returns
A clone of the dataset.
Exceptions
CloneNotSupportedExceptionif the object cannot be cloned.

◆ equals()

boolean equals ( Object  obj)

Tests this dataset for equality with an arbitrary object.

Parameters
objthe object to test against (null permitted).
Returns
A boolean.

◆ getBins()

List getBins ( int  series)

Returns the bins for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
Returns
A list of bins.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getBinWidth()

double getBinWidth ( int  series)

Returns the bin width for a series.

Parameters
seriesthe series index (zero based).
Returns
The bin width.

◆ getEndX()

Number getEndX ( int  series,
int  item 
)

Returns the end value for a bin.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
itemthe item index (zero based).
Returns
The end value.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getEndY()

Number getEndY ( int  series,
int  item 
)

Returns the end y-value for a bin (which is the same as the y-value).

This method exists only to support the general form of the IntervalXYDataset} interface.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
itemthe item index (zero based).
Returns
The Y value.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getItemCount()

int getItemCount ( int  series)

Returns the number of data items for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
Returns
The item count.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getSeriesCount()

int getSeriesCount ( )

Returns the number of series in the dataset.

Returns
The series count.

◆ getSeriesKey()

Comparable getSeriesKey ( int  series)

Returns the key for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
Returns
The series key.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getStartX()

Number getStartX ( int  series,
int  item 
)

Returns the start value for a bin.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
itemthe item index (zero based).
Returns
The start value.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getStartY()

Number getStartY ( int  series,
int  item 
)

Returns the start y-value for a bin (which is the same as the y-value).

This method exists only to support the general form of the {IntervalXYDataset} interface.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
itemthe item index (zero based).
Returns
The y-value.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getTotal()

int getTotal ( int  series)

Returns the total number of observations for a series.

Parameters
seriesthe series index.
Returns
The total.

◆ getValues()

double [] getValues ( int  series)

Returns the values for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
Returns
A table of values.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getValuesList()

List getValuesList ( int  series)

Returns the values for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
Returns
A list of values.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getX()

Number getX ( int  series,
int  item 
)

Returns the X value for a bin.

This value won't be used for plotting histograms, since the renderer will ignore it. But other renderers can use it (for example, you could use the dataset to create a line chart).

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
itemthe item index (zero based).
Returns
The start value.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ getY()

Number getY ( int  series,
int  item 
)

Returns the y-value for a bin (calculated to take into account the histogram type).

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
itemthe item index (zero based).
Returns
The y-value.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ setBins() [1/3]

void setBins ( int  series,
int  bins 
)

Sets the bins for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
binsthe number of bins (must be at least 1).
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ setBins() [2/3]

void setBins ( int  series,
int  bins,
double  minimum,
double  maximum 
)

Sets the bins for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
binsthe number of bins (must be at least 1).
minimumthe lower bound of the bin range.
maximumthe upper bound of the bin range.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ setBins() [3/3]

void setBins ( int  series,
HistogramBin  bins[] 
)

Sets the bins for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
binsthe number of bins (must be at least 1).
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ setType()

void setType ( HistogramType  type)

Sets the histogram type and sends a DatasetChangeEvent to all registered listeners.

Parameters
typethe type (null not permitted).

◆ setValues() [1/2]

void setValues ( int  series,
List  valuesList 
)

Sets the values for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
valuesListList of new values.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

◆ setValues() [2/2]

void setValues ( int  series,
double  values[] 
)

Sets the values for a series.

Parameters
seriesthe series index (in the range 0 to getSeriesCount() - 1).
valuesTable of new values.
Exceptions
IndexOutOfBoundsExceptionif series is outside the specified range.

Member Data Documentation

◆ type

HistogramType type

The histogram type.


The documentation for this class was generated from the following file: