net.sf.jga.fn.comparison
public class ComparatorFn<T> extends AbstractBinaryFunctor<T,T,Integer> implements Comparator<T>, Serializable
Copyright © 2002 David A. Hall
Nested Class Summary | |
---|---|
interface | ComparatorFn.Visitor
Interface for classes that may interpret a ComparatorFn functor. |
Constructor Summary | |
---|---|
ComparatorFn(Comparator<T> comp)
Builds the ComparatorFn wrapped around the given Comparator.
|
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(ComperatorFn) method, if it
implements the nested Visitor interface. |
int | compare(T x, T y) |
Integer | fn(T x, T y)
Given arguments x and y, return the result of the
Comparator's compare(x,y) method, wrapped in an Integer.
|
Comparator<T> | getComparator()
Returns the comparator in use by this functor |
String | toString() |
Throws: NullPointerException if no Comparator is passed.
visit(ComperatorFn)
method, if it
implements the nested Visitor interface.compare(x,y)
method, wrapped in an Integer.
Whether or not a NullPointerException is thrown if either x or y are
null is up to the Comparator
Returns: the result of the Comparator's compare(x,y)
method