| net.sf.jga.fn.comparison.ComparatorFn
ComparatorFn | public class ComparatorFn extends BinaryFunctor implements Comparator<T>(Code) | | Functor wrapper around Comparator object. Allows Comparators to be used
anywhere a Functor returning an Integer could have been used. Also
implements Comparator as well, so an instance of this class could be used
anywhere that the constructor argument could be used.
To Serialize a ComparatorFn, the Comparator given at construction must be
Serializable.
Copyright © 2002-2005 David A. Hall
author: David A. Hall |
Constructor Summary | |
public | ComparatorFn(Comparator<T> comp) Builds the ComparatorFn wrapped around the given Comparator. |
serialVersionUID | final static long serialVersionUID(Code) | | |
accept | public void accept(net.sf.jga.fn.Visitor v)(Code) | | Calls the Visitor's visit(ComperatorFn) method, if it
implements the nested Visitor interface.
|
compare | public int compare(T x, T y)(Code) | | |
fn | public Integer fn(T x, T y)(Code) | | Given arguments x and y, return the result of the
Comparator's 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
the result of the Comparator's compare(x,y) method |
getComparator | public Comparator<T> getComparator()(Code) | | Returns the comparator in use by this functor
|
|
|