net.sf.jga.fn

Interface UnaryFunctor<T,R>

public interface UnaryFunctor<T,R> extends Serializable, Visitable

A Function Object that takes one argument and returns a result. The argument is of type T, and the result is of type R

Copyright © 2002 David A. Hall

Author: David A. Hall

Method Summary
<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.
Rfn(T arg)
Executes the function and returns the result.

Method Detail

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 code>fnthis(f(x,y)))

fn

public R fn(T arg)
Executes the function and returns the result.