- 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 theKeyedValueDatasetinterface.- 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 aKeyedValueinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Creates a clone of the dataset.booleanequals(Object obj)Tests this dataset for equality with an arbitrary object.ComparablegetKey()Returns the key associated with the value, ornullif the dataset has no data item.NumbergetValue()Returns the value.inthashCode()Returns a hash code.voidsetValue(Comparable key, Number value)Sets the value for the dataset and sends aDatasetChangeEventto all registered listeners.voidupdateValue(Number value)Updates the value.-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getNotify, hasListener, notifyListeners, removeChangeListener, 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, removeChangeListener
-
-
-
-
Constructor Detail
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset()
Constructs a new dataset, initially empty.
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset(Comparable key, Number value)
Creates a new dataset with the specified initial value.- Parameters:
key- the key.value- the value (nullpermitted).
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset(KeyedValue data)
Creates a new dataset that uses the data from aKeyedValueinstance.- Parameters:
data- the data (nullpermitted).
-
-
Method Detail
-
getKey
public Comparable getKey()
Returns the key associated with the value, ornullif the dataset has no data item.- Specified by:
getKeyin interfaceKeyedValue- Returns:
- The key.
-
updateValue
public void updateValue(Number value)
Updates the value.- Parameters:
value- the new value (nullpermitted).
-
setValue
public void setValue(Comparable key, Number value)
Sets the value for the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
key- the key.value- the value (nullpermitted).
-
hashCode
public int hashCode()
Returns a hash code.
-
clone
public Object clone() throws CloneNotSupportedException
Creates a clone of the dataset.- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- This class will not throw this exception, but subclasses (if any) might.
-
-