|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.javelot.functionalj.Function
info.javelot.functionalj.ReflectionFunction
info.javelot.functionalj.MethodFunction
info.javelot.functionalj.ComposedFunction
Combines two functions where the result of one function is used as a parameter to the other function.
| Field Summary |
| Fields inherited from class info.javelot.functionalj.Function |
m_class, m_name, m_object, m_parameters, m_targets |
| Constructor Summary | |
ComposedFunction(Function p_f,
Function p_g)
Constructs a composed function with two functions, such that, given functions f and g, the resulting function is
f o g, where 'o' is the composing operator as used
in mathematics. |
|
ComposedFunction(Function p_f,
Function p_g,
Function p_h)
Constructs a composed function with two functions, such that, given functions f, g and h, the resulting function is
f o g o h, where 'o' is the composing operator as
used in mathematics. |
|
| Method Summary | |
Function |
addParameters(Object[] p_parameters)
Returns a new ComposedFunction with the original f
function, and a new g function on which the
addParameters(Object[]) has been invoked. |
Object |
call()
Invokes call() on the g function, supplies the
result to the f function using
objectOrParameter(Object), invokes call() on the
resulting function, and returns the result. |
boolean |
isObjectPresent()
Returns the value of g.isObjectPresent(). |
boolean |
isObjectRequired()
Returns the value of g.isObjectRequired(). |
protected Function |
newInstance(Class p_class,
Object[] p_parameters)
Returns a new ComposedFunction object with the same
f function and the value of
g.newInstance(Class,Object[]), using g's target
class. |
Function |
object(Object p_object)
Returns a new ComposedFunction with the original f
function, and a new g function on which the
object(Object) has been invoked. |
String |
toString()
Returns a String representation of the Function objects of which this
function is composed. |
| Methods inherited from class info.javelot.functionalj.MethodFunction |
getAllTargets, getInsertIndex, getParameterTypes, invoke |
| Methods inherited from class info.javelot.functionalj.Function |
addParameter, addParameters, addParameters, addParameters, addParameters, getName, getObject, getParameters, getTargetClass, getTargets, objectOrParameter |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ComposedFunction(Function p_f,
Function p_g)
throws FunctionException
f and g, the resulting function is
f o g, where 'o' is the composing operator as used
in mathematics. Therefore, calling the resulting function is equivalent to
calling f.objectOrParameter(g.call()).call().
FunctionException - thrown if either of the two functions supplied is
null.
public ComposedFunction(Function p_f,
Function p_g,
Function p_h)
throws FunctionException
f, g and h, the resulting function is
f o g o h, where 'o' is the composing operator as
used in mathematics. Therefore, calling the resulting function is equivalent
to calling
f.objectOrParameter(g.objectOrParameter(h.call()).call()).call().
FunctionException - thrown if either of the three functions supplied
is null.| Method Detail |
public boolean isObjectRequired()
g.isObjectRequired().
isObjectRequired in class FunctionisObjectRequired() of the
g function.public boolean isObjectPresent()
g.isObjectPresent().
isObjectPresent in class FunctionisObjectPresent() of the
g function.
protected Function newInstance(Class p_class,
Object[] p_parameters)
ComposedFunction object with the same
f function and the value of
g.newInstance(Class,Object[]), using g's target
class.
newInstance in class Functionp_class - the class of the target.p_parameters - the parameters that have been supplied.
ComposedFunction object with the same
f function and the value returned by
newInstance(Class,Object[]) of the g function using
g's target class.
public Function addParameters(Object[] p_parameters)
throws FunctionException
ComposedFunction with the original f
function, and a new g function on which the
addParameters(Object[]) has been invoked.
addParameters in class Functionp_parameters - the parameters to be added to the list of parameters that
are supplied to the function.
FunctionException - thrown if the additional parameters cause the
list of supplied parameters not to match any of the possible targets.
public Function object(Object p_object)
throws FunctionException
ComposedFunction with the original f
function, and a new g function on which the
object(Object) has been invoked.
object in class FunctionFunctionException
public Object call()
throws FunctionException
call() on the g function, supplies the
result to the f function using
objectOrParameter(Object), invokes call() on the
resulting function, and returns the result.
call in class ReflectionFunctionf.objectOrParameter(g.call()).call().
FunctionException - thrown if an exception occurs when invoking the
target, if an object on which to invoke the target is required but none has
been supplied, or if all of the potential targets expect more parameters than
have been supplied.public String toString()
Function objects of which this
function is composed.
toString in class FunctionFunction objects of which this
function is composed, by calling Function.toString() on each function.Function.toString().
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||