org.op4j.operators.intf.generic
Interface ILevel0GenericUniqOperator<I,T>

All Superinterfaces:
BuilderOperator<I,T>, CastableToStructuresOperator, CastableToTypeOperator<T>, ExecutableOperator<T>, Operator, ReplaceableIfNullOperator<T>, ReplaceableOperator<T>, SelectableOperator<T>, UniqOperator<T>
All Known Implementing Classes:
Level0GenericUniqOperator, Level0GenericUniqOperator

public interface ILevel0GenericUniqOperator<I,T>
extends UniqOperator<T>, CastableToStructuresOperator, BuilderOperator<I,T>, ExecutableOperator<T>, CastableToTypeOperator<T>, SelectableOperator<T>, ReplaceableOperator<T>, ReplaceableIfNullOperator<T>

Since:
1.0
Author:
Daniel Fernández

Method Summary
<X> ILevel0GenericUniqOperator<I,X>
castTo(org.javaruntype.type.Type<X> type)
           Casts the operator's target as the specified type.
<X> ILevel0ArrayOperator<I,X>
castToArrayOf(org.javaruntype.type.Type<X> type)
           Casts the operator's target as an array of the specified type.
<X> ILevel0ListOperator<I,X>
castToListOf(org.javaruntype.type.Type<X> type)
           Casts the operator's target as a list of the specified type.
<K,V> ILevel0MapOperator<I,K,V>
castToMapOf(org.javaruntype.type.Type<K> keyType, org.javaruntype.type.Type<V> valueType)
           Casts the operator's target as a map of the specified types.
<X> ILevel0SetOperator<I,X>
castToSetOf(org.javaruntype.type.Type<X> type)
           Casts the operator's target as a set of the specified type.
<X> ILevel0GenericUniqOperator<I,X>
exec(IFunction<? super T,X> function)
           Executes the specified function on the target object, creating a new operator containing the result of the execution.
 ILevel0GenericUniqOperator<I,T> execIfFalse(IFunction<? super T,Boolean> eval, IFunction<? super T,? extends T> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> ILevel0GenericUniqOperator<I,X>
execIfFalse(IFunction<? super T,Boolean> eval, IFunction<? super T,X> function, IFunction<? super T,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 ILevel0GenericUniqOperator<I,T> execIfNotNull(IFunction<? super T,? extends T> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> ILevel0GenericUniqOperator<I,X>
execIfNotNull(IFunction<? super T,X> function, IFunction<? super T,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 ILevel0GenericUniqOperator<I,T> execIfNull(IFunction<? super T,? extends T> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> ILevel0GenericUniqOperator<I,X>
execIfNull(IFunction<? super T,X> function, IFunction<? super T,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 ILevel0GenericUniqOperator<I,T> execIfTrue(IFunction<? super T,Boolean> eval, IFunction<? super T,? extends T> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> ILevel0GenericUniqOperator<I,X>
execIfTrue(IFunction<? super T,Boolean> eval, IFunction<? super T,X> function, IFunction<? super T,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 ILevel0GenericUniqSelectedOperator<I,T> ifFalse(IFunction<? super T,Boolean> eval)
           Selects only those targets for which the specified evaluator returns false.
 ILevel0GenericUniqSelectedOperator<I,T> ifNotNull()
           Selects only those targets which are not null.
 ILevel0GenericUniqSelectedOperator<I,T> ifNull()
           Selects only those targets which are null.
 ILevel0GenericUniqSelectedOperator<I,T> ifTrue(IFunction<? super T,Boolean> eval)
           Selects only those targets for which the specified evaluator returns true.
 ILevel0ArrayOperator<I,T> intoSingletonArrayOf(org.javaruntype.type.Type<T> type)
           Builds an array of the specified type containing the operator's targets.
 ILevel0ListOperator<I,T> intoSingletonList()
           Builds a list containing the operator's targets.
<K,V> ILevel0MapOperator<I,K,V>
intoSingletonMap(IFunction<? super T,Map.Entry<K,V>> mapBuilder)
           Builds a map by inputting the operator's targets into a map builder object (a function returning map entries), which is in charge of creating the corresponding key and value for each original target.
 ILevel0SetOperator<I,T> intoSingletonSet()
           Builds a set containing the operator's targets.
 ILevel0GenericUniqOperator<I,T> replaceIfNullWith(T replacement)
           Replaces the current target object with the specified replacement if the current target is null.
 ILevel0GenericUniqOperator<I,T> replaceWith(T replacement)
           Replaces the current target object with the specified replacement.
<K> ILevel0MapOperator<I,K,T>
zipKey(K key)
           Builds a one-entry map using the operator's target as a value, and the specified object as a key.
<K> ILevel0MapOperator<I,K,T>
zipKeyBy(IFunction<? super T,K> keyEval)
           Builds a one-entry map using the operator's target as a value, and the result of executing the keyEval evaluator on the target as a key.
<V> ILevel0MapOperator<I,T,V>
zipValue(V value)
           Builds a one-entry map using the operator's target as a key, and the specified object as a value.
<V> ILevel0MapOperator<I,T,V>
zipValueBy(IFunction<? super T,V> valueEval)
           Builds a one-entry map using the operator's target as a key, and the result of executing the valueEval evaluator on the target as a value.
 

Method Detail

ifTrue

ILevel0GenericUniqSelectedOperator<I,T> ifTrue(IFunction<? super T,Boolean> eval)
Description copied from interface: SelectableOperator

Selects only those targets for which the specified evaluator returns true. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.

Specified by:
ifTrue in interface SelectableOperator<T>
Parameters:
eval - the evaluator to be used for selecting targets.
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifFalse

ILevel0GenericUniqSelectedOperator<I,T> ifFalse(IFunction<? super T,Boolean> eval)
Description copied from interface: SelectableOperator

Selects only those targets for which the specified evaluator returns false. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.

Specified by:
ifFalse in interface SelectableOperator<T>
Parameters:
eval - the evaluator to be used for selecting targets.
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifNull

ILevel0GenericUniqSelectedOperator<I,T> ifNull()
Description copied from interface: SelectableOperator

Selects only those targets which are null. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.

Specified by:
ifNull in interface SelectableOperator<T>
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifNotNull

ILevel0GenericUniqSelectedOperator<I,T> ifNotNull()
Description copied from interface: SelectableOperator

Selects only those targets which are not null. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.

Specified by:
ifNotNull in interface SelectableOperator<T>
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

replaceWith

ILevel0GenericUniqOperator<I,T> replaceWith(T replacement)
Description copied from interface: ReplaceableOperator

Replaces the current target object with the specified replacement.

Specified by:
replaceWith in interface ReplaceableOperator<T>
Parameters:
replacement - the object which will replace the current target object.
Returns:
an operator containing the replacement object as target.

replaceIfNullWith

ILevel0GenericUniqOperator<I,T> replaceIfNullWith(T replacement)
Description copied from interface: ReplaceableIfNullOperator

Replaces the current target object with the specified replacement if the current target is null.

Specified by:
replaceIfNullWith in interface ReplaceableIfNullOperator<T>
Parameters:
replacement - the object which will replace the current target object if target is null.
Returns:
an operator containing the original target object if it was not null, or the new one if null.

exec

<X> ILevel0GenericUniqOperator<I,X> exec(IFunction<? super T,X> function)
Description copied from interface: ExecutableOperator

Executes the specified function on the target object, creating a new operator containing the result of the execution.

This function must be able to take as input an object of type T (the current operator's target type) and will return an object of type X, which will be from then on the new operator's target type.

Specified by:
exec in interface ExecutableOperator<T>
Type Parameters:
X - the type of the result, and new type for the operator
Parameters:
function - the function to be executed
Returns:
an operator on the results of function execution

execIfNotNull

ILevel0GenericUniqOperator<I,T> execIfNotNull(IFunction<? super T,? extends T> function)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfNotNull in interface ExecutableOperator<T>
Parameters:
function - the function to be executed on the selected elements
Returns:
an operator on the results of function execution

execIfNull

ILevel0GenericUniqOperator<I,T> execIfNull(IFunction<? super T,? extends T> function)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfNull in interface ExecutableOperator<T>
Parameters:
function - the function to be executed on the selected elements
Returns:
an operator on the results of function execution

execIfTrue

ILevel0GenericUniqOperator<I,T> execIfTrue(IFunction<? super T,Boolean> eval,
                                           IFunction<? super T,? extends T> function)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfTrue in interface ExecutableOperator<T>
Parameters:
eval - the evaluation function used to select elements
function - the function to be executed on the selected elements
Returns:
an operator on the results of function execution

execIfFalse

ILevel0GenericUniqOperator<I,T> execIfFalse(IFunction<? super T,Boolean> eval,
                                            IFunction<? super T,? extends T> function)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfFalse in interface ExecutableOperator<T>
Parameters:
eval - the evaluation function used to select elements
function - the function to be executed on the selected elements
Returns:
an operator on the results of function execution

execIfNotNull

<X> ILevel0GenericUniqOperator<I,X> execIfNotNull(IFunction<? super T,X> function,
                                                  IFunction<? super T,X> elseFunction)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfNotNull in interface ExecutableOperator<T>
Type Parameters:
X - the new type returned by the functions
Parameters:
function - the function to be executed on the selected elements
elseFunction - the function to be executed on the non-selected elements
Returns:
an operator on the results of function execution

execIfNull

<X> ILevel0GenericUniqOperator<I,X> execIfNull(IFunction<? super T,X> function,
                                               IFunction<? super T,X> elseFunction)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfNull in interface ExecutableOperator<T>
Type Parameters:
X - the new type returned by the functions
Parameters:
function - the function to be executed on the selected elements
elseFunction - the function to be executed on the non-selected elements
Returns:
an operator on the results of function execution

execIfTrue

<X> ILevel0GenericUniqOperator<I,X> execIfTrue(IFunction<? super T,Boolean> eval,
                                               IFunction<? super T,X> function,
                                               IFunction<? super T,X> elseFunction)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfTrue in interface ExecutableOperator<T>
Type Parameters:
X - the new type returned by the functions
Parameters:
eval - the evaluation function used to select elements
function - the function to be executed on the selected elements
elseFunction - the function to be executed on the non-selected elements
Returns:
an operator on the results of function execution

execIfFalse

<X> ILevel0GenericUniqOperator<I,X> execIfFalse(IFunction<? super T,Boolean> eval,
                                                IFunction<? super T,X> function,
                                                IFunction<? super T,X> elseFunction)
Description copied from interface: ExecutableOperator

Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.

Specified by:
execIfFalse in interface ExecutableOperator<T>
Type Parameters:
X - the new type returned by the functions
Parameters:
eval - the evaluation function used to select elements
function - the function to be executed on the selected elements
elseFunction - the function to be executed on the non-selected elements
Returns:
an operator on the results of function execution

castTo

<X> ILevel0GenericUniqOperator<I,X> castTo(org.javaruntype.type.Type<X> type)
Description copied from interface: CastableToTypeOperator

Casts the operator's target as the specified type.

Specified by:
castTo in interface CastableToTypeOperator<T>
Type Parameters:
X - the type of the targets
Parameters:
type - the type of targets
Returns:
the resulting casted operator

castToArrayOf

<X> ILevel0ArrayOperator<I,X> castToArrayOf(org.javaruntype.type.Type<X> type)
Description copied from interface: CastableToStructuresOperator

Casts the operator's target as an array of the specified type.

Specified by:
castToArrayOf in interface CastableToStructuresOperator
Type Parameters:
X - the type of the elements of the array
Parameters:
type - the type of the elements of the array
Returns:
the resulting casted operator

castToListOf

<X> ILevel0ListOperator<I,X> castToListOf(org.javaruntype.type.Type<X> type)
Description copied from interface: CastableToStructuresOperator

Casts the operator's target as a list of the specified type.

Specified by:
castToListOf in interface CastableToStructuresOperator
Type Parameters:
X - the type of the elements of the list
Parameters:
type - the type of the elements of the list
Returns:
the resulting casted operator

castToMapOf

<K,V> ILevel0MapOperator<I,K,V> castToMapOf(org.javaruntype.type.Type<K> keyType,
                                            org.javaruntype.type.Type<V> valueType)
Description copied from interface: CastableToStructuresOperator

Casts the operator's target as a map of the specified types.

Specified by:
castToMapOf in interface CastableToStructuresOperator
Type Parameters:
K - the type for the map's keys
V - the type for the map's values
Parameters:
keyType - the type for the map's keys
valueType - the type for the map's values
Returns:
the resulting map

castToSetOf

<X> ILevel0SetOperator<I,X> castToSetOf(org.javaruntype.type.Type<X> type)
Description copied from interface: CastableToStructuresOperator

Casts the operator's target as a set of the specified type.

Specified by:
castToSetOf in interface CastableToStructuresOperator
Type Parameters:
X - the type of the elements of the set
Parameters:
type - the type of the elements of the set
Returns:
the resulting casted operator

intoSingletonList

ILevel0ListOperator<I,T> intoSingletonList()
Description copied from interface: BuilderOperator

Builds a list containing the operator's targets.

Specified by:
intoSingletonList in interface BuilderOperator<I,T>
Returns:
an operator on the resulting list

intoSingletonSet

ILevel0SetOperator<I,T> intoSingletonSet()
Description copied from interface: BuilderOperator

Builds a set containing the operator's targets.

Specified by:
intoSingletonSet in interface BuilderOperator<I,T>
Returns:
an operator on the resulting set

intoSingletonArrayOf

ILevel0ArrayOperator<I,T> intoSingletonArrayOf(org.javaruntype.type.Type<T> type)
Description copied from interface: BuilderOperator

Builds an array of the specified type containing the operator's targets.

Specified by:
intoSingletonArrayOf in interface BuilderOperator<I,T>
Parameters:
type - the type if which the array will be instantiated
Returns:
an operator on the resulting array

intoSingletonMap

<K,V> ILevel0MapOperator<I,K,V> intoSingletonMap(IFunction<? super T,Map.Entry<K,V>> mapBuilder)
Description copied from interface: BuilderOperator

Builds a map by inputting the operator's targets into a map builder object (a function returning map entries), which is in charge of creating the corresponding key and value for each original target. If two values have the same key, all of them but the last to be evaluated will be overwritten.

Specified by:
intoSingletonMap in interface BuilderOperator<I,T>
Type Parameters:
K - the type of the keys returned by the map builder
V - the type of the values returned by the map builder
Parameters:
mapBuilder - the map builder function
Returns:
an operator on the resulting map

zipKeyBy

<K> ILevel0MapOperator<I,K,T> zipKeyBy(IFunction<? super T,K> keyEval)
Description copied from interface: BuilderOperator

Builds a one-entry map using the operator's target as a value, and the result of executing the keyEval evaluator on the target as a key.

Specified by:
zipKeyBy in interface BuilderOperator<I,T>
Type Parameters:
K - the type of the new key, resulting from evaluating keyEval
Parameters:
keyEval - the evaluator to be used for obtaining the key
Returns:
an operator on the resulting map

zipValueBy

<V> ILevel0MapOperator<I,T,V> zipValueBy(IFunction<? super T,V> valueEval)
Description copied from interface: BuilderOperator

Builds a one-entry map using the operator's target as a key, and the result of executing the valueEval evaluator on the target as a value.

Specified by:
zipValueBy in interface BuilderOperator<I,T>
Type Parameters:
V - the type of the new value, resulting from evaluating valueEval
Parameters:
valueEval - the evaluator to be used for obtaining the value
Returns:
an operator on the resulting map

zipKey

<K> ILevel0MapOperator<I,K,T> zipKey(K key)
Description copied from interface: BuilderOperator

Builds a one-entry map using the operator's target as a value, and the specified object as a key.

Specified by:
zipKey in interface BuilderOperator<I,T>
Type Parameters:
K - the type of the new key, resulting from evaluating keyEval
Parameters:
key - the key to be zipped
Returns:
an operator on the resulting map

zipValue

<V> ILevel0MapOperator<I,T,V> zipValue(V value)
Description copied from interface: BuilderOperator

Builds a one-entry map using the operator's target as a key, and the specified object as a value.

Specified by:
zipValue in interface BuilderOperator<I,T>
Type Parameters:
V - the type of the new value, resulting from evaluating valueEval
Parameters:
value - the value to be zipped
Returns:
an operator on the resulting map


Copyright © 2012 The OP4J team. All Rights Reserved.