info.javelot.functionalj
Interface FunctionN<R>

Type Parameters:
R - the type of the result returned by the function.
All Known Implementing Classes:
DynReflectFunction, FunctionNImpl, StdReflectFunction

public interface FunctionN<R>

Interface that represents a function of an arbitrary number of parameters.

This interface also serves as a bridge between the functions obtained using reflection and the typed functions (Function0..4) used in the rest of the library.

Author:
Copyright © 2006 Frederic Daoud

Method Summary
 FunctionN<R> bind(int p_index, Object p_param)
          Binds, at the specified index, the given parameter of this function of N parameters to return a new function of (N-1) parameters.
 FunctionN<R> bind(Object... p_params)
          Binds the given M parameters of this function of N parameters to return a new function of (N-M) parameters.
 R call()
          Calls the function and returns the result.
 R call(Object... p_params)
          Calls the function and returns the result.
 Function0<R> f0()
          Returns this function as a function of no parameters.
 Function1<R,Object> f1()
          Returns this function as a function of 1 parameter.
 Function2<R,Object,Object> f2()
          Returns this function as a function of 2 parameters.
 Function3<R,Object,Object,Object> f3()
          Returns this function as a function of 3 parameters.
 Function4<R,Object,Object,Object,Object> f4()
          Returns this function as a function of 4 parameters.
 

Method Detail

call

R call(Object... p_params)
       throws FunctionException
Calls the function and returns the result.

Parameters:
p_params - the parameters to the function.
Returns:
the result of the function call.
Throws:
FunctionException - thrown if an exception occurs during the function call.

call

R call()
       throws FunctionException
Calls the function and returns the result.

Returns:
the result of the function call.
Throws:
FunctionException - thrown if an exception occurs during the function call.

bind

FunctionN<R> bind(Object... p_params)
Binds the given M parameters of this function of N parameters to return a new function of (N-M) parameters.

Parameters:
p_params - the M parameters to bind to the function.
Returns:
a new function of (N-M) parameters.

bind

FunctionN<R> bind(int p_index,
                  Object p_param)
Binds, at the specified index, the given parameter of this function of N parameters to return a new function of (N-1) parameters.

Parameters:
p_index - the index at which to bind the parameter.
p_param - the parameter to bind to the function.
Returns:
a new function of (N-1) parameters.

f0

Function0<R> f0()
Returns this function as a function of no parameters.

Returns:
this function of N parameters as a function of no parameters.

f1

Function1<R,Object> f1()
Returns this function as a function of 1 parameter.

Returns:
this function of N parameters as a function of 1 parameter.

f2

Function2<R,Object,Object> f2()
Returns this function as a function of 2 parameters.

Returns:
this function of N parameters as a function of 2 parameters.

f3

Function3<R,Object,Object,Object> f3()
Returns this function as a function of 3 parameters.

Returns:
this function of N parameters as a function of 3 parameters.

f4

Function4<R,Object,Object,Object,Object> f4()
Returns this function as a function of 4 parameters.

Returns:
this function of N parameters as a function of 4 parameters.