net.sf.jga.fn

Class AbstractUnaryFunctor<T,R>

public abstract class AbstractUnaryFunctor<T,R> extends Object implements UnaryFunctor<T,R>

Provides factory methods that ease the burden of constructing complex functional expressions with UnaryFunctors.

Author: David A. Hall

Method Summary
voidaccept(Visitor v)
No-op implementation of Visitable interface.
<F> UnaryFunctor<F,R>compose(UnaryFunctor<F,T> f)
FactoryMethod that creates a UnaryFunctor that passes its argument to the given functor, and uses the result as the argument to this function.
<F1,F2> BinaryFunctor<F1,F2,R>compose(BinaryFunctor<F1,F2,T> f)
FactoryMethod that creates a BinaryFunctor that passes its arguments to the given functor, and uses the result as the argument to this function.

Method Detail

accept

public void accept(Visitor v)
No-op implementation of Visitable interface.

compose

public <F> UnaryFunctor<F,R> compose(UnaryFunctor<F,T> f)
FactoryMethod that creates a UnaryFunctor that passes its argument to the given functor, and uses the result as the argument to this function. Given argument x, the new functor will return fnthis(f(x)))

compose

public <F1,F2> BinaryFunctor<F1,F2,R> compose(BinaryFunctor<F1,F2,T> f)
FactoryMethod that creates a BinaryFunctor that passes its arguments to the given functor, and uses the result as the argument to this function. Given arguments x and y, the new functor will return fnthis(f(x,y)))