public abstract static class Osgl.F1<P1,R> extends Osgl.FuncBase implements Osgl.Func1<P1,R>, Osgl.Bijection<P1,R>, Osgl.MultiplicableFunction<P1,R>
Osgl.Function function. User application should
(nearly) always make their implementation extend to this base class
instead of implement Osgl.Function directly| Constructor and Description |
|---|
F1() |
| Modifier and Type | Method and Description |
|---|---|
Osgl.F1<P1,R> |
andThen(Osgl.Function<? super P1,? extends R>... afters)
Returns a composed function that applied, in sequence, this function and
all functions specified one by one.
|
<T> Osgl.F1<P1,T> |
andThen(Osgl.Function<? super R,? extends T> after)
Returns a composed function that applies this function to it's input and
then applies the
after function to the result. |
R |
applyOrElse(P1 p1,
Osgl.F1<? super P1,? extends R> fallback)
Applies this partial function to the given argument when it is contained in the function domain.
|
Osgl.F0<R> |
compose(Osgl.Func0<? extends P1> before)
Returns an
F0<R>> function by composing the specified Func0<P1> function
with this function applied last |
<X1,X2> Osgl.F2<X1,X2,R> |
compose(Osgl.Func2<? super X1,? super X2,? extends P1> before)
Returns an
F2<X1, X2, R>> function by composing the specified
Func2<X1, X2, P1> function with this function applied last |
<X1,X2,X3> Osgl.F3<X1,X2,X3,R> |
compose(Osgl.Func3<? super X1,? super X2,? super X3,? extends P1> before)
Returns an
F3<X1, X2, X3, R>> function by composing the specified
Func3<X1, X2, X3, P1> function with this function applied last |
<X1,X2,X3,X4> |
compose(Osgl.Func4<? super X1,? super X2,? super X3,? super X4,? extends P1> before)
Returns an
F3<X1, X2, X3, X4, R>> function by composing the specified
Func3<X1, X2, X3, X4, P1> function with this function applied last |
<X1,X2,X3,X4,X5> |
compose(Osgl.Func5<? super X1,? super X2,? super X3,? super X4,? super X5,? extends P1> before)
Returns an
F3<X1, X2, X3, X4, X5, R>> function by composing the specified
Func3<X1, X2, X3, X4, X5, P1> function with this function applied last |
<X1> Osgl.F1<X1,R> |
compose(Osgl.Function<? super X1,? extends P1> before)
Returns an
F1<X1, R>> function by composing the specified
Function<X1, P1> function with this function applied last |
Osgl.F0<R> |
curry(P1 p1) |
Osgl.Bijection<R,P1> |
invert()
Returns the inverse function mapping from
Y back to X |
Osgl.F1<P1,Osgl.Option<R>> |
lift()
Turns this partial function into a plain function returning an Option result.
|
Osgl.F1<P1,R> |
orElse(Osgl.Function<? super P1,? extends R> fallback)
Returns a composed function that when applied, try to apply this function first, in case
a
NotAppliedException is captured apply to the fallback function specified. |
Osgl.MultiplicableFunction<P1,R> |
times(int n)
Returns a function with
n times factor specified. |
breakOutclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplypublic Osgl.Bijection<R,P1> invert()
Osgl.BijectionY back to Xinvert in interface Osgl.Bijection<P1,R>Y type element to X type elementpublic Osgl.MultiplicableFunction<P1,R> times(int n)
Osgl.MultiplicableFunctionn times factor specified. When the function
returned applied to a param, the effect is the same as apply this function
n times to the same paramtimes in interface Osgl.MultiplicableFunction<P1,R>n - specify the times factorpublic R applyOrElse(P1 p1, Osgl.F1<? super P1,? extends R> fallback)
p1 - the argument this function to be appliedfallback - the function to be applied to the argument p1 when this function failed with any runtime exceptionpublic <T> Osgl.F1<P1,T> andThen(Osgl.Function<? super R,? extends T> after)
after function to the result. If evaluation of either
function throws an exception, it is relayed to the caller of the composed
function.T - the type of return value of the new composed functionafter - the function applies after this function is appliedNullPointerException - if @{code after} is nullpublic Osgl.F1<P1,R> andThen(Osgl.Function<? super P1,? extends R>... afters)
When apply the composed function, the result of the last function is returned
afters - a sequence of function to be applied after this functionpublic Osgl.F1<P1,R> orElse(Osgl.Function<? super P1,? extends R> fallback)
NotAppliedException is captured apply to the fallback function specified. This
method helps to implement partial functionfallback - the function to applied if this function doesn't apply to the parameter(s)public Osgl.F0<R> compose(Osgl.Func0<? extends P1> before)
F0<R>> function by composing the specified Func0<P1> function
with this function applied lastbefore - the function to be applied first when applying the return functionpublic <X1> Osgl.F1<X1,R> compose(Osgl.Function<? super X1,? extends P1> before)
F1<X1, R>> function by composing the specified
Function<X1, P1> function with this function applied lastX1 - type of argument takes by the before functionbefore - the function to be applied first when applying the return functionpublic <X1,X2> Osgl.F2<X1,X2,R> compose(Osgl.Func2<? super X1,? super X2,? extends P1> before)
F2<X1, X2, R>> function by composing the specified
Func2<X1, X2, P1> function with this function applied lastX1 - the type of first param the new function applied toX2 - the type of second param the new function applied tobefore - the function to be applied first when applying the return functionpublic <X1,X2,X3> Osgl.F3<X1,X2,X3,R> compose(Osgl.Func3<? super X1,? super X2,? super X3,? extends P1> before)
F3<X1, X2, X3, R>> function by composing the specified
Func3<X1, X2, X3, P1> function with this function applied lastX1 - the type of first param the new function applied toX2 - the type of second param the new function applied toX3 - the type of third param the new function applied tobefore - the function to be applied first when applying the return functionpublic <X1,X2,X3,X4> Osgl.F4<X1,X2,X3,X4,R> compose(Osgl.Func4<? super X1,? super X2,? super X3,? super X4,? extends P1> before)
F3<X1, X2, X3, X4, R>> function by composing the specified
Func3<X1, X2, X3, X4, P1> function with this function applied lastX1 - the type of first param the new function applied toX2 - the type of second param the new function applied toX3 - the type of third param the new function applied toX4 - the type of fourth param the new function applied tobefore - the function to be applied first when applying the return functionpublic <X1,X2,X3,X4,X5> Osgl.F5<X1,X2,X3,X4,X5,R> compose(Osgl.Func5<? super X1,? super X2,? super X3,? super X4,? super X5,? extends P1> before)
F3<X1, X2, X3, X4, X5, R>> function by composing the specified
Func3<X1, X2, X3, X4, X5, P1> function with this function applied lastX1 - the type of first param the new function applied toX2 - the type of second param the new function applied toX3 - the type of third param the new function applied toX4 - the type of fourth param the new function applied toX5 - the type of fifth param the new function applied tobefore - the function to be applied first when applying the return functionpublic Osgl.F1<P1,Osgl.Option<R>> lift()
Copyright © 2017. All Rights Reserved.