info.javelot.functionalj
Interface FunctionN

All Known Implementing Classes:
DynReflectFunction, FunctionNImpl

public interface FunctionN

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 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 bind(Object[] p_params)
          Binds the given M parameters of this function of N parameters to return a new function of (N-M) parameters.
 Object call()
          Calls the function and returns the result.
 Object call(Object[] p_params)
          Calls the function and returns the result.
 Function0 f0()
          Returns this function as a function of no parameters.
 Function1 f1()
          Returns this function as a function of 1 parameter.
 Function2 f2()
          Returns this function as a function of 2 parameters.
 Function3 f3()
          Returns this function as a function of 3 parameters.
 Function4 f4()
          Returns this function as a function of 4 parameters.
 

Method Detail

call

public Object 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

public Object 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

public FunctionN 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

public FunctionN 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

public Function0 f0()
Returns this function as a function of no parameters.

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

f1

public Function1 f1()
Returns this function as a function of 1 parameter.

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

f2

public Function2 f2()
Returns this function as a function of 2 parameters.

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

f3

public Function3 f3()
Returns this function as a function of 3 parameters.

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

f4

public Function4 f4()
Returns this function as a function of 4 parameters.

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