net.sf.jga.fn.adaptor
Class AndGenerator
java.lang.Object
net.sf.jga.fn.Functor<R>
net.sf.jga.fn.Generator<java.lang.Boolean>
net.sf.jga.fn.adaptor.AndGenerator
- All Implemented Interfaces:
- java.io.Serializable, Visitable
public class AndGenerator
- extends Generator<java.lang.Boolean>
Generator that performs a shortcircuit and operation using a given pair
of Boolean Generators. When the first generator returns true, the second
is not evaluated.
- See Also:
- Serialized Form
Nested Class Summary |
static interface |
AndGenerator.Visitor
Interface for classes that may interpret an AndGenerator predicate. |
Constructor Summary |
AndGenerator(Generator<java.lang.Boolean> first,
Generator<java.lang.Boolean> second)
Builds a AndGenerator functor, given the two functors that may be executed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AndGenerator
public AndGenerator(Generator<java.lang.Boolean> first,
Generator<java.lang.Boolean> second)
- Builds a AndGenerator functor, given the two functors that may be executed.
- Throws:
java.lang.IllegalArgumentException
- if any of the functors is missing
getFirstFunctor
public Generator<java.lang.Boolean> getFirstFunctor()
getSecondFunctor
public Generator<java.lang.Boolean> getSecondFunctor()
fn
public java.lang.Boolean fn()
- Description copied from class:
Generator
- Generate one instance.
- Specified by:
fn
in class Generator<java.lang.Boolean>
accept
public void accept(Visitor v)
- Calls the Visitor's
visit(AndGenerator)
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.