Package org.jfree.data.category
Class DefaultCategoryDataset
java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.category.DefaultCategoryDataset
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,PublicCloneable,CategoryDataset,Dataset,KeyedValues2D,Values2D
- Direct Known Subclasses:
DefaultKeyedValues2DDataset,JDBCCategoryDataset
public class DefaultCategoryDataset
extends AbstractDataset
implements CategoryDataset, PublicCloneable, Serializable
A default implementation of the
CategoryDataset interface.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValue(double value, Comparable rowKey, Comparable columnKey) Adds a value to the table.voidaddValue(Number value, Comparable rowKey, Comparable columnKey) Adds a value to the table.voidclear()Clears all data from the dataset and sends aDatasetChangeEventto all registered listeners.clone()Returns a clone of the dataset.booleanTests this dataset for equality with an arbitrary object.intReturns the number of columns in the table.intgetColumnIndex(Comparable key) Returns the column index for a given key.getColumnKey(int column) Returns a column key.Returns the column keys.intReturns the number of rows in the table.intgetRowIndex(Comparable key) Returns the row index for a given key.getRowKey(int row) Returns the key for the specified row.Returns the row keys.getValue(int row, int column) Returns a value from the table.getValue(Comparable rowKey, Comparable columnKey) Returns the value for a pair of keys.inthashCode()Returns a hash code for the dataset.voidincrementValue(double value, Comparable rowKey, Comparable columnKey) Adds the specified value to an existing value in the dataset (if the existing value isnull, it is treated as if it were 0.0).voidremoveColumn(int columnIndex) Removes a column from the dataset and sends aDatasetChangeEventto all registered listeners.voidremoveColumn(Comparable columnKey) Removes a column from the dataset and sends aDatasetChangeEventto all registered listeners.voidremoveRow(int rowIndex) Removes a row from the dataset and sends aDatasetChangeEventto all registered listeners.voidremoveRow(Comparable rowKey) Removes a row from the dataset and sends aDatasetChangeEventto all registered listeners.voidremoveValue(Comparable rowKey, Comparable columnKey) Removes a value from the dataset and sends aDatasetChangeEventto all registered listeners.voidsetValue(double value, Comparable rowKey, Comparable columnKey) Adds or updates a value in the table and sends aDatasetChangeEventto all registered listeners.voidsetValue(Number value, Comparable rowKey, Comparable columnKey) Adds or updates a value in the table and sends aDatasetChangeEventto all registered listeners.Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
DefaultCategoryDataset
public DefaultCategoryDataset()Creates a new (empty) dataset.
-
-
Method Details
-
getRowCount
Returns the number of rows in the table.- Specified by:
getRowCountin interfaceValues2D- Returns:
- The row count.
- See Also:
-
getColumnCount
Returns the number of columns in the table.- Specified by:
getColumnCountin interfaceValues2D- Returns:
- The column count.
- See Also:
-
getValue
Returns a value from the table. -
getRowKey
Returns the key for the specified row.- Specified by:
getRowKeyin interfaceKeyedValues2D- Parameters:
row- the row index (zero-based).- Returns:
- The row key.
- See Also:
-
getRowIndex
Returns the row index for a given key.- Specified by:
getRowIndexin interfaceKeyedValues2D- Parameters:
key- the row key (nullnot permitted).- Returns:
- The row index.
- See Also:
-
getRowKeys
Returns the row keys.- Specified by:
getRowKeysin interfaceKeyedValues2D- Returns:
- The keys.
- See Also:
-
getColumnKey
Returns a column key.- Specified by:
getColumnKeyin interfaceKeyedValues2D- Parameters:
column- the column index (zero-based).- Returns:
- The column key.
- See Also:
-
getColumnIndex
Returns the column index for a given key.- Specified by:
getColumnIndexin interfaceKeyedValues2D- Parameters:
key- the column key (nullnot permitted).- Returns:
- The column index.
- See Also:
-
getColumnKeys
Returns the column keys.- Specified by:
getColumnKeysin interfaceKeyedValues2D- Returns:
- The keys.
- See Also:
-
getValue
Returns the value for a pair of keys.- Specified by:
getValuein interfaceKeyedValues2D- Parameters:
rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).- Returns:
- The value (possibly
null). - Throws:
UnknownKeyException- if either key is not defined in the dataset.- See Also:
-
addValue
Adds a value to the table. Performs the same function as setValue().- Parameters:
value- the value.rowKey- the row key.columnKey- the column key.- See Also:
-
addValue
Adds a value to the table.- Parameters:
value- the value.rowKey- the row key.columnKey- the column key.- See Also:
-
setValue
Adds or updates a value in the table and sends aDatasetChangeEventto all registered listeners.- Parameters:
value- the value (nullpermitted).rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).- See Also:
-
setValue
Adds or updates a value in the table and sends aDatasetChangeEventto all registered listeners.- Parameters:
value- the value.rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).- See Also:
-
incrementValue
Adds the specified value to an existing value in the dataset (if the existing value isnull, it is treated as if it were 0.0).- Parameters:
value- the value.rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).- Throws:
UnknownKeyException- if either key is not defined in the dataset.
-
removeValue
Removes a value from the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
rowKey- the row key.columnKey- the column key.- See Also:
-
removeRow
Removes a row from the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
rowIndex- the row index.- See Also:
-
removeRow
Removes a row from the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
rowKey- the row key.- See Also:
-
removeColumn
Removes a column from the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
columnIndex- the column index.- See Also:
-
removeColumn
Removes a column from the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
columnKey- the column key (nullnot permitted).- Throws:
UnknownKeyException- ifcolumnKeyis not defined in the dataset.- See Also:
-
clear
Clears all data from the dataset and sends aDatasetChangeEventto all registered listeners. -
equals
Tests this dataset for equality with an arbitrary object.- Overrides:
equalsin classAbstractDataset- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
hashCode
Returns a hash code for the dataset.- Overrides:
hashCodein classAbstractDataset- Returns:
- A hash code.
-
clone
Returns a clone of the dataset.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if there is a problem cloning the dataset.
-