com.ibm.commerce.tools.util
Class StringPair

java.lang.Object
  |
  +--com.ibm.commerce.tools.util.StringPair
All Implemented Interfaces:
java.lang.Comparable

public class StringPair
extends java.lang.Object
implements java.lang.Comparable

A basic string key or value pair wrapper used for sorting.


Field Summary
static java.lang.String COPYRIGHT
          The IBM copyright notice field.
 
Constructor Summary
StringPair(java.lang.String k, java.lang.String v)
          This constructor takes in a key or value pair.
StringPair(java.lang.String k, java.lang.String v, java.text.Collator c)
          This constructor takes in a key or value pair and a collator.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares with another StringPair's value.
 java.text.Collator getCollator()
          Gets the collator
 java.lang.String getKey()
          Returns the key.
 java.lang.String getValue()
          Returns the value.
 void setCollator(java.text.Collator collator)
          Sets the collator
 void setKey(java.lang.String key)
          Sets the key
 void setValue(java.lang.String value)
          Sets the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
The IBM copyright notice field.
See Also:
Constant Field Values
Constructor Detail

StringPair

public StringPair(java.lang.String k,
                  java.lang.String v)
This constructor takes in a key or value pair.
Parameters:
k - The key.
v - The value.

StringPair

public StringPair(java.lang.String k,
                  java.lang.String v,
                  java.text.Collator c)
This constructor takes in a key or value pair and a collator.
Parameters:
k - the key
v - the value
c - the collator
Method Detail

getKey

public java.lang.String getKey()
Returns the key.
Returns:
the key as a string.

setKey

public void setKey(java.lang.String key)
Sets the key
Parameters:
key - the key.

getValue

public java.lang.String getValue()
Returns the value.
Returns:
The value as a string.

setValue

public void setValue(java.lang.String value)
Sets the value.
Parameters:
value - the value.

compareTo

public int compareTo(java.lang.Object o)
Compares with another StringPair's value.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - StringPair object to be compared.
Returns:
0 if the objects are equal, or an exception is thrown.
-1 if this value is less than the object's value.
1 if this value is greater than the object's value.

getCollator

public java.text.Collator getCollator()
Gets the collator
Returns:
The Collator

setCollator

public void setCollator(java.text.Collator collator)
Sets the collator
Parameters:
collator - the collator.