Package org.jfree.data.general
Class DefaultKeyedValueDataset
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.DefaultKeyedValueDataset
-
- All Implemented Interfaces:
java.io.ObjectInputValidation
,java.io.Serializable
,java.lang.Cloneable
,Dataset
,KeyedValueDataset
,KeyedValue
,Value
public class DefaultKeyedValueDataset extends AbstractDataset implements KeyedValueDataset, java.io.Serializable
A default implementation of theKeyedValueDataset
interface.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private KeyedValue
data
Storage for the data.private static long
serialVersionUID
For serialization.
-
Constructor Summary
Constructors Constructor Description DefaultKeyedValueDataset()
Constructs a new dataset, initially empty.DefaultKeyedValueDataset(java.lang.Comparable key, java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Creates a clone of the dataset.boolean
equals(java.lang.Object obj)
Tests this dataset for equality with an arbitrary object.java.lang.Comparable
getKey()
Returns the key associated with the value, ornull
if the dataset has no data item.java.lang.Number
getValue()
Returns the value.int
hashCode()
Returns a hash code.void
setValue(java.lang.Comparable key, java.lang.Number value)
Sets the value for the dataset and sends aDatasetChangeEvent
to all registered listeners.void
updateValue(java.lang.Number value)
Updates the value.-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, 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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
data
private KeyedValue data
Storage for the data.
-
-
Constructor Detail
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset()
Constructs a new dataset, initially empty.
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset(java.lang.Comparable key, java.lang.Number value)
Creates a new dataset with the specified initial value.- Parameters:
key
- the key.value
- the value (null
permitted).
-
DefaultKeyedValueDataset
public DefaultKeyedValueDataset(KeyedValue data)
Creates a new dataset that uses the data from aKeyedValue
instance.- Parameters:
data
- the data (null
permitted).
-
-
Method Detail
-
getKey
public java.lang.Comparable 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
public java.lang.Number getValue()
Returns the value.
-
updateValue
public void updateValue(java.lang.Number value)
Updates the value.- Parameters:
value
- the new value (null
permitted).
-
setValue
public void setValue(java.lang.Comparable key, java.lang.Number value)
Sets the value for the dataset and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
key
- the key.value
- the value (null
permitted).
-
equals
public boolean equals(java.lang.Object obj)
Tests this dataset for equality with an arbitrary object.- Overrides:
equals
in classAbstractDataset
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code.- Overrides:
hashCode
in classAbstractDataset
- Returns:
- A hash code.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Creates a clone of the dataset.- Overrides:
clone
in classAbstractDataset
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- This class will not throw this exception, but subclasses (if any) might.
-
-