java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.general.DefaultKeyedValueDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,Dataset
,KeyedValueDataset
,KeyedValue
,Value
public class DefaultKeyedValueDataset
extends AbstractDataset
implements KeyedValueDataset, Serializable
A default implementation of the
KeyedValueDataset
interface.- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs a new dataset, initially empty.DefaultKeyedValueDataset
(Comparable key, Number value) Creates a new dataset with the specified initial value.Creates a new dataset that uses the data from aKeyedValue
instance. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a clone of the dataset.boolean
Tests this dataset for equality with an arbitrary object.getKey()
Returns the key associated with the value, ornull
if the dataset has no data item.getValue()
Returns the value.int
hashCode()
Returns a hash code.void
setValue
(Comparable key, Number value) Sets the value for the dataset and sends aDatasetChangeEvent
to all registered listeners.void
updateValue
(Number value) Updates the value.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, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset()Constructs a new dataset, initially empty. -
DefaultKeyedValueDataset
Creates a new dataset with the specified initial value.- Parameters:
key
- the key.value
- the value (null
permitted).
-
DefaultKeyedValueDataset
Creates a new dataset that uses the data from aKeyedValue
instance.- Parameters:
data
- the data (null
permitted).
-
-
Method Details
-
getKey
Returns the key associated with the value, ornull
if the dataset has no data item.- Specified by:
getKey
in interfaceKeyedValue
- Returns:
- The key.
-
getValue
Returns the value. -
updateValue
Updates the value.- Parameters:
value
- the new value (null
permitted).
-
setValue
Sets the value for the dataset and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
key
- the key.value
- the value (null
permitted).
-
equals
Tests this dataset for equality with an arbitrary object. -
hashCode
public int hashCode()Returns a hash code. -
clone
Creates a clone of the dataset.- Overrides:
clone
in classAbstractDataset
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- This class will not throw this exception, but subclasses (if any) might.
-