Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.comparators
Class GeneralComparator

java.lang.Object
  extended by com.sciapp.comparators.GeneralComparator
All Implemented Interfaces:
Serializable, Comparator

public class GeneralComparator
extends Object
implements Comparator, Serializable

GeneralComparator compares two objects that implement the Comparable interface.

See Also:
Serialized Form

Constructor Summary
GeneralComparator()
           
 
Method Summary
 int compare(Object o1, Object o2)
          Compares its two arguments for order as defined by compare of the Comparator interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

GeneralComparator

public GeneralComparator()
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares its two arguments for order as defined by compare of the Comparator interface. o1 and o2 must implement the Comparable interface, otherwise this method throws a ClassCastException.

This method casts o1 to Comparable and compares it to o2, thus the same rules apply as for the compareTo method of the Comparable interface.

Specified by:
compare in interface Comparator
Parameters:
o1 - the first object to be compared.
o2 - the second object to be compared.
Returns:
a negative integer, zero or a positive integer as o1 is less than, equal to, or greater than o2.

Copyright © 2005 Scientific Applications. All Rights Reserved.