JFreeChart 1.0.14-redhat-2

org.jfree.data
Class DefaultKeyedValue

java.lang.Object
  extended by org.jfree.data.DefaultKeyedValue
All Implemented Interfaces:
Serializable, Cloneable, KeyedValue, Value, org.jfree.util.PublicCloneable

public class DefaultKeyedValue
extends Object
implements KeyedValue, Cloneable, org.jfree.util.PublicCloneable, Serializable

A (key, value) pair. This class provides a default implementation of the KeyedValue interface.

See Also:
Serialized Form

Constructor Summary
DefaultKeyedValue(Comparable key, Number value)
          Creates a new (key, value) item.
 
Method Summary
 Object clone()
          Returns a clone.
 boolean equals(Object obj)
          Tests this key-value pair for equality with an arbitrary object.
 Comparable getKey()
          Returns the key.
 Number getValue()
          Returns the value.
 int hashCode()
          Returns a hash code.
 void setValue(Number value)
          Sets the value.
 String toString()
          Returns a string representing this instance, primarily useful for debugging.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultKeyedValue

public DefaultKeyedValue(Comparable key,
                         Number value)
Creates a new (key, value) item.

Parameters:
key - the key (should be immutable, null not permitted).
value - the value (null permitted).
Method Detail

getKey

public Comparable getKey()
Returns the key.

Specified by:
getKey in interface KeyedValue
Returns:
The key (never null).

getValue

public Number getValue()
Returns the value.

Specified by:
getValue in interface Value
Returns:
The value (possibly null).

setValue

public void setValue(Number value)
Sets the value.

Parameters:
value - the value (null permitted).

equals

public boolean equals(Object obj)
Tests this key-value pair for equality with an arbitrary object.

Overrides:
equals in class Object
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

hashCode

public int hashCode()
Returns a hash code.

Overrides:
hashCode in class Object
Returns:
A hash code.

clone

public Object clone()
             throws 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.

Specified by:
clone in interface org.jfree.util.PublicCloneable
Overrides:
clone in class Object
Returns:
A clone.
Throws:
CloneNotSupportedException - Not thrown by this class, but subclasses (if any) might.

toString

public String toString()
Returns a string representing this instance, primarily useful for debugging.

Overrides:
toString in class Object
Returns:
A string.

JFreeChart 1.0.14-redhat-2

Copyright © 2001-2012 JFree.org. All Rights Reserved.