com.jrefinery.data
Class DefaultIntervalCategoryDataset

java.lang.Object
  extended by com.jrefinery.data.AbstractDataset
      extended by com.jrefinery.data.AbstractSeriesDataset
          extended by com.jrefinery.data.DefaultIntervalCategoryDataset
All Implemented Interfaces:
CategoryDataset, Dataset, IntervalCategoryDataset, SeriesChangeListener, SeriesDataset

public class DefaultIntervalCategoryDataset
extends AbstractSeriesDataset
implements IntervalCategoryDataset

A convenience class that provides a default implementation of the IntervalCategoryDataset 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.


Field Summary
protected  java.lang.Object[] categories
          The categories.
protected  java.lang.Number[][] endData
          Storage for the end value data.
protected  java.lang.String[] seriesNames
          The series names.
protected  java.lang.Number[][] startData
          Storage for the start value data.
 
Fields inherited from class com.jrefinery.data.AbstractDataset
listeners
 
Constructor Summary
DefaultIntervalCategoryDataset(double[][] starts, double[][] ends)
           
DefaultIntervalCategoryDataset(java.lang.Number[][] starts, java.lang.Number[][] ends)
          Constructs a dataset and populates it with data from the array.
DefaultIntervalCategoryDataset(java.lang.String[] seriesNames, java.lang.Number[][] starts, java.lang.Number[][] ends)
          Constructs a DefaultIntervalCategoryDataset, populates it with data from the arrays, and uses the supplied names for the series.
DefaultIntervalCategoryDataset(java.lang.String[] seriesNames, java.lang.Object[] categories, java.lang.Number[][] starts, java.lang.Number[][] ends)
          Constructs a DefaultIntervalCategoryDataset, 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 getEndValue(int series, java.lang.Object category)
          Returns the end 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 getStartValue(int series, java.lang.Object category)
          Returns the start 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 setEndValue(int series, java.lang.Object category, java.lang.Number value)
          Sets the end data value for one category in a series.
 void setSeriesNames(java.lang.String[] seriesNames)
          Sets the names of the series in the dataset.
 void setStartValue(int series, java.lang.Object category, java.lang.Number value)
          Sets the start data value for one category in a series.
 
Methods inherited from class com.jrefinery.data.AbstractSeriesDataset
getLegendItemCount, getLegendItemLabels, seriesChanged
 
Methods inherited from class com.jrefinery.data.AbstractDataset
addChangeListener, fireDatasetChanged, notifyListeners, removeChangeListener
 
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, removeChangeListener
 

Field Detail

seriesNames

protected java.lang.String[] seriesNames
The series names.


categories

protected java.lang.Object[] categories
The categories.


startData

protected java.lang.Number[][] startData
Storage for the start value data.


endData

protected java.lang.Number[][] endData
Storage for the end value data.

Constructor Detail

DefaultIntervalCategoryDataset

public DefaultIntervalCategoryDataset(double[][] starts,
                                      double[][] ends)

DefaultIntervalCategoryDataset

public DefaultIntervalCategoryDataset(java.lang.Number[][] starts,
                                      java.lang.Number[][] ends)
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:
starts - The start values data.
ends - The end values data.

DefaultIntervalCategoryDataset

public DefaultIntervalCategoryDataset(java.lang.String[] seriesNames,
                                      java.lang.Number[][] starts,
                                      java.lang.Number[][] ends)
Constructs a DefaultIntervalCategoryDataset, 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.
starts - The start values data, indexed as data[series][category].
ends - The end values data, indexed as data[series][category].

DefaultIntervalCategoryDataset

public DefaultIntervalCategoryDataset(java.lang.String[] seriesNames,
                                      java.lang.Object[] categories,
                                      java.lang.Number[][] starts,
                                      java.lang.Number[][] ends)
Constructs a DefaultIntervalCategoryDataset, 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.
starts - The start values data, indexed as data[series][category].
ends - The end 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
Specified by:
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
Specified by:
getSeriesName in class AbstractSeriesDataset
Parameters:
series - The index of the required series (zero-based).

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...returns the end value.

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).

getStartValue

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

This method is part of the IntervalCategoryDataset interface.

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

getEndValue

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

This method is part of the IntervalCategoryDataset interface.

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

setStartValue

public void setStartValue(int series,
                          java.lang.Object category,
                          java.lang.Number value)
Sets the start data value for one category in a series.

Parameters:
series - The series (zero-based index).
category - The category.
value - The value.

setEndValue

public void setEndValue(int series,
                        java.lang.Object category,
                        java.lang.Number value)
Sets the end data value for one category in a series.

Parameters:
series - The series (zero-based index).
category - The category.
value - The value.


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.