Package org.jfree.data.category
Class DefaultIntervalCategoryDataset
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset
-
- org.jfree.data.category.DefaultIntervalCategoryDataset
-
- All Implemented Interfaces:
java.io.ObjectInputValidation,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,CategoryDataset,IntervalCategoryDataset,Dataset,SeriesChangeListener,SeriesDataset,KeyedValues2D,Values2D
public class DefaultIntervalCategoryDataset extends AbstractSeriesDataset implements IntervalCategoryDataset
A convenience class that provides a default implementation of theIntervalCategoryDatasetinterface.The standard constructor accepts data in a two dimensional array where the first dimension is the series, and the second dimension is the category.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultIntervalCategoryDataset(double[][] starts, double[][] ends)Creates a new dataset using the specified data values and automatically generated series and category keys.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(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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Objectclone()Returns a clone of this dataset.booleanequals(java.lang.Object obj)Tests this dataset for equality with an arbitrary object.java.util.ListgetCategories()Deprecated.UsegetColumnKeys()instead.intgetCategoryCount()Returns the number of categories in the dataset.intgetCategoryIndex(java.lang.Comparable category)Returns the index for the given category.intgetColumnCount()Returns the number of categories in the dataset.intgetColumnIndex(java.lang.Comparable columnKey)Returns a column index.java.lang.ComparablegetColumnKey(int column)Returns a column key.java.util.ListgetColumnKeys()Returns a list of the categories in the dataset.java.lang.NumbergetEndValue(int series, int category)Returns the end data value for one category in a series.java.lang.NumbergetEndValue(java.lang.Comparable series, java.lang.Comparable category)Returns the end data value for one category in a series.intgetItemCount()Deprecated.UsegetCategoryCount()instead.intgetRowCount()Returns the number of series in the dataset (possibly zero).intgetRowIndex(java.lang.Comparable rowKey)Returns a row index.java.lang.ComparablegetRowKey(int row)Returns the name of the specified series.java.util.ListgetRowKeys()Returns a list of the series in the dataset.java.util.ListgetSeries()Deprecated.UsegetRowKeys()instead.intgetSeriesCount()Returns the number of series in the dataset (possibly zero).intgetSeriesIndex(java.lang.Comparable seriesKey)Returns a series index.java.lang.ComparablegetSeriesKey(int series)Returns the name of the specified series.java.lang.NumbergetStartValue(int series, int category)Returns the start data value for one category in a series.java.lang.NumbergetStartValue(java.lang.Comparable series, java.lang.Comparable category)Returns the start data value for one category in a series.java.lang.NumbergetValue(int series, int category)Returns the data value for one category in a series.java.lang.NumbergetValue(java.lang.Comparable series, java.lang.Comparable category)Returns the data value for one category in a series.voidsetCategoryKeys(java.lang.Comparable[] categoryKeys)Sets the categories for the dataset.voidsetEndValue(int series, java.lang.Comparable category, java.lang.Number value)Sets the end data value for one category in a series.voidsetSeriesKeys(java.lang.Comparable[] seriesKeys)Sets the names of the series in the dataset.voidsetStartValue(int series, java.lang.Comparable category, java.lang.Number value)Sets the start data value for one category in a series.-
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObject
-
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
-
-
-
Constructor Detail
-
DefaultIntervalCategoryDataset
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends)
Creates a new dataset using the specified data values and automatically generated series and category keys.- Parameters:
starts- the starting values for the intervals (nullnot permitted).ends- the ending values for the intervals (nullnot permitted).
-
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
setSeriesKeys(Comparable[])andsetCategoryKeys(Comparable[])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 (ifnull, series names will be generated automatically).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 (ifnull, series keys will be generated automatically).categoryKeys- the category keys (ifnull, category keys will be generated automatically).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:
getSeriesCountin interfaceSeriesDataset- Specified by:
getSeriesCountin classAbstractSeriesDataset- Returns:
- The number of series in the dataset.
- See Also:
getRowCount(),getCategoryCount()
-
getSeriesIndex
public int getSeriesIndex(java.lang.Comparable seriesKey)
Returns a series index.- Parameters:
seriesKey- the series key.- Returns:
- The series index.
- See Also:
getRowIndex(Comparable),getSeriesKey(int)
-
getSeriesKey
public java.lang.Comparable getSeriesKey(int series)
Returns the name of the specified series.- Specified by:
getSeriesKeyin interfaceSeriesDataset- Specified by:
getSeriesKeyin classAbstractSeriesDataset- Parameters:
series- the index of the required series (zero-based).- Returns:
- The name of the specified series.
- See Also:
getSeriesIndex(Comparable)
-
setSeriesKeys
public void setSeriesKeys(java.lang.Comparable[] seriesKeys)
Sets the names of the series in the dataset.- Parameters:
seriesKeys- the new keys (nullnot permitted, the length of the array must match the number of series in the dataset).- See Also:
setCategoryKeys(Comparable[])
-
getCategoryCount
public int getCategoryCount()
Returns the number of categories in the dataset.- Returns:
- The number of categories in the dataset.
- See Also:
getColumnCount()
-
getColumnKeys
public java.util.List getColumnKeys()
Returns a list of the categories in the dataset. This method supports theCategoryDatasetinterface.- Specified by:
getColumnKeysin interfaceKeyedValues2D- Returns:
- A list of the categories in the dataset.
- See Also:
getRowKeys()
-
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.- See Also:
getRowKeys(),setSeriesKeys(Comparable[])
-
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:
getValuein interfaceKeyedValues2D- Parameters:
series- The required series (zero based index).category- The required category.- Returns:
- The data value for one category in a series (null possible).
- See Also:
getEndValue(Comparable, Comparable)
-
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:
getValuein interfaceValues2D- Parameters:
series- the required series (zero based index).category- the required category.- Returns:
- The data value for one category in a series (null possible).
- See Also:
getEndValue(int, int)
-
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.- Specified by:
getStartValuein interfaceIntervalCategoryDataset- Parameters:
series- the required series.category- the required category.- Returns:
- The start data value for one category in a series
(possibly
null). - See Also:
getStartValue(int, int)
-
getStartValue
public java.lang.Number getStartValue(int series, int category)
Returns the start data value for one category in a series.- Specified by:
getStartValuein interfaceIntervalCategoryDataset- Parameters:
series- the required series (zero based index).category- the required category.- Returns:
- The start data value for one category in a series
(possibly
null). - See Also:
getStartValue(Comparable, Comparable)
-
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.- Specified by:
getEndValuein interfaceIntervalCategoryDataset- Parameters:
series- the required series.category- the required category.- Returns:
- The end data value for one category in a series (null possible).
- See Also:
getEndValue(int, int)
-
getEndValue
public java.lang.Number getEndValue(int series, int category)
Returns the end data value for one category in a series.- Specified by:
getEndValuein interfaceIntervalCategoryDataset- 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).
- See Also:
getEndValue(Comparable, Comparable)
-
setStartValue
public void setStartValue(int series, java.lang.Comparable 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.- See Also:
setEndValue(int, Comparable, Number)
-
setEndValue
public void setEndValue(int series, java.lang.Comparable 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.- See Also:
setStartValue(int, Comparable, Number)
-
getCategoryIndex
public int getCategoryIndex(java.lang.Comparable category)
Returns the index for the given category.- Parameters:
category- the category (nullnot permitted).- Returns:
- The index.
- See Also:
getColumnIndex(Comparable)
-
getColumnKey
public java.lang.Comparable getColumnKey(int column)
Returns a column key.- Specified by:
getColumnKeyin interfaceKeyedValues2D- Parameters:
column- the column index.- Returns:
- The column key.
- See Also:
getRowKey(int)
-
getColumnIndex
public int getColumnIndex(java.lang.Comparable columnKey)
Returns a column index.- Specified by:
getColumnIndexin interfaceKeyedValues2D- Parameters:
columnKey- the column key (nullnot permitted).- Returns:
- The column index.
- See Also:
getCategoryIndex(Comparable)
-
getRowIndex
public int getRowIndex(java.lang.Comparable rowKey)
Returns a row index.- Specified by:
getRowIndexin interfaceKeyedValues2D- Parameters:
rowKey- the row key.- Returns:
- The row index.
- See Also:
getSeriesIndex(Comparable)
-
getRowKeys
public java.util.List getRowKeys()
Returns a list of the series in the dataset. This method supports theCategoryDatasetinterface.- Specified by:
getRowKeysin interfaceKeyedValues2D- Returns:
- A list of the series in the dataset.
- See Also:
getColumnKeys()
-
getRowKey
public java.lang.Comparable getRowKey(int row)
Returns the name of the specified series.- Specified by:
getRowKeyin interfaceKeyedValues2D- Parameters:
row- the index of the required row/series (zero-based).- Returns:
- The name of the specified series.
- See Also:
getColumnKey(int)
-
getColumnCount
public int getColumnCount()
Returns the number of categories in the dataset. This method is part of theCategoryDatasetinterface.- Specified by:
getColumnCountin interfaceValues2D- Returns:
- The number of categories in the dataset.
- See Also:
getCategoryCount(),getRowCount()
-
getRowCount
public int getRowCount()
Returns the number of series in the dataset (possibly zero).- Specified by:
getRowCountin interfaceValues2D- Returns:
- The number of series in the dataset.
- See Also:
getSeriesCount(),getColumnCount()
-
equals
public boolean equals(java.lang.Object obj)
Tests this dataset for equality with an arbitrary object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of this dataset.- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException- if there is a problem cloning the dataset.
-
getSeries
public java.util.List getSeries()
Deprecated.UsegetRowKeys()instead.Returns a list of the series in the dataset.- Returns:
- A list of the series in the dataset.
-
getCategories
public java.util.List getCategories()
Deprecated.UsegetColumnKeys()instead.Returns a list of the categories in the dataset.- Returns:
- A list of the categories in the dataset.
-
getItemCount
public int getItemCount()
Deprecated.UsegetCategoryCount()instead.Returns the item count.- Returns:
- The item count.
-
-