net.sf.jga.fn.adaptor
Class AdaptorFunctors

java.lang.Object
  extended by net.sf.jga.fn.adaptor.AdaptorFunctors

public final class AdaptorFunctors
extends java.lang.Object

Static factory methods for selected functors in the Adaptor package.

Copyright © 2006 David A. Hall

Author:
David A. Hall

Constructor Summary
AdaptorFunctors()
           
 
Method Summary
static
<T1,T2> BinaryFunctor<T1,T2,java.lang.Boolean>
and(BinaryFunctor<T1,T2,java.lang.Boolean> uf1, BinaryFunctor<T1,T2,java.lang.Boolean> uf2)
          Returns a Boolean Functor that produces TRUE when both input functors return TRUE for same given pair of arguments.
static Generator<java.lang.Boolean> and(Generator<java.lang.Boolean> g1, Generator<java.lang.Boolean> g2)
          Returns a Boolean Generator that produces TRUE when both input generators return TRUE.
static
<T> UnaryFunctor<T,java.lang.Boolean>
and(UnaryFunctor<T,java.lang.Boolean> uf1, UnaryFunctor<T,java.lang.Boolean> uf2)
          Returns a Boolean Functor that produces TRUE when both input functors return TRUE for same given argument.
static
<T1,T2,R> BinaryFunctor<T1,T2,R>
conditional(BinaryFunctor<T1,T2,java.lang.Boolean> test, BinaryFunctor<T1,T2,R> trueFn)
          Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results.
static
<T1,T2,R> BinaryFunctor<T1,T2,R>
conditional(BinaryFunctor<T1,T2,java.lang.Boolean> test, BinaryFunctor<T1,T2,R> trueFn, BinaryFunctor<T1,T2,R> falseFn)
          Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results.
static
<R> Generator<R>
conditional(Generator<java.lang.Boolean> test, Generator<R> trueFn)
          Returns a generator that evaluates the test and, when true, evaluates the trueFn and returns the results.
static
<R> Generator<R>
conditional(Generator<java.lang.Boolean> test, Generator<R> trueFn, Generator<R> falseFn)
          Returns a generator that evaluates the test and, when true, evaluates the trueFn and returns the results.
static
<T,R> UnaryFunctor<T,R>
conditional(UnaryFunctor<T,java.lang.Boolean> test, UnaryFunctor<T,R> trueFn)
          Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results.
static
<T,R> UnaryFunctor<T,R>
conditional(UnaryFunctor<T,java.lang.Boolean> test, UnaryFunctor<T,R> trueFn, UnaryFunctor<T,R> falseFn)
          Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results.
static
<R> Generator<R>
constant(R value)
           
static
<T1,T2,R> BinaryFunctor<T1,T2,R>
constantBinary(R value)
           
static
<T,R> UnaryFunctor<T,R>
constantUnary(R value)
           
static
<T> UnaryFunctor<T,T>
identity()
           
static
<T1,T2> BinaryFunctor<T1,T2,java.lang.Boolean>
or(BinaryFunctor<T1,T2,java.lang.Boolean> uf1, BinaryFunctor<T1,T2,java.lang.Boolean> uf2)
          Returns a Boolean Functor that produces TRUE when either input functors return TRUE for same given pair of arguments.
static Generator<java.lang.Boolean> or(Generator<java.lang.Boolean> g1, Generator<java.lang.Boolean> g2)
          Returns a Boolean Generator that produces TRUE when either input generators return TRUE.
static
<T> UnaryFunctor<T,java.lang.Boolean>
or(UnaryFunctor<T,java.lang.Boolean> uf1, UnaryFunctor<T,java.lang.Boolean> uf2)
          Returns a Boolean Functor that produces TRUE when either input functors return TRUE for same given argument.
static
<T1,T2> BinaryFunctor<T1,T2,T1>
project1st()
           
static
<T1,T2> BinaryFunctor<T1,T2,T2>
project2nd()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdaptorFunctors

public AdaptorFunctors()
Method Detail

and

public static Generator<java.lang.Boolean> and(Generator<java.lang.Boolean> g1,
                                               Generator<java.lang.Boolean> g2)
Returns a Boolean Generator that produces TRUE when both input generators return TRUE.


and

public static <T> UnaryFunctor<T,java.lang.Boolean> and(UnaryFunctor<T,java.lang.Boolean> uf1,
                                                        UnaryFunctor<T,java.lang.Boolean> uf2)
Returns a Boolean Functor that produces TRUE when both input functors return TRUE for same given argument.


and

public static <T1,T2> BinaryFunctor<T1,T2,java.lang.Boolean> and(BinaryFunctor<T1,T2,java.lang.Boolean> uf1,
                                                                 BinaryFunctor<T1,T2,java.lang.Boolean> uf2)
Returns a Boolean Functor that produces TRUE when both input functors return TRUE for same given pair of arguments.


conditional

public static <R> Generator<R> conditional(Generator<java.lang.Boolean> test,
                                           Generator<R> trueFn)
Returns a generator that evaluates the test and, when true, evaluates the trueFn and returns the results. When the test is false, the generator returns null.


conditional

public static <R> Generator<R> conditional(Generator<java.lang.Boolean> test,
                                           Generator<R> trueFn,
                                           Generator<R> falseFn)
Returns a generator that evaluates the test and, when true, evaluates the trueFn and returns the results. When the test is false, the generator evaluates falseFn and the returns the results


conditional

public static <T,R> UnaryFunctor<T,R> conditional(UnaryFunctor<T,java.lang.Boolean> test,
                                                  UnaryFunctor<T,R> trueFn)
Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results. When the test is false, the functor returns null. Both functors receiv the same argument when evaluated.


conditional

public static <T,R> UnaryFunctor<T,R> conditional(UnaryFunctor<T,java.lang.Boolean> test,
                                                  UnaryFunctor<T,R> trueFn,
                                                  UnaryFunctor<T,R> falseFn)
Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results. When the test is false, the functor evaluates falseFn and the returns the results. Both functors that are evaluated receive the same pair of arguments.


conditional

public static <T1,T2,R> BinaryFunctor<T1,T2,R> conditional(BinaryFunctor<T1,T2,java.lang.Boolean> test,
                                                           BinaryFunctor<T1,T2,R> trueFn)
Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results. When the test is false, the functor returns null. Both functors receive the same pair of arguments when valuated.


conditional

public static <T1,T2,R> BinaryFunctor<T1,T2,R> conditional(BinaryFunctor<T1,T2,java.lang.Boolean> test,
                                                           BinaryFunctor<T1,T2,R> trueFn,
                                                           BinaryFunctor<T1,T2,R> falseFn)
Returns a functor that evaluates the test and, when true, evaluates the trueFn and returns the results. When the test is false, the functor evaluates falseFn and the returns the results. Both functors that are evaluated receive the same pair of arguments.


constant

public static <R> Generator<R> constant(R value)

constantUnary

public static <T,R> UnaryFunctor<T,R> constantUnary(R value)

constantBinary

public static <T1,T2,R> BinaryFunctor<T1,T2,R> constantBinary(R value)

identity

public static <T> UnaryFunctor<T,T> identity()

or

public static Generator<java.lang.Boolean> or(Generator<java.lang.Boolean> g1,
                                              Generator<java.lang.Boolean> g2)
Returns a Boolean Generator that produces TRUE when either input generators return TRUE.


or

public static <T> UnaryFunctor<T,java.lang.Boolean> or(UnaryFunctor<T,java.lang.Boolean> uf1,
                                                       UnaryFunctor<T,java.lang.Boolean> uf2)
Returns a Boolean Functor that produces TRUE when either input functors return TRUE for same given argument.


or

public static <T1,T2> BinaryFunctor<T1,T2,java.lang.Boolean> or(BinaryFunctor<T1,T2,java.lang.Boolean> uf1,
                                                                BinaryFunctor<T1,T2,java.lang.Boolean> uf2)
Returns a Boolean Functor that produces TRUE when either input functors return TRUE for same given pair of arguments.


project1st

public static <T1,T2> BinaryFunctor<T1,T2,T1> project1st()

project2nd

public static <T1,T2> BinaryFunctor<T1,T2,T2> project2nd()


Copyright © 2002-2006 David A. Hall. All Rights Reserved.