|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--xxl.functions.Function
A Function can be used to pass a Function-parameter to a method.
| Field Summary | |
static Function |
IDENTITY
The prototype function returns the argument (identity-function). |
| Constructor Summary | |
Function()
|
|
| Method Summary | |
Function |
concatenate(Function[] functions)
Creates a new function by concatenating an array of functions with this function. |
java.lang.Object |
invoke()
Returns the function value. |
java.lang.Object |
invoke(java.lang.Object argument)
Returns the function value. |
java.lang.Object |
invoke(java.lang.Object[] arguments)
Returns the function value. |
java.lang.Object |
invoke(java.lang.Object argument0,
java.lang.Object argument1)
Returns the function value. |
java.lang.Object |
returnFirst(java.util.Iterator iterator)
Returns the first function value (function takes 1 argument). |
java.lang.Object |
returnFirst(java.util.Iterator[] iterators)
Returns the first function value (function takes m arguments). |
java.lang.Object |
returnFirst(java.util.Iterator iterator0,
java.util.Iterator iterator1)
Returns the first function value (function takes 2 arguments). |
java.lang.Object |
returnLast(java.util.Iterator iterator)
Returns the last function value (function takes 1 argument). |
java.lang.Object |
returnLast(java.util.Iterator[] iterators)
Returns the last function value (function takes m arguments). |
java.lang.Object |
returnLast(java.util.Iterator iterator0,
java.util.Iterator iterator1)
Returns the last function value (function takes 2 arguments). |
java.lang.Object |
returnNth(java.util.Iterator[] iterators,
int n)
Returns the n-th function value (function takes m arguments). |
java.lang.Object |
returnNth(java.util.Iterator iterator,
int n)
Returns the n-th function value (function takes 1 argument). |
java.lang.Object |
returnNth(java.util.Iterator iterator0,
java.util.Iterator iterator1,
int n)
Returns the n-th function value (function takes 2 arguments). |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final Function IDENTITY
| Constructor Detail |
public Function()
| Method Detail |
public java.lang.Object invoke(java.lang.Object[] arguments)
arguments.length and
calls the appropriate invoke-method (see below). The other
invoke-methods call this method. This means, that
the user either has to overwrite this method or one (!) of the
other invoke()-methods.
implementation:
switch (arguments.length) {
case 0:
return invoke();
case 1:
return invoke(arguments[0]);
case 2:
return invoke(arguments[0], arguments[1]);
default:
return null;
}
arguments - the arguments to the functionpublic java.lang.Object invoke()
implementation: return invoke(new Object[0]);
public java.lang.Object invoke(java.lang.Object argument)
implementation:
return invoke(new Object [] {argument});
argument - the argument to the function
public java.lang.Object invoke(java.lang.Object argument0,
java.lang.Object argument1)
implementation:
return invoke(new Object [] {argument0, argument1});
argument0 - the first argument to the functionargument1 - the second argument to the function
public java.lang.Object returnFirst(java.util.Iterator iterator)
throws java.util.NoSuchElementException
iterator - Iterator of arguments to the function
public java.lang.Object returnFirst(java.util.Iterator[] iterators)
throws java.util.NoSuchElementException
iterators - Iterator-array of arguments to the function. array.length should correspond to the number of arguments of the function
public java.lang.Object returnFirst(java.util.Iterator iterator0,
java.util.Iterator iterator1)
throws java.util.NoSuchElementException
iterator0 - first Iterator of arguments to the functioniterator1 - second Iterator of arguments to the function
public java.lang.Object returnLast(java.util.Iterator iterator)
throws java.util.NoSuchElementException
iterator - Iterator of arguments to the function
public java.lang.Object returnLast(java.util.Iterator[] iterators)
throws java.util.NoSuchElementException
iterators - Iterator-array of arguments to the function. array.length should correspond to the number of arguments of the function
public java.lang.Object returnLast(java.util.Iterator iterator0,
java.util.Iterator iterator1)
throws java.util.NoSuchElementException
iterator0 - first Iterator of arguments to the functioniterator1 - second Iterator of arguments to the function
public java.lang.Object returnNth(java.util.Iterator iterator,
int n)
throws java.util.NoSuchElementException
iterator - Iterator of arguments to the function
public java.lang.Object returnNth(java.util.Iterator[] iterators,
int n)
throws java.util.NoSuchElementException
iterators - Iterator-array of arguments to the function. array.length should correspond to the number of arguments of the function
public java.lang.Object returnNth(java.util.Iterator iterator0,
java.util.Iterator iterator1,
int n)
throws java.util.NoSuchElementException
iterator0 - first Iterator of arguments to the functioniterator1 - second Iterator of arguments to the functionpublic Function concatenate(Function[] functions)
functions - The functions to be concatenated with this function.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||