Package org.jfree.data
Class DefaultKeyedValue
- java.lang.Object
-
- 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 theKeyedValue
interface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultKeyedValue(Comparable key, Number value)
Creates a new (key, value) item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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 interfaceKeyedValue
- Returns:
- The key (never
null
).
-
getValue
public Number getValue()
Returns the value.
-
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.
-
hashCode
public int hashCode()
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 interfaceorg.jfree.util.PublicCloneable
- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- Not thrown by this class, but subclasses (if any) might.
-
-