org.op4j.operators.impl.fn.map
Class Level2MapEntriesKeyOperator<I,K,V>

Object
  extended by org.op4j.operators.impl.AbstractOperator
      extended by org.op4j.operators.impl.fn.map.Level2MapEntriesKeyOperator<I,K,V>
All Implemented Interfaces:
ILevel2MapEntriesKeyOperator<I,K,V>, CastableToTypeOperator<K>, ExecutableOperator<K>, NavigatingMapEntryOperator, Operator, SelectableMapEntryComponentOperator<K>, UniqFnOperator<I,Map<K,V>>, UniqOperator<Map<K,V>>

public final class Level2MapEntriesKeyOperator<I,K,V>
extends AbstractOperator
implements UniqFnOperator<I,Map<K,V>>, ILevel2MapEntriesKeyOperator<I,K,V>

Since:
1.0
Author:
Daniel Fernández

Constructor Summary
Level2MapEntriesKeyOperator(Target target)
           
 
Method Summary
<X> Level2MapEntriesKeyOperator<I,X,V>
castTo(org.javaruntype.type.Type<X> type)
           Casts the operator's target as the specified type.
 Level1MapEntriesOperator<I,K,V> endOn()
           Stops the selection of key/value.
<X> Level2MapEntriesKeyOperator<I,X,V>
exec(IFunction<? super K,X> function)
           Executes the specified function on the target object, creating a new operator containing the result of the execution.
 Level2MapEntriesKeyOperator<I,K,V> execIfFalse(IFunction<? super K,Boolean> eval, IFunction<? super K,? extends K> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesKeyOperator<I,X,V>
execIfFalse(IFunction<? super K,Boolean> eval, IFunction<? super K,X> function, IFunction<? super K,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Level2MapEntriesKeyOperator<I,K,V> execIfNotNull(IFunction<? super K,? extends K> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesKeyOperator<I,X,V>
execIfNotNull(IFunction<? super K,X> function, IFunction<? super K,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Level2MapEntriesKeyOperator<I,K,V> execIfNull(IFunction<? super K,? extends K> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesKeyOperator<I,X,V>
execIfNull(IFunction<? super K,X> function, IFunction<? super K,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Level2MapEntriesKeyOperator<I,K,V> execIfTrue(IFunction<? super K,Boolean> eval, IFunction<? super K,? extends K> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesKeyOperator<I,X,V>
execIfTrue(IFunction<? super K,Boolean> eval, IFunction<? super K,X> function, IFunction<? super K,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Function<I,Map<K,V>> get()
           Returns a function which will execute all the logic specified from the "Fn.on" expression.
 Level2MapEntriesKeySelectedOperator<I,K,V> ifFalse(IFunction<? super K,Boolean> eval)
           Selects only those targets for which the specified evaluator returns false.
 Level2MapEntriesKeySelectedOperator<I,K,V> ifNotNull()
           Selects only those targets which are not null.
 Level2MapEntriesKeySelectedOperator<I,K,V> ifNull()
           Selects only those targets which are null.
 Level2MapEntriesKeySelectedOperator<I,K,V> ifTrue(IFunction<? super K,Boolean> eval)
           Selects only those targets for which the specified evaluator returns true.
 Level2MapEntriesKeyOperator<I,K,V> replaceIfNullWith(K replacement)
           
 Level2MapEntriesKeyOperator<I,K,V> replaceWith(K replacement)
           
 
Methods inherited from class org.op4j.operators.impl.AbstractOperator
getTarget
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Level2MapEntriesKeyOperator

public Level2MapEntriesKeyOperator(Target target)
Method Detail

endOn

public Level1MapEntriesOperator<I,K,V> endOn()
Description copied from interface: NavigatingMapEntryOperator

Stops the selection of key/value. After the execution of this method, all subsequent operations will be applied on the map entry as a whole instead of only on its key or value.

Specified by:
endOn in interface ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
endOn in interface NavigatingMapEntryOperator
Returns:
an operator which will execute all operations on the map entry as a whole.

castTo

public <X> Level2MapEntriesKeyOperator<I,X,V> 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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
castTo in interface CastableToTypeOperator<K>
Type Parameters:
X - the type of the targets
Parameters:
type - the type of targets
Returns:
the resulting casted operator

get

public Function<I,Map<K,V>> get()
Description copied from interface: UniqFnOperator

Returns a function which will execute all the logic specified from the "Fn.on" expression.

Specified by:
get in interface UniqFnOperator<I,Map<K,V>>
Returns:
the function.

ifTrue

public Level2MapEntriesKeySelectedOperator<I,K,V> ifTrue(IFunction<? super K,Boolean> eval)
Description copied from interface: SelectableMapEntryComponentOperator

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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
ifTrue in interface SelectableMapEntryComponentOperator<K>
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

public Level2MapEntriesKeySelectedOperator<I,K,V> ifFalse(IFunction<? super K,Boolean> eval)
Description copied from interface: SelectableMapEntryComponentOperator

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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
ifFalse in interface SelectableMapEntryComponentOperator<K>
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.

ifNotNull

public Level2MapEntriesKeySelectedOperator<I,K,V> ifNotNull()
Description copied from interface: SelectableMapEntryComponentOperator

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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
ifNotNull in interface SelectableMapEntryComponentOperator<K>
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifNull

public Level2MapEntriesKeySelectedOperator<I,K,V> ifNull()
Description copied from interface: SelectableMapEntryComponentOperator

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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
ifNull in interface SelectableMapEntryComponentOperator<K>
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

exec

public <X> Level2MapEntriesKeyOperator<I,X,V> exec(IFunction<? super K,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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
exec in interface ExecutableOperator<K>
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

replaceWith

public Level2MapEntriesKeyOperator<I,K,V> replaceWith(K replacement)
Specified by:
replaceWith in interface ILevel2MapEntriesKeyOperator<I,K,V>

replaceIfNullWith

public Level2MapEntriesKeyOperator<I,K,V> replaceIfNullWith(K replacement)
Specified by:
replaceIfNullWith in interface ILevel2MapEntriesKeyOperator<I,K,V>

execIfFalse

public Level2MapEntriesKeyOperator<I,K,V> execIfFalse(IFunction<? super K,Boolean> eval,
                                                      IFunction<? super K,? extends K> 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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfFalse in interface ExecutableOperator<K>
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

public <X> Level2MapEntriesKeyOperator<I,X,V> execIfFalse(IFunction<? super K,Boolean> eval,
                                                          IFunction<? super K,X> function,
                                                          IFunction<? super K,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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfFalse in interface ExecutableOperator<K>
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

execIfNotNull

public Level2MapEntriesKeyOperator<I,K,V> execIfNotNull(IFunction<? super K,? extends K> 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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfNotNull in interface ExecutableOperator<K>
Parameters:
function - the function to be executed on the selected elements
Returns:
an operator on the results of function execution

execIfNotNull

public <X> Level2MapEntriesKeyOperator<I,X,V> execIfNotNull(IFunction<? super K,X> function,
                                                            IFunction<? super K,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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfNotNull in interface ExecutableOperator<K>
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

public Level2MapEntriesKeyOperator<I,K,V> execIfNull(IFunction<? super K,? extends K> 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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfNull in interface ExecutableOperator<K>
Parameters:
function - the function to be executed on the selected elements
Returns:
an operator on the results of function execution

execIfNull

public <X> Level2MapEntriesKeyOperator<I,X,V> execIfNull(IFunction<? super K,X> function,
                                                         IFunction<? super K,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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfNull in interface ExecutableOperator<K>
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

public Level2MapEntriesKeyOperator<I,K,V> execIfTrue(IFunction<? super K,Boolean> eval,
                                                     IFunction<? super K,? extends K> 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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfTrue in interface ExecutableOperator<K>
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

execIfTrue

public <X> Level2MapEntriesKeyOperator<I,X,V> execIfTrue(IFunction<? super K,Boolean> eval,
                                                         IFunction<? super K,X> function,
                                                         IFunction<? super K,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 ILevel2MapEntriesKeyOperator<I,K,V>
Specified by:
execIfTrue in interface ExecutableOperator<K>
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


Copyright © 2012 The OP4J team. All Rights Reserved.