jsr166y.forkjoin
Class ParallelArray.WithFilter<T>

java.lang.Object
  extended by jsr166y.forkjoin.ParallelArray.WithMapping<T,T>
      extended by jsr166y.forkjoin.ParallelArray.WithFilter<T>
Direct Known Subclasses:
ParallelArray.WithBounds
Enclosing class:
ParallelArray<T>

public abstract static class ParallelArray.WithFilter<T>
extends ParallelArray.WithMapping<T,T>

A restriction of parallel array operations to apply only to elements for which a selector returns true


Method Summary
abstract  ParallelArray<T> allNonidenticalElements()
          Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates).
abstract  ParallelArray<T> allUniqueElements()
          Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates).
 void apply(Ops.Procedure<? super T> procedure)
          Applies the given procedure to elements
 T max()
          Returns the maximum element, or null if empty assuming that all elements are Comparables
 T max(java.util.Comparator<? super T> comparator)
          Returns the maximum element, or null if empty
 T min()
          Returns the minimum element, or null if empty, assuming that all elements are Comparables
 T min(java.util.Comparator<? super T> comparator)
          Returns the minimum element, or null if empty
abstract  ParallelArray.WithFilter<T> orFilter(Ops.Predicate<? super T> selector)
          Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) or the given selector returns true
 T reduce(Ops.Reducer<T> reducer, T base)
          Returns reduction of elements
abstract  void removeAll()
          Removes from the array all elements matching bound and/or filter constraints.
 void replaceWithCombination(ParallelArray.WithBounds<? extends T> other, Ops.Reducer<T> combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithCombination(ParallelArray<? extends T> other, Ops.Reducer<T> combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithCombination(T[] other, Ops.Reducer<T> combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithGeneratedValue(Ops.Generator<? extends T> generator)
          Replaces elements with results of applying the given generator.
 void replaceWithMappedIndex(Ops.MapperFromInt<? extends T> mapper)
          Replaces elements with the results of applying the given mapper to their indices
 void replaceWithTransform(Ops.Mapper<? super T,? extends T> mapper)
          Replaces elements with the results of applying the given mapper to their current values.
 void replaceWithValue(T value)
          Replaces elements with the given value.
 ParallelArray.SummaryStatistics<T> summary()
          Returns summary statistics, assuming that all elements are Comparables
 ParallelArray.SummaryStatistics<T> summary(java.util.Comparator<? super T> comparator)
          Returns summary statistics, using the given comparator to locate minimum and maximum elements.
abstract  ParallelArray.WithFilter<T> withFilter(Ops.Predicate<? super T> selector)
          Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given selector returns true
 
Methods inherited from class jsr166y.forkjoin.ParallelArray.WithMapping
all, all, any, anyIndex, size, withMapping, withMapping, withMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

apply

public void apply(Ops.Procedure<? super T> procedure)
Description copied from class: ParallelArray.WithMapping
Applies the given procedure to elements

Overrides:
apply in class ParallelArray.WithMapping<T,T>
Parameters:
procedure - the procedure

reduce

public T reduce(Ops.Reducer<T> reducer,
                T base)
Description copied from class: ParallelArray.WithMapping
Returns reduction of elements

Overrides:
reduce in class ParallelArray.WithMapping<T,T>
Parameters:
reducer - the reducer
base - the result for an empty array
Returns:
reduction

min

public T min(java.util.Comparator<? super T> comparator)
Description copied from class: ParallelArray.WithMapping
Returns the minimum element, or null if empty

Overrides:
min in class ParallelArray.WithMapping<T,T>
Parameters:
comparator - the comparator
Returns:
minimum element, or null if empty

min

public T min()
Description copied from class: ParallelArray.WithMapping
Returns the minimum element, or null if empty, assuming that all elements are Comparables

Overrides:
min in class ParallelArray.WithMapping<T,T>
Returns:
minimum element, or null if empty

max

public T max(java.util.Comparator<? super T> comparator)
Description copied from class: ParallelArray.WithMapping
Returns the maximum element, or null if empty

Overrides:
max in class ParallelArray.WithMapping<T,T>
Parameters:
comparator - the comparator
Returns:
maximum element, or null if empty

max

public T max()
Description copied from class: ParallelArray.WithMapping
Returns the maximum element, or null if empty assuming that all elements are Comparables

Overrides:
max in class ParallelArray.WithMapping<T,T>
Returns:
maximum element, or null if empty

summary

public ParallelArray.SummaryStatistics<T> summary(java.util.Comparator<? super T> comparator)
Description copied from class: ParallelArray.WithMapping
Returns summary statistics, using the given comparator to locate minimum and maximum elements.

Overrides:
summary in class ParallelArray.WithMapping<T,T>
Parameters:
comparator - the comparator to use for locating minimum and maximum elements
Returns:
the summary.

summary

public ParallelArray.SummaryStatistics<T> summary()
Description copied from class: ParallelArray.WithMapping
Returns summary statistics, assuming that all elements are Comparables

Overrides:
summary in class ParallelArray.WithMapping<T,T>
Returns:
the summary.

replaceWithTransform

public void replaceWithTransform(Ops.Mapper<? super T,? extends T> mapper)
Replaces elements with the results of applying the given mapper to their current values.

Parameters:
mapper - the mapper

replaceWithMappedIndex

public void replaceWithMappedIndex(Ops.MapperFromInt<? extends T> mapper)
Replaces elements with the results of applying the given mapper to their indices

Parameters:
mapper - the mapper

replaceWithGeneratedValue

public void replaceWithGeneratedValue(Ops.Generator<? extends T> generator)
Replaces elements with results of applying the given generator.

Parameters:
generator - the generator

replaceWithValue

public void replaceWithValue(T value)
Replaces elements with the given value.

Parameters:
value - the value

replaceWithCombination

public void replaceWithCombination(ParallelArray<? extends T> other,
                                   Ops.Reducer<T> combiner)
Replaces elements with results of applying combine(thisElement, otherElement)

Parameters:
other - the other array
combiner - the combiner
Throws:
java.lang.ArrayIndexOutOfBoundsException - if other array has fewer than upperBound elements.

replaceWithCombination

public void replaceWithCombination(ParallelArray.WithBounds<? extends T> other,
                                   Ops.Reducer<T> combiner)
Replaces elements with results of applying combine(thisElement, otherElement)

Parameters:
other - the other array segment
combiner - the combiner
Throws:
java.lang.ArrayIndexOutOfBoundsException - if other array has fewer than upperBound elements.

replaceWithCombination

public void replaceWithCombination(T[] other,
                                   Ops.Reducer<T> combiner)
Replaces elements with results of applying combine(thisElement, otherElement)

Parameters:
other - the other array
combiner - the combiner
Throws:
java.lang.ArrayIndexOutOfBoundsException - if other array has fewer than upperBound elements.

removeAll

public abstract void removeAll()
Removes from the array all elements matching bound and/or filter constraints.


allUniqueElements

public abstract ParallelArray<T> allUniqueElements()
Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates). This method uses each element's equals method to test for duplication.

Returns:
the new ParallelArray

allNonidenticalElements

public abstract ParallelArray<T> allNonidenticalElements()
Returns a new ParallelArray containing only non-null unique elements (that is, without any duplicates). This method uses reference identity to test for duplication.

Returns:
the new ParallelArray

withFilter

public abstract ParallelArray.WithFilter<T> withFilter(Ops.Predicate<? super T> selector)
Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) and the given selector returns true

Parameters:
selector - the selector
Returns:
operation prefix

orFilter

public abstract ParallelArray.WithFilter<T> orFilter(Ops.Predicate<? super T> selector)
Returns an operation prefix that causes a method to operate only on elements for which the current selector (if present) or the given selector returns true

Parameters:
selector - the selector
Returns:
operation prefix