All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.compare.ReverseOrderComparer

java.lang.Object
   |
   +----sdsu.compare.Comparer
           |
           +----sdsu.compare.ReverseOrderComparer

public class ReverseOrderComparer
extends Comparer
A comparer to reverse the order used by a Comparer. For example, an IntegerComparer will evaluate lessThen( 3, 10 ) as true. A ReverseOrder on an IntegerComparer will evaluate lessThen( 3, 10 ) as false. Useful for reversing the order of a sort list.

Author:
Roger Whitney (whitney@cs.sdsu.edu)

Method Index

 o equals(Object, Object)
Returns true if the leftOperand is equal to the rightOperand.
 o getInstance(Comparer)
Returns a Comparer with order reversed from the Comparer originalOrder.
 o greaterThan(Object, Object)
Returns true if the leftOperand is greater than the rightOperand.
 o greaterThanOrEqual(Object, Object)
Returns true if the leftOperand is greater than or equal the rightOperand.
 o lessThan(Object, Object)
Returns true if the leftOperand is less than the rightOperand.
 o lessThanOrEqual(Object, Object)
Returns true if the leftOperand is less than or equal to the rightOperand.

Methods

 o getInstance
 public static Comparer getInstance(Comparer originalOrder)
Returns a Comparer with order reversed from the Comparer originalOrder. If originalOrder is already aReverseOrder object, the ReversOrder objects are not nested. The Comparer inside of the originalOrder is used directly

 o lessThan
 public final boolean lessThan(Object leftOperand,
                               Object rightOperand) throws ClassCastException
Returns true if the leftOperand is less than the rightOperand.

Throws: ClassCastException
If operand objects are not proper type. ClassCastException is a RuntimeException, so compiler does not force you to catch this exception.
Overrides:
lessThan in class Comparer
 o greaterThan
 public final boolean greaterThan(Object leftOperand,
                                  Object rightOperand) throws ClassCastException
Returns true if the leftOperand is greater than the rightOperand.

Throws: ClassCastException
If operand objects are not proper type. ClassCastException is a RuntimeException, so compiler does not force you to catch this exception.
Overrides:
greaterThan in class Comparer
 o equals
 public final boolean equals(Object leftOperand,
                             Object rightOperand) throws ClassCastException
Returns true if the leftOperand is equal to the rightOperand.

Throws: ClassCastException
If operand objects are not proper type. ClassCastException is a RuntimeException, so compiler does not force you to catch this exception.
Overrides:
equals in class Comparer
 o lessThanOrEqual
 public final boolean lessThanOrEqual(Object leftOperand,
                                      Object rightOperand) throws ClassCastException
Returns true if the leftOperand is less than or equal to the rightOperand.

Throws: ClassCastException
If operand objects are not proper type. ClassCastException is a RuntimeException, so compiler does not force you to catch this exception.
Overrides:
lessThanOrEqual in class Comparer
 o greaterThanOrEqual
 public final boolean greaterThanOrEqual(Object leftOperand,
                                         Object rightOperand) throws ClassCastException
Returns true if the leftOperand is greater than or equal the rightOperand.

Throws: ClassCastException
If operand objects are not proper type. ClassCastException is a RuntimeException, so compiler does not force you to catch this exception.
Overrides:
greaterThanOrEqual in class Comparer

All Packages  Class Hierarchy  This Package  Previous  Next  Index