org.jfree.data
Class DefaultIntervalCategoryDataset

java.lang.Object
  |
  +--org.jfree.data.AbstractDataset
        |
        +--org.jfree.data.AbstractSeriesDataset
              |
              +--org.jfree.data.DefaultIntervalCategoryDataset
All Implemented Interfaces:
CategoryDataset, Dataset, IntervalCategoryDataset, KeyedValues2D, java.io.Serializable, SeriesChangeListener, SeriesDataset, Values2D

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.

Author:
Jeremy Bowman
See Also:
Serialized Form

Constructor Summary
DefaultIntervalCategoryDataset(java.lang.Comparable[] seriesKeys, java.lang.Comparable[] categoryKeys, 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.
DefaultIntervalCategoryDataset(double[][] starts, double[][] ends)
          Creates a new dataset.
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.
 
Method Summary
 java.util.List getCategories()
          Returns a list of the categories in the dataset.
 java.lang.Comparable getCategory(int item)
          Returns a category key.
 int getCategoryCount()
          Returns the number of categories in the dataset.
 int getColumnCount()
          Returns the number of categories in the dataset.
 int getColumnIndex(java.lang.Comparable columnKey)
          Returns a column index.
 java.lang.Comparable getColumnKey(int item)
          Returns a column key.
 java.util.List getColumnKeys()
          Returns a list of the categories in the dataset.
 java.lang.Number getEndValue(java.lang.Comparable series, java.lang.Comparable category)
          Returns the end data value for one category in a series.
 java.lang.Number getEndValue(int series, int category)
          Returns the end data value for one category in a series.
 int getItem(java.lang.Object category)
          Returns an item.
 int getItemCount()
          Returns the item count.
 int getRowCount()
          Returns the number of series in the dataset (possibly zero).
 int getRowIndex(java.lang.Comparable rowKey)
          Returns a row index.
 java.lang.Comparable getRowKey(int series)
          Returns the name of the specified series.
 java.util.List getRowKeys()
          Returns a list of the series in the dataset.
 java.util.List getSeries()
          Returns a list of the series in the dataset.
 java.lang.Comparable getSeries(int series)
          Returns the name of the specified series.
 int getSeriesCount()
          Returns the number of series in the dataset (possibly zero).
 int getSeriesIndex(java.lang.Object series)
          Returns a series index.
 java.lang.String getSeriesName(int series)
          Returns the name of the specified series.
 java.lang.Number getStartValue(java.lang.Comparable series, java.lang.Comparable category)
          Returns the start data value for one category in a series.
 java.lang.Number getStartValue(int series, int category)
          Returns the start data value for one category in a series.
 java.lang.Number getValue(java.lang.Comparable series, java.lang.Comparable category)
          Returns the data value for one category in a series.
 java.lang.Number getValue(int series, int category)
          Returns the data value for one category in a series.
 void setCategoryKeys(java.lang.Comparable[] categoryKeys)
          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 setSeriesKeys(java.lang.Comparable[] seriesKeys)
          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 org.jfree.data.AbstractSeriesDataset
seriesChanged
 
Methods inherited from class org.jfree.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 org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

DefaultIntervalCategoryDataset

public DefaultIntervalCategoryDataset(double[][] starts,
                                      double[][] ends)
Creates a new dataset.

Parameters:
starts - the starting values for the intervals.
ends - the ending values for the intervals.

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.Comparable[] seriesKeys,
                                      java.lang.Comparable[] categoryKeys,
                                      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:
seriesKeys - the series keys.
categoryKeys - 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.

getItemCount

public int getItemCount()
Returns the item count.

Returns:
The item count.

getCategory

public java.lang.Comparable getCategory(int item)
Returns a category key.

Parameters:
item - the category index.
Returns:
The category key.

getItem

public int getItem(java.lang.Object category)
Returns an item.

Parameters:
category - the category key.
Returns:
The item index.

getSeriesIndex

public int getSeriesIndex(java.lang.Object series)
Returns a series index.

Parameters:
series - the series.
Returns:
The series index.

getSeries

public java.lang.Comparable getSeries(int series)
Returns the name of the specified series.

Parameters:
series - the index of the required series (zero-based).
Returns:
the name of the specified series.

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).
Returns:
the name of the specified series.

setSeriesKeys

public void setSeriesKeys(java.lang.Comparable[] seriesKeys)
Sets the names of the series in the dataset.

Parameters:
seriesKeys - the keys 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.

Returns:
the number of categories in the dataset.

getSeries

public java.util.List getSeries()
Returns a list of the series in the dataset.

Supports the CategoryDataset interface.

Returns:
a list of the series in the dataset.

getCategories

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

Supports the CategoryDataset interface.

Returns:
a list of the categories in the dataset.

getColumnKeys

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

Supports the CategoryDataset interface.

Specified by:
getColumnKeys in interface KeyedValues2D
Returns:
a list of the categories in the dataset.

setCategoryKeys

public void setCategoryKeys(java.lang.Comparable[] categoryKeys)
Sets the categories for the dataset.

Parameters:
categoryKeys - An array of objects representing the categories in the dataset.

getValue

public java.lang.Number getValue(java.lang.Comparable series,
                                 java.lang.Comparable 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 KeyedValues2D
Parameters:
series - The required series (zero based index).
category - The required category.
Returns:
The data value for one category in a series (null possible).

getValue

public java.lang.Number getValue(int series,
                                 int 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 Values2D
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(java.lang.Comparable series,
                                      java.lang.Comparable category)
Returns the start data value for one category in a series.

This method is part of the IntervalTableDataset interface.

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

getStartValue

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

This method is part of the IntervalTableDataset 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(java.lang.Comparable series,
                                    java.lang.Comparable category)
Returns the end data value for one category in a series.

This method is part of the IntervalTableDataset interface.

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

getEndValue

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

This method is part of the IntervalTableDataset 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.

getColumnKey

public java.lang.Comparable getColumnKey(int item)
Returns a column key.

Specified by:
getColumnKey in interface KeyedValues2D
Parameters:
item - the column index.
Returns:
The column key.

getColumnIndex

public int getColumnIndex(java.lang.Comparable columnKey)
Returns a column index.

Specified by:
getColumnIndex in interface KeyedValues2D
Parameters:
columnKey - the column key.
Returns:
The column index.

getRowIndex

public int getRowIndex(java.lang.Comparable rowKey)
Returns a row index.

Specified by:
getRowIndex in interface KeyedValues2D
Parameters:
rowKey - the row key.
Returns:
The row index.

getRowKeys

public java.util.List getRowKeys()
Returns a list of the series in the dataset.

Supports the CategoryDataset interface.

Specified by:
getRowKeys in interface KeyedValues2D
Returns:
a list of the series in the dataset.

getRowKey

public java.lang.Comparable getRowKey(int series)
Returns the name of the specified series.

Specified by:
getRowKey in interface KeyedValues2D
Parameters:
series - the index of the required series (zero-based).
Returns:
the name of the specified series.

getColumnCount

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

This method is part of the CategoryDataset interface.

Specified by:
getColumnCount in interface Values2D
Returns:
the number of categories in the dataset.

getRowCount

public int getRowCount()
Returns the number of series in the dataset (possibly zero).

Specified by:
getRowCount in interface Values2D
Returns:
the number of series in the dataset.