Package org.jfree.data.category
Class SlidingCategoryDataset
java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.category.SlidingCategoryDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,CategoryDataset
,Dataset
,KeyedValues2D
,Values2D
A
CategoryDataset
implementation that presents a subset of the
categories in an underlying dataset. The index of the first "visible"
category can be modified, which provides a means of "sliding" through
the categories in the underlying dataset.- See Also:
-
Constructor Summary
ConstructorDescriptionSlidingCategoryDataset
(CategoryDataset underlying, int firstColumn, int maxColumns) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns an independent copy of the dataset.boolean
Tests thisSlidingCategoryDataset
for equality with an arbitrary object.int
Returns the number of columns in the table.int
getColumnIndex
(Comparable key) Returns the index for the specified column key.getColumnKey
(int column) Returns the column key for a given index.Returns the column keys.int
Returns the index of the first visible category.int
Returns the maximum category count.int
Returns the number of rows in the table.int
getRowIndex
(Comparable key) Returns the row index for a given key.getRowKey
(int row) Returns the row key for a given index.Returns the row keys.Returns the underlying dataset that was supplied to the constructor.getValue
(int row, int column) Returns a value from the table.getValue
(Comparable rowKey, Comparable columnKey) Returns the value for a pair of keys.void
setFirstCategoryIndex
(int first) Sets the index of the first category that should be used from the underlying dataset, and sends aDatasetChangeEvent
to all registered listeners.void
setMaximumCategoryCount
(int max) Sets the maximum category count and sends aDatasetChangeEvent
to all registered listeners.Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, fireDatasetChanged, getGroup, getNotify, hashCode, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
SlidingCategoryDataset
Creates a new instance.- Parameters:
underlying
- the underlying dataset (null
not permitted).firstColumn
- the index of the first visible column from the underlying dataset.maxColumns
- the maximumColumnCount.
-
-
Method Details
-
getUnderlyingDataset
Returns the underlying dataset that was supplied to the constructor.- Returns:
- The underlying dataset (never
null
).
-
getFirstCategoryIndex
Returns the index of the first visible category.- Returns:
- The index.
- See Also:
-
setFirstCategoryIndex
Sets the index of the first category that should be used from the underlying dataset, and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
first
- the index.- See Also:
-
getMaximumCategoryCount
Returns the maximum category count.- Returns:
- The maximum category count.
- See Also:
-
setMaximumCategoryCount
Sets the maximum category count and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
max
- the maximum.- See Also:
-
getColumnIndex
Returns the index for the specified column key.- Specified by:
getColumnIndex
in interfaceKeyedValues2D
- Parameters:
key
- the key.- Returns:
- The column index, or -1 if the key is not recognised.
-
getColumnKey
Returns the column key for a given index.- Specified by:
getColumnKey
in interfaceKeyedValues2D
- Parameters:
column
- the column index (zero-based).- Returns:
- The column key.
- Throws:
IndexOutOfBoundsException
- ifrow
is out of bounds.
-
getColumnKeys
Returns the column keys.- Specified by:
getColumnKeys
in interfaceKeyedValues2D
- Returns:
- The keys.
- See Also:
-
getRowIndex
Returns the row index for a given key.- Specified by:
getRowIndex
in interfaceKeyedValues2D
- Parameters:
key
- the row key.- Returns:
- The row index, or
-1
if the key is unrecognised.
-
getRowKey
Returns the row key for a given index.- Specified by:
getRowKey
in interfaceKeyedValues2D
- Parameters:
row
- the row index (zero-based).- Returns:
- The row key.
- Throws:
IndexOutOfBoundsException
- ifrow
is out of bounds.
-
getRowKeys
Returns the row keys.- Specified by:
getRowKeys
in interfaceKeyedValues2D
- Returns:
- The keys.
-
getValue
Returns the value for a pair of keys.- Specified by:
getValue
in interfaceKeyedValues2D
- Parameters:
rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).- Returns:
- The value (possibly
null
). - Throws:
UnknownKeyException
- if either key is not defined in the dataset.
-
getColumnCount
Returns the number of columns in the table.- Specified by:
getColumnCount
in interfaceValues2D
- Returns:
- The column count.
-
getRowCount
Returns the number of rows in the table.- Specified by:
getRowCount
in interfaceValues2D
- Returns:
- The row count.
-
getValue
Returns a value from the table. -
equals
Tests thisSlidingCategoryDataset
for equality with an arbitrary object.- Overrides:
equals
in classAbstractDataset
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
clone
Returns an independent copy of the dataset. Note that:- the underlying dataset is only cloned if it implements the
PublicCloneable
interface; - the listeners registered with this dataset are not carried over to the cloned dataset.
- Overrides:
clone
in classAbstractDataset
- Returns:
- An independent copy of the dataset.
- Throws:
CloneNotSupportedException
- if the dataset cannot be cloned for any reason.
- the underlying dataset is only cloned if it implements the
-