org.jfree.data
Class DefaultKeyedValue

java.lang.Object
  extended byorg.jfree.data.DefaultKeyedValue
All Implemented Interfaces:
java.lang.Cloneable, KeyedValue, java.io.Serializable, Value

public class DefaultKeyedValue
extends java.lang.Object
implements KeyedValue, java.lang.Cloneable, java.io.Serializable

A (key, value) pair.

This class provides a default implementation of the KeyedValue interface.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
DefaultKeyedValue(java.lang.Comparable key, java.lang.Number value)
          Creates a new (key, value) pair.
 
Method Summary
 java.lang.Object clone()
          Returns a clone.
 boolean equals(java.lang.Object o)
          Tests if this object is equal to another.
 java.lang.Comparable getKey()
          Returns the key.
 java.lang.Number getValue()
          Returns the value.
 void setValue(java.lang.Number value)
          Sets the value.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultKeyedValue

public DefaultKeyedValue(java.lang.Comparable key,
                         java.lang.Number value)
Creates a new (key, value) pair.

Parameters:
key - the key.
value - the value (null permitted).
Method Detail

getKey

public java.lang.Comparable getKey()
Returns the key.

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.

setValue

public void setValue(java.lang.Number value)
Sets the value.

Parameters:
value - the value.

equals

public boolean equals(java.lang.Object o)
Tests if this object is equal to another.

Parameters:
o - the other object.
Returns:
A boolean.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone. It is assumed that both the key and value are immutable objects, so only the references are cloned, not the objects themselves.

Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - Not thrown by this class, but subclasses (if any) might.