|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.fn.Functor<R> net.sf.jga.fn.BinaryFunctor<T,T,T> net.sf.jga.fn.comparison.Max<T>
public class Max<T>
Binary Functor that returns the greater of two object arguments x and y. The comparison is performed using a comparator supplied at construction time, although a default comparator will be used if the nested Comparable class' default constructor is used. The behaviour of this class in the presence of null arguments is left to the implementation of the specific Comparator, however it is generally safe to assume that using null arguments will cause a NullPointerException to be thrown.
To serialize a Max functor, the comparator passed at construction must be Serializable.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static class |
Max.Comparable<T extends java.lang.Comparable<? super T>>
Max functor for use with Comparable arguments. |
static interface |
Max.Visitor
Interface for classes that may interpret a Max predicate. |
Constructor Summary | |
---|---|
Max(java.util.Comparator<? super T> comp)
Builds a Max functor using the given Comparator |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(Max) method, if it
implements the nested Visitor interface. |
T |
fn(T x,
T y)
Returns the greater of two arguments, or the first if they are equal. |
java.util.Comparator<? super T> |
getComparator()
Returns the comparator in use by this functor |
java.lang.String |
toString()
|
Methods inherited from class net.sf.jga.fn.BinaryFunctor |
---|
bind, bind0th, bind1st, bind2nd, bindNth, compose, compose, composeNth, distribute, eval, generate, generate1st, generate2nd, generateNth |
Methods inherited from class net.sf.jga.fn.Functor |
---|
composeNth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Max(java.util.Comparator<? super T> comp)
java.lang.IllegalArgumentException
- if the argument is nullMethod Detail |
---|
public java.util.Comparator<? super T> getComparator()
public T fn(T x, T y)
fn
in class BinaryFunctor<T,T,T>
public void accept(Visitor v)
visit(Max)
method, if it
implements the nested Visitor interface.
accept
in interface Visitable
accept
in class Functor<T>
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |