Package org.jfree.data.general
Class DefaultKeyedValueDataset
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
ConstructorsConstructorDescriptionConstructs 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 aKeyedValueinstance. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a clone of the dataset.booleanTests this dataset for equality with an arbitrary object.getKey()Returns the key associated with the value, ornullif the dataset has no data item.getValue()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, 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
-
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 (nullpermitted).
-
DefaultKeyedValueDataset
Creates a new dataset that uses the data from aKeyedValueinstance.- Parameters:
data- the data (nullpermitted).
-
-
Method Details
-
getKey
Returns the key associated with the value, ornullif the dataset has no data item.- Specified by:
getKeyin interfaceKeyedValue- Returns:
- The key.
-
getValue
Returns the value. -
updateValue
Updates the value.- Parameters:
value- the new value (nullpermitted).
-
setValue
Sets the value for the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
key- the key.value- the value (nullpermitted).
-
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.- Overrides:
hashCodein classAbstractDataset- Returns:
- A hash code.
-
clone
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.
-