org.op4j.operators.impl.fn.array
Class Level1ArraySelectedElementsOperator<I,T>

Object
  extended by org.op4j.operators.impl.AbstractOperator
      extended by org.op4j.operators.impl.fn.array.Level1ArraySelectedElementsOperator<I,T>
All Implemented Interfaces:
ILevel1ArraySelectedElementsOperator<I,T>, ExecutableSelectedOperator<T>, NavigatingCollectionOperator<T>, Operator, ReplaceableOperator<T>, SelectableElementsOperator<T>, UniqFnOperator<I,T[]>, UniqOperator<T[]>

public final class Level1ArraySelectedElementsOperator<I,T>
extends AbstractOperator
implements UniqFnOperator<I,T[]>, ILevel1ArraySelectedElementsOperator<I,T>


Constructor Summary
Level1ArraySelectedElementsOperator(org.javaruntype.type.Type<T> type, Target target)
           
 
Method Summary
 Level0ArraySelectedOperator<I,T> endFor()
           Ends the current iteration.
 Level1ArraySelectedElementsOperator<I,T> exec(IFunction<? super T,? extends T> function)
           Executes the specified function on the target object, creating a new operator containing the result of the execution.
 Function<I,T[]> get()
           Returns a function which will execute all the logic specified from the "Fn.on" expression.
 Level1ArraySelectedElementsSelectedOperator<I,T> ifFalse(IFunction<? super T,Boolean> eval)
           Selects only those targets for which the specified evaluator returns false.
 Level1ArraySelectedElementsSelectedOperator<I,T> ifIndex(int... indexes)
           Selects only those targets which index in the current level of iteration matches any of the specified indexes.
 Level1ArraySelectedElementsSelectedOperator<I,T> ifIndexNot(int... indexes)
           Selects only those targets which index in the current level of iteration does not match any of the specified indexes.
 Level1ArraySelectedElementsSelectedOperator<I,T> ifNotNull()
           Selects only those targets which are not null.
 Level1ArraySelectedElementsSelectedOperator<I,T> ifNotNullAndFalse(IFunction<? super T,Boolean> eval)
           
 Level1ArraySelectedElementsSelectedOperator<I,T> ifNotNullAndTrue(IFunction<? super T,Boolean> eval)
           
 Level1ArraySelectedElementsSelectedOperator<I,T> ifNull()
           Selects only those targets which are null.
 Level1ArraySelectedElementsSelectedOperator<I,T> ifNullOrFalse(IFunction<? super T,Boolean> eval)
           
 Level1ArraySelectedElementsSelectedOperator<I,T> ifNullOrTrue(IFunction<? super T,Boolean> eval)
           
 Level1ArraySelectedElementsSelectedOperator<I,T> ifTrue(IFunction<? super T,Boolean> eval)
           Selects only those targets for which the specified evaluator returns true.
 Level1ArraySelectedElementsOperator<I,T> replaceWith(T 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

Level1ArraySelectedElementsOperator

public Level1ArraySelectedElementsOperator(org.javaruntype.type.Type<T> type,
                                           Target target)
Method Detail

ifTrue

public Level1ArraySelectedElementsSelectedOperator<I,T> ifTrue(IFunction<? super T,Boolean> eval)
Description copied from interface: SelectableElementsOperator

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 ILevel1ArraySelectedElementsOperator<I,T>
Specified by:
ifTrue in interface SelectableElementsOperator<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

public Level1ArraySelectedElementsSelectedOperator<I,T> ifFalse(IFunction<? super T,Boolean> eval)
Description copied from interface: SelectableElementsOperator

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 ILevel1ArraySelectedElementsOperator<I,T>
Specified by:
ifFalse in interface SelectableElementsOperator<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

public Level1ArraySelectedElementsSelectedOperator<I,T> ifNull()
Description copied from interface: SelectableElementsOperator

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

ifNotNull

public Level1ArraySelectedElementsSelectedOperator<I,T> ifNotNull()
Description copied from interface: SelectableElementsOperator

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

ifIndex

public Level1ArraySelectedElementsSelectedOperator<I,T> ifIndex(int... indexes)
Description copied from interface: SelectableElementsOperator

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 ILevel1ArraySelectedElementsOperator<I,T>
Specified by:
ifIndex in interface SelectableElementsOperator<T>
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 Level1ArraySelectedElementsSelectedOperator<I,T> ifIndexNot(int... indexes)
Description copied from interface: SelectableElementsOperator

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 ILevel1ArraySelectedElementsOperator<I,T>
Specified by:
ifIndexNot in interface SelectableElementsOperator<T>
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 Level0ArraySelectedOperator<I,T> endFor()
Description copied from interface: NavigatingCollectionOperator

Ends the current iteration. After the execution of this method, all subsequent operations will be applied on the iterated collection as a whole instead of in a by-element basis.

Specified by:
endFor in interface ILevel1ArraySelectedElementsOperator<I,T>
Specified by:
endFor in interface NavigatingCollectionOperator<T>
Returns:
an operator which will execute all operations on the iterated collection as a whole.

ifNullOrFalse

public Level1ArraySelectedElementsSelectedOperator<I,T> ifNullOrFalse(IFunction<? super T,Boolean> eval)
Specified by:
ifNullOrFalse in interface ILevel1ArraySelectedElementsOperator<I,T>

ifNotNullAndFalse

public Level1ArraySelectedElementsSelectedOperator<I,T> ifNotNullAndFalse(IFunction<? super T,Boolean> eval)
Specified by:
ifNotNullAndFalse in interface ILevel1ArraySelectedElementsOperator<I,T>

ifNullOrTrue

public Level1ArraySelectedElementsSelectedOperator<I,T> ifNullOrTrue(IFunction<? super T,Boolean> eval)
Specified by:
ifNullOrTrue in interface ILevel1ArraySelectedElementsOperator<I,T>

ifNotNullAndTrue

public Level1ArraySelectedElementsSelectedOperator<I,T> ifNotNullAndTrue(IFunction<? super T,Boolean> eval)
Specified by:
ifNotNullAndTrue in interface ILevel1ArraySelectedElementsOperator<I,T>

exec

public Level1ArraySelectedElementsOperator<I,T> exec(IFunction<? super T,? extends T> function)
Description copied from interface: ExecutableSelectedOperator

Executes the specified function on the target object, creating a new 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:
exec in interface ILevel1ArraySelectedElementsOperator<I,T>
Specified by:
exec in interface ExecutableSelectedOperator<T>
Parameters:
function - the function to be executed
Returns:
an operator on the results of function execution

replaceWith

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

Replaces the current target object with the specified replacement.

Specified by:
replaceWith in interface ILevel1ArraySelectedElementsOperator<I,T>
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.

get

public Function<I,T[]> 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,T[]>
Returns:
the function.


Copyright © 2012 The OP4J team. All Rights Reserved.