|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.jezuk.mango.Adapt
Object method adaptors.
Bind| Method Summary | |
static UnaryFunction |
ArgumentMethod(java.lang.String methodName)
Creates a UnaryFunction which will call a method on the
object passed as the argument to UnaryFunction.fn method. |
static BinaryFunction |
Compose(BinaryFunction f,
UnaryFunction g1,
UnaryFunction g2)
Compose is a function adaptor. |
static UnaryFunction |
Compose(UnaryFunction f,
UnaryFunction g)
Compose is a unary function adaptor. |
static UnaryFunction |
Method(java.lang.Class klass,
java.lang.String methodName)
Adapts static member functions as UnaryFunction objects, allowing them
to be passed to algorithms. |
static UnaryFunction |
Method(java.lang.Object obj,
java.lang.String methodName)
Adapts member functions as UnaryFunction objects, allowing them
to be passed to algorithms. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static UnaryFunction Compose(UnaryFunction f,
UnaryFunction g)
f and g
are UnaryFunctions, then Compose creates a new
function h, where h(x) is equal to f(g(x)).
public static BinaryFunction Compose(BinaryFunction f,
UnaryFunction g1,
UnaryFunction g2)
f is a BinaryFunction
and g1 and g2 are UnaryFunctions, then Compose
returns a new BinaryFunction h such that h(x, y)
is f(g1(x), g2(y))
public static UnaryFunction Method(java.lang.Object obj,
java.lang.String methodName)
UnaryFunction objects, allowing them
to be passed to algorithms.
Mango.forEach(list, Adapt.Method(System.out, "println"));for(int i = 0; i < list.size(); ++i) System.out.println(list.get(i));
If the named method is not found, or its signature is incorrect throws a RuntimeException. If multiple methods have the correct name, and take a single parameter one of them will be called, but you can't determine which.
public static UnaryFunction Method(java.lang.Class klass,
java.lang.String methodName)
UnaryFunction objects, allowing them
to be passed to algorithms.
If the named method is not found, or its signature is incorrect throws a RuntimeException. If multiple methods have the correct name, and take a single parameter one of them will be called, but you can't determine which.
public static UnaryFunction ArgumentMethod(java.lang.String methodName)
UnaryFunction which will call a method on the
object passed as the argument to UnaryFunction.fn method.
interface Something { void persist(); }
// fill list with Somethings
Mango.forEach(list, Bind.ArgumentMethod("persist"));for(int i = 0; i < list.size(); ++i)
{
Something s = (Something)list.get(i);
s.persist();
}
If the named method is not found, or its signature is incorrect throws a RuntimeException.
UnaryFunction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||