com.sas.util
Class Java2ComparatorAdapter

com.sas.util.Java2ComparatorAdapter
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator

public class Java2ComparatorAdapter
implements com.sas.util.Comparator, java.io.Serializable

An adaptor that allows a Comparator to be used where a Comparator is required.

Since:
2.0
See Also:
Serialized Form

Field Summary
protected  java.util.Comparator comparator
           
 
Fields inherited from interface com.sas.util.Comparator
EQUALS, GREATER_THAN, INCOMPARABLE, LESS_THAN
 
Constructor Summary
Java2ComparatorAdapter()
          A default constructor.
Java2ComparatorAdapter(java.util.Comparator comparator)
          Construct a Java2Comparator which delegates the Comparator.compare(Object,Object) method to an object that implements
Method Summary
 int compare(java.lang.Object a, java.lang.Object b)
           
 java.util.Comparator getComparator()
          Return the current comparator.
 void setComparator(java.util.Comparator comparator)
          Set the comparator.
 

Field Detail

comparator

protected java.util.Comparator comparator
Constructor Detail

Java2ComparatorAdapter

public Java2ComparatorAdapter()
A default constructor. You must use setComparator(java.util.Comparator) before using this comparator.


Java2ComparatorAdapter

public Java2ComparatorAdapter(java.util.Comparator comparator)
Construct a Java2Comparator which delegates the Comparator.compare(Object,Object) method to an object that implements Comparator

Parameters:
comparator - a comparison object
Method Detail

compare

public int compare(java.lang.Object a,
                   java.lang.Object b)
Specified by:
compare in interface java.util.Comparator

setComparator

public void setComparator(java.util.Comparator comparator)
Set the comparator.

Parameters:
comparator - the new comparator.

getComparator

public java.util.Comparator getComparator()
Return the current comparator.

Returns:
the current comparator.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.