|
|||||||||
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.UnaryFunctor<T,java.lang.Boolean> net.sf.jga.fn.logical.Any<T>
public class Any<T>
Unary Predicate that returns true when one of 0 or more branch predicates returns true. When the collection of branch predicates is empty, an Any predicate will return false (somewhat arbitrarily). This predicate will short circuit: once one of the branches returns true, none of the subsequent branches will be evaluated.
The order of evaluation is dependant on the type of collection used: when using the default constructor, the collection used is a list, and branch predicates will be evaluated in the order given.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
Any.Visitor
Interface for classes that may interpret an Any predicate. |
Constructor Summary | |
---|---|
Any()
Builds the Any predicate with an empty default collection of branch predicates. |
|
Any(java.util.Collection<UnaryFunctor<T,java.lang.Boolean>> branches)
Builds the Any predicate with the given collection of branch predicates. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(Any) method, if it
implements the nested Visitor interface. |
java.util.Iterator<UnaryFunctor<T,java.lang.Boolean>> |
branches()
Returns an Iterator over the branch predicates. |
java.lang.Boolean |
fn(T x)
Given arguments x, returns true if at least one branch predicate returns true when given x. |
java.lang.String |
toString()
|
Methods inherited from class net.sf.jga.fn.UnaryFunctor |
---|
bind, bind0th, bindNth, compose, compose, compose, composeNth, composeNth, eval, generate, generateNth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Any()
public Any(java.util.Collection<UnaryFunctor<T,java.lang.Boolean>> branches)
Method Detail |
---|
public java.util.Iterator<UnaryFunctor<T,java.lang.Boolean>> branches()
public java.lang.Boolean fn(T x)
fn
in class UnaryFunctor<T,java.lang.Boolean>
public void accept(Visitor v)
visit(Any)
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 |