sdsu.compare
Class Comparer
java.lang.Object
|
+--sdsu.compare.Comparer
- Direct Known Subclasses:
- DoubleComparer, FloatComparer, IntegerComparer, LetterGradeComparer, LinearOrderComparer, LongComparer, MethodComparer, NumericStringComparer, ReverseOrderComparer, StringComparer, StringIgnoreCaseComparer
- public abstract class Comparer
- extends java.lang.Object
- implements java.io.Serializable
This abstract class defines an interface for comparing objects.
You only need to override the compare method, as the default
implementation of all other methods use compare.
However, for effeciency reasons you may wish to override more than compare.
- Version:
- 1.0 4 June 1997
- Author:
- Roger Whitney (whitney@cs.sdsu.edu)
- See Also:
- Serialized Form
Method Summary |
abstract boolean |
equals(java.lang.Object leftOperand,
java.lang.Object rightOperand)
Returns true if the leftOperand is equal to the rightOperand. |
abstract boolean |
greaterThan(java.lang.Object leftOperand,
java.lang.Object rightOperand)
Returns true if the leftOperand is greater than the rightOperand. |
boolean |
greaterThanOrEqual(java.lang.Object leftOperand,
java.lang.Object rightOperand)
Returns true if the leftOperand is greater than or equal the rightOperand. |
abstract boolean |
lessThan(java.lang.Object leftOperand,
java.lang.Object rightOperand)
Returns true if the leftOperand is less than the rightOperand. |
boolean |
lessThanOrEqual(java.lang.Object leftOperand,
java.lang.Object rightOperand)
Returns true if the leftOperand is less than or equal to the rightOperand. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Comparer
public Comparer()
lessThan
public abstract boolean lessThan(java.lang.Object leftOperand,
java.lang.Object rightOperand)
throws java.lang.ClassCastException
- Returns true if the leftOperand is less than the rightOperand.
- Throws:
- java.lang.ClassCastException - If operand objects are not proper type.
ClassCastException is a RuntimeException, so compiler does not force you
to catch this exception.
greaterThan
public abstract boolean greaterThan(java.lang.Object leftOperand,
java.lang.Object rightOperand)
throws java.lang.ClassCastException
- Returns true if the leftOperand is greater than the rightOperand.
- Throws:
- java.lang.ClassCastException - If operand objects are not proper type.
ClassCastException is a RuntimeException, so compiler does not force you
to catch this exception.
equals
public abstract boolean equals(java.lang.Object leftOperand,
java.lang.Object rightOperand)
throws java.lang.ClassCastException
- Returns true if the leftOperand is equal to the rightOperand.
- Throws:
- java.lang.ClassCastException - If operand objects are not proper type.
ClassCastException is a RuntimeException, so compiler does not force you
to catch this exception.
lessThanOrEqual
public boolean lessThanOrEqual(java.lang.Object leftOperand,
java.lang.Object rightOperand)
throws java.lang.ClassCastException
- Returns true if the leftOperand is less than or equal to the rightOperand.
- Throws:
- java.lang.ClassCastException - If operand objects are not proper type.
ClassCastException is a RuntimeException, so compiler does not force you
to catch this exception.
greaterThanOrEqual
public boolean greaterThanOrEqual(java.lang.Object leftOperand,
java.lang.Object rightOperand)
throws java.lang.ClassCastException
- Returns true if the leftOperand is greater than or equal the rightOperand.
- Throws:
- java.lang.ClassCastException - If operand objects are not proper type.
ClassCastException is a RuntimeException, so compiler does not force you
to catch this exception.