|
|||||||||
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,java.lang.Boolean> net.sf.jga.fn.comparison.Equality<T> net.sf.jga.fn.comparison.EqualTo<T>
public class EqualTo<T>
Binary Predicate that returns TRUE for object arguments x and y when x == y using the built-in equals() method or an optional Comparator given at construction. By default, this functor will not throw NullPointerException: it will return true if both runtime arguments are null but false if only one is null. If an optional comparator is used, then its implementation will determine if a NullPointerException is thrown when passed a null argument.
To serialize an Equal functor, the comparator passed at construction(if any) must be Serializable.
Copyright © 2002-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
EqualTo.Visitor
Interface for classes that may interpret an EqualTo predicate. |
Constructor Summary | |
---|---|
EqualTo()
Builds an EqualTo that uses the built-in equals method. |
|
EqualTo(java.util.Comparator<? super T> comp)
Builds an EqualTo that uses the given comparator. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(EqualTo) method, if it
implements the nested Visitor interface. |
java.lang.Boolean |
fn(T x,
T y)
Given arguments x and y, returns x.equals(y). |
java.util.Comparator<? super T> |
getComparator()
Returns the comparator in use by this functor, if any. |
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 EqualTo()
public EqualTo(java.util.Comparator<? super T> comp)
Method Detail |
---|
public java.util.Comparator<? super T> getComparator()
public java.lang.Boolean fn(T x, T y)
fn
in class BinaryFunctor<T,T,java.lang.Boolean>
public void accept(Visitor v)
visit(EqualTo)
method, if it
implements the nested Visitor interface.
accept
in interface Visitable
accept
in class Functor<java.lang.Boolean>
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 |