net.sf.jga.fn.adaptor
Class OrGenerator

java.lang.Object
  extended by net.sf.jga.fn.Functor<R>
      extended by net.sf.jga.fn.Generator<java.lang.Boolean>
          extended by net.sf.jga.fn.adaptor.OrGenerator
All Implemented Interfaces:
java.io.Serializable, Visitable

public class OrGenerator
extends Generator<java.lang.Boolean>

Generator that performs a shortcircuit or 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 OrGenerator.Visitor
          Interface for classes that may interpret an OrGenerator predicate.
 
Constructor Summary
OrGenerator(Generator<java.lang.Boolean> first, Generator<java.lang.Boolean> second)
          Builds a OrGenerator functor, given the two functors that may be executed.
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(OrGenerator) method, if it implements the nested Visitor interface.
 java.lang.Boolean fn()
          Generate one instance.
 Generator<java.lang.Boolean> getFirstFunctor()
           
 Generator<java.lang.Boolean> getSecondFunctor()
           
 java.lang.String toString()
           
 
Methods inherited from class net.sf.jga.fn.Generator
bind0th, bindNth, eval
 
Methods inherited from class net.sf.jga.fn.Functor
composeNth, composeNth, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrGenerator

public OrGenerator(Generator<java.lang.Boolean> first,
                   Generator<java.lang.Boolean> second)
Builds a OrGenerator functor, given the two functors that may be executed.

Throws:
java.lang.IllegalArgumentException - if any of the functors is missing
Method Detail

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(OrGenerator) 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.