jdsl.core.ref
Class StringComparator

java.lang.Object
  |
  +--jdsl.core.ref.StringComparator

public class StringComparator
extends java.lang.Object
implements Comparator

Provides easy comparison of strings.

Author:
Benoit Hudson , Mike Boilen (mgb)

Constructor Summary
StringComparator()
           
 
Method Summary
 boolean isComparable(java.lang.Object o)
          Tests if o is a String and not null.
 boolean isEqualTo(java.lang.Object a, java.lang.Object b)
          Tests if two strings are equal.
 boolean isGreaterThan(java.lang.Object a, java.lang.Object b)
          Tests if a String is greater than another
 boolean isGreaterThanOrEqualTo(java.lang.Object a, java.lang.Object b)
          Tests if a String is greater than or equal to another
 boolean isLessThan(java.lang.Object a, java.lang.Object b)
          Tests if a String is less than another
 boolean isLessThanOrEqualTo(java.lang.Object a, java.lang.Object b)
          Tests if a String is greater than another
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringComparator

public StringComparator()
Method Detail

isComparable

public boolean isComparable(java.lang.Object o)
Tests if o is a String and not null.
Specified by:
isComparable in interface Comparator
Parameters:
o - The object to be examined
Returns:
true if o can be compared, falseotherwise.

isEqualTo

public boolean isEqualTo(java.lang.Object a,
                         java.lang.Object b)
Tests if two strings are equal.
Specified by:
isEqualTo in interface Comparator
Returns:
true if the two strings are lexicographically equivalent, false otherwise.
Throws:
InvalidKeyException - if either parameter is either null or not a String.

isGreaterThan

public boolean isGreaterThan(java.lang.Object a,
                             java.lang.Object b)
Tests if a String is greater than another
Specified by:
isGreaterThan in interface Comparator
Returns:
true if a lexicographically greater than b, false otherwise.
Throws:
InvalidKeyException - if either parameter is either null or not a String.

isGreaterThanOrEqualTo

public boolean isGreaterThanOrEqualTo(java.lang.Object a,
                                      java.lang.Object b)
Tests if a String is greater than or equal to another
Specified by:
isGreaterThanOrEqualTo in interface Comparator
Returns:
true if a lexicographically greater than or equal to b, false otherwise.
Throws:
InvalidKeyException - if either parameter is either null or not a String.

isLessThan

public boolean isLessThan(java.lang.Object a,
                          java.lang.Object b)
Tests if a String is less than another
Specified by:
isLessThan in interface Comparator
Returns:
true if a lexicographically less than b, false otherwise.
Throws:
InvalidKeyException - if either parameter is either null or not a String.

isLessThanOrEqualTo

public boolean isLessThanOrEqualTo(java.lang.Object a,
                                   java.lang.Object b)
Tests if a String is greater than another
Specified by:
isLessThanOrEqualTo in interface Comparator
Returns:
true if a lexicographically less than or equal to b, false otherwise.
Throws:
InvalidKeyException - if either parameter is either null or not a String.