org.jfree.data.general

Class DefaultKeyedValueDataset

public class DefaultKeyedValueDataset extends AbstractDataset implements KeyedValueDataset, Serializable

A default implementation of the KeyedValueDataset interface.
Constructor Summary
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 a KeyedValue instance.
Method Summary
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, or null if 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 a DatasetChangeEvent to all registered listeners.
voidupdateValue(Number value)
Updates the value.

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 (null permitted).

DefaultKeyedValueDataset

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

Parameters: data the data (null permitted).

Method Detail

clone

public Object clone()
Creates a clone of the dataset.

Returns: A clone.

Throws: CloneNotSupportedException This class will not throw this exception, but subclasses (if any) might.

equals

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

Parameters: obj the object (null permitted).

Returns: A boolean.

getKey

public Comparable getKey()
Returns the key associated with the value, or null if the dataset has no data item.

Returns: The key.

getValue

public Number getValue()
Returns the value.

Returns: The value (possibly null).

hashCode

public int hashCode()
Returns a hash code.

Returns: A hash code.

setValue

public void setValue(Comparable key, Number value)
Sets the value for the dataset and sends a DatasetChangeEvent to all registered listeners.

Parameters: key the key. value the value (null permitted).

updateValue

public void updateValue(Number value)
Updates the value.

Parameters: value the new value (null permitted).

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.