Package org.jfree.data
Class DefaultKeyedValueDataset
java.lang.Object
org.jfree.data.AbstractDataset
org.jfree.data.DefaultKeyedValueDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,Dataset
,KeyedValue
,KeyedValueDataset
,Value
public class DefaultKeyedValueDataset extends AbstractDataset implements KeyedValueDataset, Serializable
A default implementation of the
KeyedValueDataset
interface.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description DefaultKeyedValueDataset()
Constructs a new dataset, initially empty.DefaultKeyedValueDataset(Comparable key, Number value)
Creates a new dataset with the specified initial value.DefaultKeyedValueDataset(KeyedValue data)
Creates a new dataset that uses the data from aKeyedValue
instance. -
Method Summary
Modifier and Type Method Description Object
clone()
Creates a clone of the dataset.boolean
equals(Object obj)
Tests this dataset for equality with an arbitrary object.Comparable
getKey()
Returns the key associated with the value, ornull
if the dataset has no data item.Number
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.AbstractDataset
addChangeListener, getGroup, removeChangeListener, setGroup, validateObject
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.data.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.
-