org.op4j.operators.impl.op.map
Class Level2MapEntriesValueOperator<I,K,V>

Object
  extended by org.op4j.operators.impl.AbstractOperator
      extended by org.op4j.operators.impl.op.map.Level2MapEntriesValueOperator<I,K,V>
All Implemented Interfaces:
ILevel2MapEntriesValueOperator<I,K,V>, CastableToTypeOperator<V>, ExecutableOperator<V>, NavigatingMapEntryOperator, Operator, ReplaceableIfNullOperator<V>, ReplaceableOperator<V>, SelectableMapEntryComponentOperator<V>, UniqOperator<Map<K,V>>, UniqOpOperator<I,Map<K,V>>

public final class Level2MapEntriesValueOperator<I,K,V>
extends AbstractOperator
implements UniqOpOperator<I,Map<K,V>>, ILevel2MapEntriesValueOperator<I,K,V>

Since:
1.0
Author:
Daniel Fernández

Constructor Summary
Level2MapEntriesValueOperator(Target target)
           
 
Method Summary
<X> Level2MapEntriesValueOperator<I,K,X>
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> Level2MapEntriesValueOperator<I,K,X>
exec(IFunction<? super V,X> function)
           Executes the specified function on the target object, creating a new operator containing the result of the execution.
 Level2MapEntriesValueOperator<I,K,V> execIfFalse(IFunction<? super V,Boolean> eval, IFunction<? super V,? extends V> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesValueOperator<I,K,X>
execIfFalse(IFunction<? super V,Boolean> eval, IFunction<? super V,X> function, IFunction<? super V,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Level2MapEntriesValueOperator<I,K,V> execIfNotNull(IFunction<? super V,? extends V> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesValueOperator<I,K,X>
execIfNotNull(IFunction<? super V,X> function, IFunction<? super V,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Level2MapEntriesValueOperator<I,K,V> execIfNull(IFunction<? super V,? extends V> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesValueOperator<I,K,X>
execIfNull(IFunction<? super V,X> function, IFunction<? super V,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Level2MapEntriesValueOperator<I,K,V> execIfTrue(IFunction<? super V,Boolean> eval, IFunction<? super V,? extends V> function)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
<X> Level2MapEntriesValueOperator<I,K,X>
execIfTrue(IFunction<? super V,Boolean> eval, IFunction<? super V,X> function, IFunction<? super V,X> elseFunction)
           Executes a function in a way equivalent to ExecutableOperator.exec(IFunction) but only on selected elements, leaving all other elements untouched.
 Map<K,V> get()
           Returns the target object this operator currently holds.
 Level2MapEntriesValueSelectedOperator<I,K,V> ifFalse(IFunction<? super V,Boolean> eval)
           Selects only those targets for which the specified evaluator returns false.
 Level2MapEntriesValueSelectedOperator<I,K,V> ifNotNull()
           Selects only those targets which are not null.
 Level2MapEntriesValueSelectedOperator<I,K,V> ifNull()
           Selects only those targets which are null.
 Level2MapEntriesValueSelectedOperator<I,K,V> ifTrue(IFunction<? super V,Boolean> eval)
           Selects only those targets for which the specified evaluator returns true.
 Level2MapEntriesValueOperator<I,K,V> replaceIfNullWith(V replacement)
           Replaces the current target object with the specified replacement if the current target is null.
 Level2MapEntriesValueOperator<I,K,V> replaceWith(V replacement)
           Replaces the current target object with the specified 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

Level2MapEntriesValueOperator

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

get

public Map<K,V> get()
Description copied from interface: UniqOpOperator

Returns the target object this operator currently holds.

Specified by:
get in interface UniqOpOperator<I,Map<K,V>>
Returns:
the target object.

ifTrue

public Level2MapEntriesValueSelectedOperator<I,K,V> ifTrue(IFunction<? super V,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 ILevel2MapEntriesValueOperator<I,K,V>
Specified by:
ifTrue in interface SelectableMapEntryComponentOperator<V>
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 Level2MapEntriesValueSelectedOperator<I,K,V> ifFalse(IFunction<? super V,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 ILevel2MapEntriesValueOperator<I,K,V>
Specified by:
ifFalse in interface SelectableMapEntryComponentOperator<V>
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 Level2MapEntriesValueSelectedOperator<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 ILevel2MapEntriesValueOperator<I,K,V>
Specified by:
ifNotNull in interface SelectableMapEntryComponentOperator<V>
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifNull

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

exec

public <X> Level2MapEntriesValueOperator<I,K,X> exec(IFunction<? super V,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 ILevel2MapEntriesValueOperator<I,K,V>
Specified by:
exec in interface ExecutableOperator<V>
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 Level2MapEntriesValueOperator<I,K,V> replaceWith(V replacement)
Description copied from interface: ReplaceableOperator

Replaces the current target object with the specified replacement.

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

replaceIfNullWith

public Level2MapEntriesValueOperator<I,K,V> replaceIfNullWith(V 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 ILevel2MapEntriesValueOperator<I,K,V>
Specified by:
replaceIfNullWith in interface ReplaceableIfNullOperator<V>
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.

execIfFalse

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

execIfNotNull

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

execIfNull

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