org.jfree.data
Class DefaultKeyedValueDataset

java.lang.Object
  |
  +--org.jfree.data.AbstractDataset
        |
        +--org.jfree.data.DefaultKeyedValueDataset
All Implemented Interfaces:
Dataset, KeyedValue, KeyedValueDataset, java.io.Serializable, Value

public class DefaultKeyedValueDataset
extends AbstractDataset
implements KeyedValueDataset, java.io.Serializable

A default implementation of the KeyedValueDataset interface.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
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 a KeyedValue instance.
 
Method Summary
 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.
 java.lang.Number getValue()
          Returns the value.
 void setValue(java.lang.Comparable key, java.lang.Number value)
          Sets the value for the dataset.
 void updateValue(java.lang.Number value)
          Updates the value.
 
Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

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.

DefaultKeyedValueDataset

public DefaultKeyedValueDataset(KeyedValue data)
Creates a new dataset that uses the data from a KeyedValue instance.

Parameters:
data - the data.
Method Detail

getKey

public java.lang.Comparable getKey()
Returns the key associated with the value.

Specified by:
getKey in interface KeyedValue
Returns:
the key.

getValue

public java.lang.Number getValue()
Returns the value.

Specified by:
getValue in interface Value
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. After the change is made, a DatasetChangeEvent is sent to all registered listeners.

Parameters:
key - the key.
value - the value.

equals

public boolean equals(java.lang.Object obj)
Tests this dataset for equality with an arbitrary object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object.
Returns:
A boolean.