org.op4j.operators.intf.set
Interface ILevel0SetSelectedOperator<I,T>

All Superinterfaces:
ExecutableSetSelectedOperator<T>, ModifiableCollectionOperator<T>, NavigableCollectionOperator<T>, Operator, ReplaceableOperator<Set<T>>, SelectedOperator<Set<T>>, SortableOperator<T>, UniqOperator<Set<T>>
All Known Implementing Classes:
Level0SetSelectedOperator, Level0SetSelectedOperator

public interface ILevel0SetSelectedOperator<I,T>
extends UniqOperator<Set<T>>, NavigableCollectionOperator<T>, SortableOperator<T>, ModifiableCollectionOperator<T>, SelectedOperator<Set<T>>, ExecutableSetSelectedOperator<T>, ReplaceableOperator<Set<T>>

Since:
1.0
Author:
Daniel Fernández

Method Summary
 ILevel0SetSelectedOperator<I,T> add(T newElement)
           Adds the specified element at the end of the target structure object.
 ILevel0SetSelectedOperator<I,T> addAll(Collection<T> collection)
           Adds all the elements in the specified collection to the target structure object.
 ILevel0SetSelectedOperator<I,T> addAll(T... newElements)
           Adds all the specified elements at the end of the target structure object.
 ILevel0SetOperator<I,T> endIf()
           Ends the selection currently active for this level.
 ILevel0SetSelectedOperator<I,T> execAsSet(IFunction<? super Set<T>,? extends Set<? extends T>> function)
           Executes the specified function on the target set, creating a new set operator containing the result of the execution.
 ILevel1SetSelectedElementsOperator<I,T> forEach()
           Iterates the target collection.
 ILevel0SetSelectedOperator<I,T> insert(int position, T newElement)
           Inserts a new element into the specified position (starting in 0) of the target structure object.
 ILevel0SetSelectedOperator<I,T> insertAll(int position, T... newElements)
           Inserts new elements into the specified position (starting in 0) of the target structure object.
 ILevel0SetSelectedOperator<I,T> map(IFunction<? super T,? extends T> function)
           Executes the specified function on each of the elements, creating a new set operator containing the result of all the executions.
 ILevel0SetSelectedOperator<I,T> removeAllEqual(T... values)
           Removes the specified values from the target structure object.
 ILevel0SetSelectedOperator<I,T> removeAllFalse(IFunction<? super T,Boolean> eval)
           Removes from the target structure object all the elements which evaluate as false using the specified evaluator.
 ILevel0SetSelectedOperator<I,T> removeAllIndexes(int... indexes)
           Removes all the elements in the target structure object which position (index) in it matches one the specified indexes.
 ILevel0SetSelectedOperator<I,T> removeAllIndexesNot(int... indexes)
           Removes all the elements in the target structure object except those which position (index) in it matches one of the specified indexes.
 ILevel0SetSelectedOperator<I,T> removeAllNotNullAndFalse(IFunction<? super T,Boolean> eval)
           Removes from the target structure object all the elements which are not null and evaluate as false using the specified evaluator.
 ILevel0SetSelectedOperator<I,T> removeAllNotNullAndTrue(IFunction<? super T,Boolean> eval)
           Removes from the target structure object all the elements which are not null and evaluate as true using the specified evaluator.
 ILevel0SetSelectedOperator<I,T> removeAllNull()
           Remove all the null elements in the target structure object.
 ILevel0SetSelectedOperator<I,T> removeAllNullOrFalse(IFunction<? super T,Boolean> eval)
           Removes from the target structure object all the elements which either are null or evaluate as false using the specified evaluator.
 ILevel0SetSelectedOperator<I,T> removeAllNullOrTrue(IFunction<? super T,Boolean> eval)
           Removes from the target structure object all the elements which either are null or evaluate as true using the specified evaluator.
 ILevel0SetSelectedOperator<I,T> removeAllTrue(IFunction<? super T,Boolean> eval)
           Removes from the target structure object all the elements which evaluate as true using the specified evaluator.
 ILevel0SetSelectedOperator<I,T> replaceWith(Set<T> replacement)
           Replaces the current target object with the specified replacement.
 ILevel0SetSelectedOperator<I,T> sort()
           Sorts the elements of the structure according to their natural ordering.
 ILevel0SetSelectedOperator<I,T> sort(Comparator<? super T> comparator)
           Sorts the elements of the structure according to the order induced by the specified comparator.
 ILevel0SetSelectedOperator<I,T> sortBy(IFunction<? super T,?> by)
           Sorts the elements of the structure according to the result of executing the specified function.
 

Method Detail

endIf

ILevel0SetOperator<I,T> endIf()
Description copied from interface: SelectedOperator

Ends the selection currently active for this level.

Specified by:
endIf in interface SelectedOperator<Set<T>>
Returns:
an operator which will execute all subsequent operations on all the target objects instead of only on the previously selected ones.

forEach

ILevel1SetSelectedElementsOperator<I,T> forEach()
Description copied from interface: NavigableCollectionOperator

Iterates the target collection. After executing this method, any further operations will be applied on each of the collection elements until an "endFor()" method is called.

Specified by:
forEach in interface NavigableCollectionOperator<T>
Returns:
an operator which will execute all operations on each element of the collection.

sort

ILevel0SetSelectedOperator<I,T> sort()
Description copied from interface: SortableOperator

Sorts the elements of the structure according to their natural ordering.

Specified by:
sort in interface SortableOperator<T>
Returns:
an operator containing the sorted structure as target object.

sort

ILevel0SetSelectedOperator<I,T> sort(Comparator<? super T> comparator)
Description copied from interface: SortableOperator

Sorts the elements of the structure according to the order induced by the specified comparator.

Specified by:
sort in interface SortableOperator<T>
Parameters:
comparator - the comparator to be used.
Returns:
an operator containing the sorted structure as target object.

sortBy

ILevel0SetSelectedOperator<I,T> sortBy(IFunction<? super T,?> by)
Description copied from interface: SortableOperator

Sorts the elements of the structure according to the result of executing the specified function.

Specified by:
sortBy in interface SortableOperator<T>
Parameters:
by - the function to be executed in order to obtain the compared object
Returns:
an operator containing the sorted structure as target object.

add

ILevel0SetSelectedOperator<I,T> add(T newElement)
Description copied from interface: ModifiableCollectionOperator

Adds the specified element at the end of the target structure object.

The original target object is not modified, but copied instead.

Specified by:
add in interface ModifiableCollectionOperator<T>
Parameters:
newElement - the element to be added
Returns:
an operator holding the modified target object

addAll

ILevel0SetSelectedOperator<I,T> addAll(T... newElements)
Description copied from interface: ModifiableCollectionOperator

Adds all the specified elements at the end of the target structure object.

The original target object is not modified, but copied instead.

Specified by:
addAll in interface ModifiableCollectionOperator<T>
Parameters:
newElements - the elements to be added
Returns:
an operator holding the modified target object

insert

ILevel0SetSelectedOperator<I,T> insert(int position,
                                       T newElement)
Description copied from interface: ModifiableCollectionOperator

Inserts a new element into the specified position (starting in 0) of the target structure object.

The original target object is not modified, but copied instead.

Specified by:
insert in interface ModifiableCollectionOperator<T>
Parameters:
position - the position in which the new element will be inserted (starting in 0)
newElement - the element to be inserted
Returns:
an operator holding the modified target object

insertAll

ILevel0SetSelectedOperator<I,T> insertAll(int position,
                                          T... newElements)
Description copied from interface: ModifiableCollectionOperator

Inserts new elements into the specified position (starting in 0) of the target structure object.

The original target object is not modified, but copied instead.

Specified by:
insertAll in interface ModifiableCollectionOperator<T>
Parameters:
position - the position in which the new element will be inserted (starting in 0)
newElements - the elements to be inserted
Returns:
an operator holding the modified target object

addAll

ILevel0SetSelectedOperator<I,T> addAll(Collection<T> collection)
Description copied from interface: ModifiableCollectionOperator

Adds all the elements in the specified collection to the target structure object.

The original target object is not modified, but copied instead.

Specified by:
addAll in interface ModifiableCollectionOperator<T>
Parameters:
collection - the collection containing the elements to be added
Returns:
an operator holding the modified target object

removeAllIndexes

ILevel0SetSelectedOperator<I,T> removeAllIndexes(int... indexes)
Description copied from interface: ModifiableCollectionOperator

Removes all the elements in the target structure object which position (index) in it matches one the specified indexes.

The original target object is not modified, but copied instead.

Specified by:
removeAllIndexes in interface ModifiableCollectionOperator<T>
Parameters:
indexes - the positions of the elements to be removed
Returns:
an operator holding the modified target object

removeAllEqual

ILevel0SetSelectedOperator<I,T> removeAllEqual(T... values)
Description copied from interface: ModifiableCollectionOperator

Removes the specified values from the target structure object.

The original target object is not modified, but copied instead.

Specified by:
removeAllEqual in interface ModifiableCollectionOperator<T>
Parameters:
values - the values to be removed from the target.
Returns:
an operator holding the modified target object

removeAllTrue

ILevel0SetSelectedOperator<I,T> removeAllTrue(IFunction<? super T,Boolean> eval)
Description copied from interface: ModifiableCollectionOperator

Removes from the target structure object all the elements which evaluate as true using the specified evaluator.

The original target object is not modified, but copied instead.

Specified by:
removeAllTrue in interface ModifiableCollectionOperator<T>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified target object

removeAllFalse

ILevel0SetSelectedOperator<I,T> removeAllFalse(IFunction<? super T,Boolean> eval)
Description copied from interface: ModifiableCollectionOperator

Removes from the target structure object all the elements which evaluate as false using the specified evaluator.

The original target object is not modified, but copied instead.

Specified by:
removeAllFalse in interface ModifiableCollectionOperator<T>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified target object

removeAllNullOrFalse

ILevel0SetSelectedOperator<I,T> removeAllNullOrFalse(IFunction<? super T,Boolean> eval)
Description copied from interface: ModifiableCollectionOperator

Removes from the target structure object all the elements which either are null or evaluate as false using the specified evaluator.

The original target object is not modified, but copied instead.

Specified by:
removeAllNullOrFalse in interface ModifiableCollectionOperator<T>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified target object

removeAllNotNullAndFalse

ILevel0SetSelectedOperator<I,T> removeAllNotNullAndFalse(IFunction<? super T,Boolean> eval)
Description copied from interface: ModifiableCollectionOperator

Removes from the target structure object all the elements which are not null and evaluate as false using the specified evaluator.

The original target object is not modified, but copied instead.

Specified by:
removeAllNotNullAndFalse in interface ModifiableCollectionOperator<T>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified target object

removeAllNotNullAndTrue

ILevel0SetSelectedOperator<I,T> removeAllNotNullAndTrue(IFunction<? super T,Boolean> eval)
Description copied from interface: ModifiableCollectionOperator

Removes from the target structure object all the elements which are not null and evaluate as true using the specified evaluator.

The original target object is not modified, but copied instead.

Specified by:
removeAllNotNullAndTrue in interface ModifiableCollectionOperator<T>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified target object

removeAllNullOrTrue

ILevel0SetSelectedOperator<I,T> removeAllNullOrTrue(IFunction<? super T,Boolean> eval)
Description copied from interface: ModifiableCollectionOperator

Removes from the target structure object all the elements which either are null or evaluate as true using the specified evaluator.

The original target object is not modified, but copied instead.

Specified by:
removeAllNullOrTrue in interface ModifiableCollectionOperator<T>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified target object

removeAllIndexesNot

ILevel0SetSelectedOperator<I,T> removeAllIndexesNot(int... indexes)
Description copied from interface: ModifiableCollectionOperator

Removes all the elements in the target structure object except those which position (index) in it matches one of the specified indexes.

The original target object is not modified, but copied instead.

Specified by:
removeAllIndexesNot in interface ModifiableCollectionOperator<T>
Parameters:
indexes - the positions of the elements to be kept
Returns:
an operator holding the modified target object

removeAllNull

ILevel0SetSelectedOperator<I,T> removeAllNull()
Description copied from interface: ModifiableCollectionOperator

Remove all the null elements in the target structure object.

The original target object is not modified, but copied instead.

Specified by:
removeAllNull in interface ModifiableCollectionOperator<T>
Returns:
an operator holding the modified target object

replaceWith

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

Replaces the current target object with the specified replacement.

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

execAsSet

ILevel0SetSelectedOperator<I,T> execAsSet(IFunction<? super Set<T>,? extends Set<? extends T>> function)
Description copied from interface: ExecutableSetSelectedOperator

Executes the specified function on the target set, creating a new set 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:
execAsSet in interface ExecutableSetSelectedOperator<T>
Parameters:
function - the function to be executed
Returns:
an operator on the results of function execution

map

ILevel0SetSelectedOperator<I,T> map(IFunction<? super T,? extends T> function)
Description copied from interface: ExecutableSetSelectedOperator

Executes the specified function on each of the elements, creating a new set operator containing the result of all the executions.

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).

This method is equivalent to forEach().exec(function).endFor().

Specified by:
map in interface ExecutableSetSelectedOperator<T>
Parameters:
function - the function to be executed
Returns:
an operator on the results of function execution on each element


Copyright © 2012 The OP4J team. All Rights Reserved.