info.javelot.functionalj
Class FunctionNImpl

java.lang.Object
  extended byinfo.javelot.functionalj.FunctionNImpl
All Implemented Interfaces:
FunctionN
Direct Known Subclasses:
StdReflectFunction

public abstract class FunctionNImpl
extends Object
implements FunctionN

A base implementation of the FunctionN interface, which implements all methods except for the FunctionN.call(Object[]) method - that is left to subclasses to implement in order to define a function of N parameters.

Author:
Copyright © 2006 Frederic Daoud

Constructor Summary
FunctionNImpl()
           
 
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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.javelot.functionalj.FunctionN
call
 

Constructor Detail

FunctionNImpl

public FunctionNImpl()
Method Detail

bind

public FunctionN bind(Object[] p_params)
Description copied from interface: FunctionN
Binds the given M parameters of this function of N parameters to return a new function of (N-M) parameters.

Specified by:
bind in interface FunctionN
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)
Description copied from interface: FunctionN
Binds, at the specified index, the given parameter of this function of N parameters to return a new function of (N-1) parameters.

Specified by:
bind in interface FunctionN
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.

call

public Object call()
            throws FunctionException
Description copied from interface: FunctionN
Calls the function and returns the result.

Specified by:
call in interface FunctionN
Returns:
the result of the function call.
Throws:
FunctionException - thrown if an exception occurs during the function call.

f0

public Function0 f0()
Description copied from interface: FunctionN
Returns this function as a function of no parameters.

Specified by:
f0 in interface FunctionN
Returns:
this function of N parameters as a function of no parameters.

f1

public Function1 f1()
Description copied from interface: FunctionN
Returns this function as a function of 1 parameter.

Specified by:
f1 in interface FunctionN
Returns:
this function of N parameters as a function of 1 parameter.

f2

public Function2 f2()
Description copied from interface: FunctionN
Returns this function as a function of 2 parameters.

Specified by:
f2 in interface FunctionN
Returns:
this function of N parameters as a function of 2 parameters.

f3

public Function3 f3()
Description copied from interface: FunctionN
Returns this function as a function of 3 parameters.

Specified by:
f3 in interface FunctionN
Returns:
this function of N parameters as a function of 3 parameters.

f4

public Function4 f4()
Description copied from interface: FunctionN
Returns this function as a function of 4 parameters.

Specified by:
f4 in interface FunctionN
Returns:
this function of N parameters as a function of 4 parameters.