|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.eos.util.Compositions
@Experimental public class Compositions
Defines some useful compositions for handling with Functions,
Predicates and Suppliers.
Each composition follows the rule of a from or source
entity, propagating its result value to a to or target entity.
| Method Summary | ||
|---|---|---|
static
|
compose(Function<? super F,? extends I> from,
Function<? super I,? extends T> to)
Returns the composition of two functions. |
|
static
|
compose(Function<? super F,? extends T> fromFunction,
Predicate<T> toPredicate)
Returns a composition of a from Function and an evaluating
to Predicate. |
|
static
|
compose(Supplier<? extends F> fromSupplier,
Function<F,T> toFunction)
Returns a composition of a from Supplier and an applied
to Function. |
|
static
|
composeRule(Predicate<? super F> decider,
Function<? super F,? extends T> trueFunction,
Function<? super F,? extends T> falseFunction)
Composes a rule. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final <F,I,T> Function<F,T> compose(Function<? super F,? extends I> from,
Function<? super I,? extends T> to)
f: F→I and
g: I→T, composition is defined as the function h
such that h(x) == g(f(x)) for each x.
The usage interface is designed as a from function which
propagates its result to the to function.
F - the from or source typeI - the intermediate typeT - the to or target typefrom - the from or source functionto - the to or target function
IllegalArgumentException - if one parameter is null
public static final <F,T> Predicate<F> compose(Function<? super F,? extends T> fromFunction,
Predicate<T> toPredicate)
Function and an evaluating
to Predicate. The predicate retrieves the value from
the function.
The usage interface is designed as a from function which
propagates its result to the to predicate.
F - the from or source typeT - the to or target typefromFunction - the from or source functiontoPredicate - the to or target predicate
predicate
IllegalArgumentException - if one parameter is null
public static final <F,T> Supplier<T> compose(Supplier<? extends F> fromSupplier,
Function<F,T> toFunction)
Supplier and an applied
to Function. The function retrieves the value from
the supplier.
The usage interface is designed as a from supplier which
propagates its result to the to function.
F - the from or source typeT - the to or target typefromSupplier - the from or source suppliertoFunction - the to or target function
supplier with the value from function
IllegalArgumentException - if one parameter is null
public static final <F,T> Function<F,T> composeRule(Predicate<? super F> decider,
Function<? super F,? extends T> trueFunction,
Function<? super F,? extends T> falseFunction)
predicate as decision maker either to call the
trueFunction or the falseFunction. The returning function calls the
trueFunction if predicate returns true. Otherwise the
falseFunction will call.
F - the input type of the predicate and the functionsT - the output type of the applyied functionsdecider - the decision makertrueFunction - apply if the decision maker returns truefalseFunction - apply if the decision maker returns false
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||