com.jrefinery.data
Class DefaultStatisticalCategoryDataset

java.lang.Object
  |
  +--com.jrefinery.data.AbstractDataset
        |
        +--com.jrefinery.data.AbstractSeriesDataset
              |
              +--com.jrefinery.data.DefaultStatisticalCategoryDataset
All Implemented Interfaces:
CategoryDataset, Dataset, SeriesChangeListener, SeriesDataset, StatisticalCategoryDataset

public class DefaultStatisticalCategoryDataset
extends AbstractSeriesDataset
implements StatisticalCategoryDataset

A convenience class that provides a default implementation of the StatisticalCategoryDataset interface.

The standard constructor accepts data in a two dimensional array where the first dimension is the series, and the second dimension is the category.

Author:
PC

Constructor Summary
DefaultStatisticalCategoryDataset(double[][] mean, double[][] stdDev)
          Creates a new dataset.
DefaultStatisticalCategoryDataset(java.lang.Number[][] mean, java.lang.Number[][] stdDev)
          Constructs a dataset and populates it with data from the array.
DefaultStatisticalCategoryDataset(java.lang.String[] seriesNames, java.lang.Number[][] mean, java.lang.Number[][] stdDev)
          Constructs a DefaultStatisticalCategoryDataset, populates it with data from the arrays, and uses the supplied names for the series.
DefaultStatisticalCategoryDataset(java.lang.String[] seriesNames, java.lang.Object[] categories, java.lang.Number[][] mean, java.lang.Number[][] stdDev)
          Constructs a DefaultStatisticalCategoryDataset, populates it with data from the arrays, and uses the supplied names for the series and the supplied objects for the categories.
 
Method Summary
 java.util.List getCategories()
          Returns a list of the categories in the dataset.
 int getCategoryCount()
          Returns the number of categories in the dataset.
 java.lang.Number getMeanValue(int series, java.lang.Object category)
          Returns the mean data value for one category in a series.
 int getSeriesCount()
          Returns the number of series in the dataset (possibly zero).
 java.lang.String getSeriesName(int series)
          Returns the name of the specified series.
 java.lang.Number getStdDevValue(int series, java.lang.Object category)
          Returns the standard deviation data value for one category in a series.
 java.lang.Number getValue(int series, java.lang.Object category)
          Returns the data value for one category in a series.
 void setCategories(java.lang.Object[] categories)
          Sets the categories for the dataset.
 void setMeanValue(int series, java.lang.Object category, java.lang.Number value)
          Sets the mean data value for one category in a series.
 void setMeanValue(java.lang.Number[][] value)
          Sets the mean data values.
 void setSeriesNames(java.lang.String[] seriesNames)
          Sets the names of the series in the dataset.
 void setStdDevValue(int series, java.lang.Object category, java.lang.Number value)
          Sets the standard deviation data value for one category in a series.
 void setStdDevValue(java.lang.Number[][] value)
          Sets the standard deviation values.
 
Methods inherited from class com.jrefinery.data.AbstractSeriesDataset
getLegendItemCount, getLegendItemLabels, seriesChanged
 
Methods inherited from class com.jrefinery.data.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

DefaultStatisticalCategoryDataset

public DefaultStatisticalCategoryDataset(double[][] mean,
                                         double[][] stdDev)
Creates a new dataset.
Parameters:
mean - the mean value data.
stdDev - the standard deviation value data.

DefaultStatisticalCategoryDataset

public DefaultStatisticalCategoryDataset(java.lang.Number[][] mean,
                                         java.lang.Number[][] stdDev)
Constructs a dataset and populates it with data from the array.

The arrays are indexed as data[series][category]. Series and category names are automatically generated - you can change them using the setSeriesName(...) and setCategory(...) methods.

Parameters:
mean - the mean value data
stdDev - the standard deviation value data

DefaultStatisticalCategoryDataset

public DefaultStatisticalCategoryDataset(java.lang.String[] seriesNames,
                                         java.lang.Number[][] mean,
                                         java.lang.Number[][] stdDev)
Constructs a DefaultStatisticalCategoryDataset, populates it with data from the arrays, and uses the supplied names for the series.

Category names are generated automatically ("Category 1", "Category 2", etc).

Parameters:
seriesNames - the series names.
mean - the mean values data, indexed as data[series][category].
stdDev - the stdDev values data, indexed as data[series][category].

DefaultStatisticalCategoryDataset

public DefaultStatisticalCategoryDataset(java.lang.String[] seriesNames,
                                         java.lang.Object[] categories,
                                         java.lang.Number[][] mean,
                                         java.lang.Number[][] stdDev)
Constructs a DefaultStatisticalCategoryDataset, populates it with data from the arrays, and uses the supplied names for the series and the supplied objects for the categories.
Parameters:
seriesNames - the series names.
categories - the categories.
mean - the mean values data, indexed as data[series][category].
stdDev - the stdDev values data, indexed as data[series][category].
Method Detail

getSeriesCount

public int getSeriesCount()
Returns the number of series in the dataset (possibly zero).
Specified by:
getSeriesCount in interface SeriesDataset
Overrides:
getSeriesCount in class AbstractSeriesDataset
Returns:
the number of series in the dataset.

getSeriesName

public java.lang.String getSeriesName(int series)
Returns the name of the specified series.
Specified by:
getSeriesName in interface SeriesDataset
Overrides:
getSeriesName in class AbstractSeriesDataset
Parameters:
series - the index of the required series (zero-based).
Returns:
the series name

setSeriesNames

public void setSeriesNames(java.lang.String[] seriesNames)
Sets the names of the series in the dataset.
Parameters:
seriesNames - The names of the series in the dataset.

getCategoryCount

public int getCategoryCount()
Returns the number of categories in the dataset.

This method is part of the CategoryDataset interface.

Specified by:
getCategoryCount in interface CategoryDataset
Returns:
The number of categories in the dataset.

getCategories

public java.util.List getCategories()
Returns a list of the categories in the dataset.

Supports the CategoryDataset interface.

Specified by:
getCategories in interface CategoryDataset
Returns:
A list of the categories in the dataset.

setCategories

public void setCategories(java.lang.Object[] categories)
Sets the categories for the dataset.
Parameters:
categories - An array of objects representing the categories in the dataset.

getValue

public java.lang.Number getValue(int series,
                                 java.lang.Object category)
Returns the data value for one category in a series.

This method is part of the CategoryDataset interface. Not particularly meaningful for this class...but it is used in the DatasetUtilities when computing the range extent so we should be careful to return a value large enough so that the mean+stdDev value will always be plotted properly.

Specified by:
getValue in interface CategoryDataset
Parameters:
series - the required series (zero based index).
category - the required category.
Returns:
the data value for one category in a series (null possible).

getMeanValue

public java.lang.Number getMeanValue(int series,
                                     java.lang.Object category)
Returns the mean data value for one category in a series.

This method is part of the StatisticalCategoryDataset interface.

Specified by:
getMeanValue in interface StatisticalCategoryDataset
Parameters:
series - The required series (zero based index).
category - The required category.
Returns:
The mean data value for one category in a series (null possible).

getStdDevValue

public java.lang.Number getStdDevValue(int series,
                                       java.lang.Object category)
Returns the standard deviation data value for one category in a series.

This method is part of the IntervalCategoryDataset interface.

Specified by:
getStdDevValue in interface StatisticalCategoryDataset
Parameters:
series - The required series (zero based index).
category - The required category.
Returns:
The standard deviation data value for one category in a series (null possible).

setMeanValue

public void setMeanValue(int series,
                         java.lang.Object category,
                         java.lang.Number value)
Sets the mean data value for one category in a series.
Parameters:
series - The series (zero-based index).
category - The category.
value - The value.

setMeanValue

public void setMeanValue(java.lang.Number[][] value)
Sets the mean data values.
Parameters:
value - the data.

setStdDevValue

public void setStdDevValue(int series,
                           java.lang.Object category,
                           java.lang.Number value)
Sets the standard deviation data value for one category in a series.
Parameters:
series - The series (zero-based index).
category - The category.
value - The value.

setStdDevValue

public void setStdDevValue(java.lang.Number[][] value)
Sets the standard deviation values.
Parameters:
value - the values.