com.ijchart.xychart.dataset.data
Class KeyValuePair

java.lang.Object
  extended by com.ijchart.xychart.dataset.data.KeyValuePair
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class KeyValuePair
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

Class for represent (key,value) pair.The key and value object must implement Cloneable and Serializable interface.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static KeyValueComparatorType DEFAULT_COMPARATOR_TYPE
           The default comparator type.
 
Constructor Summary
KeyValuePair(java.lang.Object key, java.lang.Object value)
           Construct a instance by (key,value) pair.
KeyValuePair(java.lang.Object key, java.lang.Object value, KeyValueComparatorType comparatorType)
           Construct a instance by (key,value) pair.
 
Method Summary
 java.lang.Object clone()
           Returns a clone.
 int compareTo(java.lang.Object other)
           Compare two objects.
 boolean equals(java.lang.Object obj)
           Tests this key-value pair for equality with an arbitrary object.
 KeyValueComparatorType getComparatorType()
           Returns the comparator type.
 java.lang.Object getKey()
           Get the key object.
 java.lang.Object getValue()
           Get the value.
 int hashCode()
           Returns a hash code.
 void setComparatorType(KeyValueComparatorType type)
           Sets the comparator type.
 void setValue(java.lang.Object value)
           Sets the value associate with the key.
 java.lang.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
 

Field Detail

DEFAULT_COMPARATOR_TYPE

public static final KeyValueComparatorType DEFAULT_COMPARATOR_TYPE
The default comparator type.

Constructor Detail

KeyValuePair

public KeyValuePair(java.lang.Object key,
                    java.lang.Object value)
Construct a instance by (key,value) pair.

Parameters:
key - Object The key value (null not permitted).
value - Object The value ((null permitted)).

KeyValuePair

public KeyValuePair(java.lang.Object key,
                    java.lang.Object value,
                    KeyValueComparatorType comparatorType)
Construct a instance by (key,value) pair.

Parameters:
key - Object The key value (null not permitted).
value - Object The value ((null permitted)).
comparatorType - KeyValueComparatorType The comparator type.
Method Detail

getKey

public java.lang.Object getKey()
Get the key object.

Returns:
Object The key value (maybe null).

getValue

public java.lang.Object getValue()
Get the value.

Returns:
Object The value (maybe null).

setValue

public void setValue(java.lang.Object value)
Sets the value associate with the key.

Parameters:
value - Object The value associate with the key (null permitted).

getComparatorType

public KeyValueComparatorType getComparatorType()
Returns the comparator type.

Returns:
KeyValueComparatorType The comparator type.

setComparatorType

public void setComparatorType(KeyValueComparatorType type)
Sets the comparator type.

Parameters:
type - KeyValueComparatorType The comparator type.

compareTo

public int compareTo(java.lang.Object other)
Compare two objects.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - Object
Returns:
int

equals

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

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

hashCode

public int hashCode()
Returns a hash code.

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

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.

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

toString

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

Overrides:
toString in class java.lang.Object
Returns:
A string.