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

Object
  extended by org.op4j.operators.impl.AbstractOperator
      extended by org.op4j.operators.impl.fn.map.Level1MapSelectedEntriesOperator<I,K,V>
All Implemented Interfaces:
ILevel1MapSelectedEntriesOperator<I,K,V>, ExecutableMapEntrySelectedOperator<K,V>, NavigableMapEntryOperator, NavigatingMapOperator<K,V>, Operator, ReplaceableOperator<Map.Entry<K,V>>, SelectableMapEntryOperator<K,V>, UniqFnOperator<I,Map<K,V>>, UniqOperator<Map<K,V>>

public final class Level1MapSelectedEntriesOperator<I,K,V>
extends AbstractOperator
implements UniqFnOperator<I,Map<K,V>>, ILevel1MapSelectedEntriesOperator<I,K,V>


Constructor Summary
Level1MapSelectedEntriesOperator(Target target)
           
 
Method Summary
 Level0MapSelectedOperator<I,K,V> endFor()
           Ends the current iteration.
 Level1MapSelectedEntriesOperator<I,K,V> execAsMapEntry(IFunction<? super Map.Entry<K,V>,? extends Map.Entry<? extends K,? extends V>> function)
           Executes the specified function on the target mape entry, creating a new map entry operator containing the result of the execution.
 Function<I,Map<K,V>> get()
           Returns a function which will execute all the logic specified from the "Fn.on" expression.
 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifFalse(IFunction<? super Map.Entry<K,V>,Boolean> eval)
           Selects only those targets for which the specified evaluator returns false.
 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifIndex(int... indexes)
           Selects only those targets which index in the current level of iteration matches any of the specified indexes.
 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifIndexNot(int... indexes)
           Selects only those targets which index in the current level of iteration does not match any of the specified indexes.
 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifKeyEquals(K... keys)
           Selects only those entries which key matches any of the specified values.
 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifKeyNotEquals(K... keys)
           Selects only those entries which key does not match any of the specified values.
 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifTrue(IFunction<? super Map.Entry<K,V>,Boolean> eval)
           Selects only those targets for which the specified evaluator returns true.
 Level2MapSelectedEntriesKeyOperator<I,K,V> onKey()
           Accesses the key of a map entry.
 Level2MapSelectedEntriesValueOperator<I,K,V> onValue()
           Accesses the value of a map entry.
 Level1MapSelectedEntriesOperator<I,K,V> replaceWith(Map.Entry<K,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

Level1MapSelectedEntriesOperator

public Level1MapSelectedEntriesOperator(Target target)
Method Detail

ifTrue

public Level1MapSelectedEntriesSelectedOperator<I,K,V> ifTrue(IFunction<? super Map.Entry<K,V>,Boolean> eval)
Description copied from interface: SelectableMapEntryOperator

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 ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
ifTrue in interface SelectableMapEntryOperator<K,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 Level1MapSelectedEntriesSelectedOperator<I,K,V> ifFalse(IFunction<? super Map.Entry<K,V>,Boolean> eval)
Description copied from interface: SelectableMapEntryOperator

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

ifIndex

public Level1MapSelectedEntriesSelectedOperator<I,K,V> ifIndex(int... indexes)
Description copied from interface: SelectableMapEntryOperator

Selects only those targets which index in the current level of iteration matches any of the specified indexes. 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:
ifIndex in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
ifIndex in interface SelectableMapEntryOperator<K,V>
Parameters:
indexes - the indexes of the target objects which will be selected.
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifIndexNot

public Level1MapSelectedEntriesSelectedOperator<I,K,V> ifIndexNot(int... indexes)
Description copied from interface: SelectableMapEntryOperator

Selects only those targets which index in the current level of iteration does not match any of the specified indexes. 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:
ifIndexNot in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
ifIndexNot in interface SelectableMapEntryOperator<K,V>
Parameters:
indexes - the indexes of the target objects which will be selected.
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

endFor

public Level0MapSelectedOperator<I,K,V> endFor()
Description copied from interface: NavigatingMapOperator

Ends the current iteration. After the execution of this method, all subsequent operations will be applied on the iterated map as a whole instead of each entry.

Specified by:
endFor in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
endFor in interface NavigatingMapOperator<K,V>
Returns:
an operator which will execute all operations on the iterated map as a whole.

ifKeyEquals

public Level1MapSelectedEntriesSelectedOperator<I,K,V> ifKeyEquals(K... keys)
Description copied from interface: SelectableMapEntryOperator

Selects only those entries which key matches any of the specified values. 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:
ifKeyEquals in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
ifKeyEquals in interface SelectableMapEntryOperator<K,V>
Parameters:
keys - the key values to be matched
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

ifKeyNotEquals

public Level1MapSelectedEntriesSelectedOperator<I,K,V> ifKeyNotEquals(K... keys)
Description copied from interface: SelectableMapEntryOperator

Selects only those entries which key does not match any of the specified values. 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:
ifKeyNotEquals in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
ifKeyNotEquals in interface SelectableMapEntryOperator<K,V>
Parameters:
keys - the key values to be matched
Returns:
an operator which will execute all subsequent operations only on the selected target objects.

onKey

public Level2MapSelectedEntriesKeyOperator<I,K,V> onKey()
Description copied from interface: NavigableMapEntryOperator

Accesses the key of a map entry. After the execution of this method, all subsequent operations will be performed on the map entry's key, until an "endOn()" method is executed.

Specified by:
onKey in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
onKey in interface NavigableMapEntryOperator
Returns:
an operator which will execute all operations on the key of the map entry.

onValue

public Level2MapSelectedEntriesValueOperator<I,K,V> onValue()
Description copied from interface: NavigableMapEntryOperator

Accesses the value of a map entry. After the execution of this method, all subsequent operations will be performed on the map entry's value, until an "endOn()" method is executed.

Specified by:
onValue in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
onValue in interface NavigableMapEntryOperator
Returns:
an operator which will execute all operations on the value of the map entry.

execAsMapEntry

public Level1MapSelectedEntriesOperator<I,K,V> execAsMapEntry(IFunction<? super Map.Entry<K,V>,? extends Map.Entry<? extends K,? extends V>> function)
Description copied from interface: ExecutableMapEntrySelectedOperator

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

This function does not allow the operator target type to change because a selection ("if") has already been done on the target objects, and this would render the operator inconsistent (some objects would belong to a type and others to another type).

Specified by:
execAsMapEntry in interface ILevel1MapSelectedEntriesOperator<I,K,V>
Specified by:
execAsMapEntry in interface ExecutableMapEntrySelectedOperator<K,V>
Parameters:
function - the function to be executed
Returns:
an operator on the results of function execution

replaceWith

public Level1MapSelectedEntriesOperator<I,K,V> replaceWith(Map.Entry<K,V> replacement)
Description copied from interface: ReplaceableOperator

Replaces the current target object with the specified replacement.

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

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.


Copyright © 2012 The OP4J team. All Rights Reserved.