net.sf.jga.fn.adaptor
Class OrUnary<T>
java.lang.Object
net.sf.jga.fn.Functor<R>
net.sf.jga.fn.UnaryFunctor<T,java.lang.Boolean>
net.sf.jga.fn.adaptor.OrUnary<T>
- All Implemented Interfaces:
- java.io.Serializable, Visitable
public class OrUnary<T>
- extends UnaryFunctor<T,java.lang.Boolean>
Unary that performs a shortcircuit or operation using a given pair of
Boolean UnaryFunctors. When the first functor returns true, the second
is not evaluated.
- See Also:
- Serialized Form
Nested Class Summary |
static interface |
OrUnary.Visitor
Interface for classes that may interpret an OrUnaryFunctor predicate. |
Constructor Summary |
OrUnary(UnaryFunctor<T,java.lang.Boolean> first,
UnaryFunctor<T,java.lang.Boolean> second)
Builds a OrUnary functor, given the two functors that may be executed. |
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 |
OrUnary
public OrUnary(UnaryFunctor<T,java.lang.Boolean> first,
UnaryFunctor<T,java.lang.Boolean> second)
- Builds a OrUnary functor, given the two functors that may be executed.
- Throws:
java.lang.IllegalArgumentException
- if any of the functors is missing
getFirstFunctor
public UnaryFunctor<T,java.lang.Boolean> getFirstFunctor()
getSecondFunctor
public UnaryFunctor<T,java.lang.Boolean> getSecondFunctor()
fn
public java.lang.Boolean fn(T arg)
- Description copied from class:
UnaryFunctor
- Executes the function and returns the result.
- Specified by:
fn
in class UnaryFunctor<T,java.lang.Boolean>
accept
public void accept(Visitor v)
- Calls the Visitor's
visit(OrUnary)
method, if it
implements the nested Visitor interface.
- Specified by:
accept
in interface Visitable
- Overrides:
accept
in class Functor<java.lang.Boolean>
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2002-2006 David A. Hall. All Rights Reserved.