com.isti.util
Class ListComparator

java.lang.Object
  extended bycom.isti.util.ListComparator
All Implemented Interfaces:
java.util.Comparator

public class ListComparator
extends java.lang.Object
implements java.util.Comparator

Class ListComparator implements a comparator that determines order using a given list of objects.


Field Summary
protected  java.util.List comparatorListObj
           
protected  int comparatorListSize
           
 
Constructor Summary
ListComparator(java.util.List listObj)
          Creates a comparator that determines order using the given list of objects.
ListComparator(java.lang.Object[] objArr)
          Creates a comparator that determines order using the given array of objects.
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
          Compares its two arguments for order via their position in the list.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this Comparator.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparatorListObj

protected final java.util.List comparatorListObj

comparatorListSize

protected final int comparatorListSize
Constructor Detail

ListComparator

public ListComparator(java.util.List listObj)
Creates a comparator that determines order using the given list of objects.

Parameters:
listObj - the list of objects to use.

ListComparator

public ListComparator(java.lang.Object[] objArr)
Creates a comparator that determines order using the given array of objects.

Parameters:
objArr - the array of objects to use.
Method Detail

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
Compares its two arguments for order via their position in the list. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. If an object is not found in the list then it is considered to be "after" all objects that are in the list.

Specified by:
compare in interface java.util.Comparator
Parameters:
obj1 - the first object to be compared.
obj2 - the second object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Throws:
java.lang.ClassCastException - if the arguments' types prevent them from being compared by this Comparator.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this Comparator.

Specified by:
equals in interface java.util.Comparator
Parameters:
obj - the reference object with which to compare.
Returns:
true only if the specified object is also a comparator and it imposes the same ordering as this comparator.