|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A - function argument typeB - function return type@Applicative public interface Function<A,B>
Functions are rich interfaced Applicables - one argument
composable, Delayable and NullSafeAware tranformations.
| Method Summary | ||
|---|---|---|
Predicate<A> |
equal(B object)
Returns a predicate that answers if the result of applying this function is equals to the given object. |
|
boolean |
isIdentity()
Answers if this function is the identity function, that is, the function that answers the argument it receives |
|
Predicate<A> |
notNull()
Returns a predicate that answers if the result of applying this function is not null. |
|
Predicate<A> |
null_()
Returns a predicate that answers if the result of applying this function is null. |
|
Function<A,B> |
nullSafe()
Answers a new function that returns null if is argument is null, or the result of applying this function, otherwise. |
|
|
of(Applicable<? super C,? extends A> other)
Composes this function with another Applicable, resulting in a new
Function that when applied returns
this.apply(other.apply(arg) |
|
|
of(Applicable2<Tp1,Tp2,? extends A> other)
Composes this function with another Applicable2, resulting in a new
Function2 that when applied returns
this.apply(other.apply(arg0, arg1) |
|
|
of(Applicable3<Tp1,Tp2,Tp3,? extends A> other)
Composes this function with another Applicable3, resulting in a new
Function3 that when applied returns
this.apply(other.apply(arg0,arg1,arg2) |
|
Predicate<A> |
same(B object)
Returns a predicate that answers if the result of applying this function is the same that the given object. |
|
|
then(Function<? super B,? extends C> other)
Pipeline combination, equivalent to function composition, like but with receptor and argument interchanged. |
|
|
then(Function2<B,B2,C> binayFunction,
Function<? super A2,? extends B2> other)
Merge combination. |
|
Predicate<A> |
then(Predicate<? super B> other)
Predicate composition, like Predicate.of(Applicable), but with
receptor and argument interchanged. |
|
| Methods inherited from interface net.sf.staccatocommons.defs.Applicable |
|---|
apply |
| Methods inherited from interface net.sf.staccatocommons.defs.Delayable |
|---|
delayed, delayedValue |
| Method Detail |
|---|
<C> Function<C,B> of(@NonNull
Applicable<? super C,? extends A> other)
Applicable, resulting in a new
Function that when applied returns
this.apply(other.apply(arg)
C - other -
this composed with other
<Tp1,Tp2> Function2<Tp1,Tp2,B> of(@NonNull
Applicable2<Tp1,Tp2,? extends A> other)
Applicable2, resulting in a new
Function2 that when applied returns
this.apply(other.apply(arg0, arg1)
Tp1 - Tp2 - other - non null
<Tp1,Tp2,Tp3> Function3<Tp1,Tp2,Tp3,B> of(@NonNull
Applicable3<Tp1,Tp2,Tp3,? extends A> other)
Applicable3, resulting in a new
Function3 that when applied returns
this.apply(other.apply(arg0,arg1,arg2)
Tp1 - Tp2 - Tp3 - other - non null
<C> Function<A,C> then(@NonNull
Function<? super B,? extends C> other)
>----this---+----other---->
C - other -
other.of(this)
<A2,B2,C> Function2<A,A2,C> then(Function2<B,B2,C> binayFunction,
@NonNull
Function<? super A2,? extends B2> other)
this function with other function, using a
binaryFunction to merge the results.
The answered Function2 will apply this function to its first
argument, the other function to the second argument, and
return the application of binaryFunction to both resulting
values.
Functions get combined in the following figure:
>--this-----+
+---binaryFunction---->
>--other----+
A2 - B2 - C - binayFunction - other -
Function2 that merges this and other
with binaryFunction
Predicate<A> then(@NonNull
Predicate<? super B> other)
Predicate.of(Applicable), but with
receptor and argument interchanged. Equivalent to other.of(this)
other -
Predicate@NullSafe Function<A,B> nullSafe()
nullSafe in interface NullSafeAware<Function<A,B>>FunctionPredicate<A> equal(B object)
NumberType<Integer> integerType = ...; integerType.add(10).equal(15).apply(5);will be
true, since 5 + 10 = 15
other -
PredicatePredicate<A> same(B object)
other -
PredicatePredicate<A> null_()
other -
PredicatePredicate<A> notNull()
other -
Predicateboolean isIdentity()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||