|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.op4j.functions.FnFunc
public final class FnFunc
Method Summary | ||
---|---|---|
static
|
chain(IFunction<X,Y> fn1,
IFunction<? super Y,Z> fn2)
Chains two functions together. |
|
static
|
ifFalseThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is false. |
|
static
|
ifFalseThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise. |
|
static
|
ifNotNullAndFalseThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on it is false. |
|
static
|
ifNotNullAndFalseThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise. |
|
static
|
ifNotNullAndTrueThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on it is true. |
|
static
|
ifNotNullAndTrueThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise. |
|
static
|
ifNotNullThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null. |
|
static
|
ifNotNullThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null, and will execute the specified function elseFunction otherwise. |
|
static
|
ifNullOrFalseThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on it is false. |
|
static
|
ifNullOrFalseThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise. |
|
static
|
ifNullOrTrueThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on it is true. |
|
static
|
ifNullOrTrueThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise. |
|
static
|
ifNullThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null. |
|
static
|
ifNullThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null, and will execute the specified function elseFunction otherwise. |
|
static
|
ifTrueThen(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is true. |
|
static
|
ifTrueThenElse(org.javaruntype.type.Type<T> targetType,
IFunction<? super T,Boolean> condition,
IFunction<? super T,R> thenFunction,
IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise. |
|
static
|
whileFalse(IFunction<? super T,Boolean> condition,
IFunction<? super T,T> function)
Executes the specified function iteratively (first on the target, then on the result of the previous iteration) while the result of executing the condition function on the target object (or the result of the previous function iteration) is false. |
|
static
|
whileTrue(IFunction<? super T,Boolean> condition,
IFunction<? super T,T> function)
Executes the specified function iteratively (first on the target, then on the result of the previous iteration) while the result of executing the condition function on the target object (or the result of the previous function iteration) is true. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final <X,Y,Z> Function<X,Z> chain(IFunction<X,Y> fn1, IFunction<? super Y,Z> fn2)
Chains two functions together. The returned function executes the specified functions in sequence, being fn2 executed on the results of fn1.
fn1
- the first function to be executedfn2
- the second function to be executed
public static final <T> Function<T,T> ifTrueThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is true.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if condition is true
public static final <T,R> Function<T,R> ifTrueThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if condition is trueelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifFalseThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is false.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if condition is false
public static final <T,R> Function<T,R> ifFalseThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if condition is falseelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifNullThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target type.thenFunction
- the function to be executed on the target object if it is null.
public static final <T,R> Function<T,R> ifNullThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typethenFunction
- the function to be executed on the target object is nullelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifNotNullThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target type.thenFunction
- the function to be executed on the target object if it is not null.
public static final <T,R> Function<T,R> ifNotNullThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typethenFunction
- the function to be executed on the target object is not nullelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifNullOrTrueThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on it is true.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is null or the result of executing condition on it is true
public static final <T,R> Function<T,R> ifNullOrTrueThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is null or the result of executing condition on it is trueelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifNullOrFalseThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on it is false.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is null or the result of executing condition on it is false
public static final <T,R> Function<T,R> ifNullOrFalseThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is null or the result of executing condition on it is falseelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifNotNullAndTrueThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on it is true.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is not null and the result of executing condition on it is true
public static final <T,R> Function<T,R> ifNotNullAndTrueThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is not null and the result of executing condition on it is trueelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> ifNotNullAndFalseThen(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,? extends T> thenFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on it is false.
The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is not null and the result of executing condition on it is false
public static final <T,R> Function<T,R> ifNotNullAndFalseThenElse(org.javaruntype.type.Type<T> targetType, IFunction<? super T,Boolean> condition, IFunction<? super T,R> thenFunction, IFunction<? super T,R> elseFunction)
Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise.
The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.
targetType
- the target typecondition
- the condition to be executed on the target objectthenFunction
- the function to be executed on the target object if
target is not null and the result of executing condition on it is falseelseFunction
- the function to be executed on the target object otherwise
public static final <T> Function<T,T> whileTrue(IFunction<? super T,Boolean> condition, IFunction<? super T,T> function)
Executes the specified function iteratively (first on the target, then on the result of the previous iteration) while the result of executing the condition function on the target object (or the result of the previous function iteration) is true.
condition
- the condition function to be appliedfunction
- the function to be executed iteratively
public static final <T> Function<T,T> whileFalse(IFunction<? super T,Boolean> condition, IFunction<? super T,T> function)
Executes the specified function iteratively (first on the target, then on the result of the previous iteration) while the result of executing the condition function on the target object (or the result of the previous function iteration) is false.
condition
- the condition function to be appliedfunction
- the function to be executed iteratively
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |