jsr166y.forkjoin
Class ParallelArray.WithMapping<T,U>

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

public abstract static class ParallelArray.WithMapping<T,U>
extends java.lang.Object

A modifier for parallel array operations to apply to mappings of elements, not to the elements themselves


Method Summary
abstract  ParallelArray<U> all()
          Returns a new ParallelArray holding elements
abstract  ParallelArray<U> all(java.lang.Class<? super U> elementType)
          Returns a new ParallelArray with the given element type holding elements
abstract  U any()
          Returns some element matching bound and filter constraints, or null if none.
abstract  int anyIndex()
          Returns the index of some element matching bound and filter constraints, or -1 if none.
 void apply(Ops.Procedure<? super U> procedure)
          Applies the given procedure to elements
 U max()
          Returns the maximum element, or null if empty assuming that all elements are Comparables
 U max(java.util.Comparator<? super U> comparator)
          Returns the maximum element, or null if empty
 U min()
          Returns the minimum element, or null if empty, assuming that all elements are Comparables
 U min(java.util.Comparator<? super U> comparator)
          Returns the minimum element, or null if empty
 U reduce(Ops.Reducer<U> reducer, U base)
          Returns reduction of elements
abstract  int size()
          Return the number of elements selected using bound or filter restrictions.
 ParallelArray.SummaryStatistics<U> summary()
          Returns summary statistics, assuming that all elements are Comparables
 ParallelArray.SummaryStatistics<U> summary(java.util.Comparator<? super U> comparator)
          Returns summary statistics, using the given comparator to locate minimum and maximum elements.
abstract
<V> ParallelArray.WithMapping<T,V>
withMapping(Ops.Mapper<? super U,? extends V> mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper applied to current mapper's results
abstract  ParallelArray.WithDoubleMapping<T> withMapping(Ops.MapperToDouble<? super U> mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper applied to current mapper's results
abstract  ParallelArray.WithLongMapping<T> withMapping(Ops.MapperToLong<? super U> mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper applied to current mapper's results
 
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 U> procedure)
Applies the given procedure to elements

Parameters:
procedure - the procedure

reduce

public U reduce(Ops.Reducer<U> reducer,
                U base)
Returns reduction of elements

Parameters:
reducer - the reducer
base - the result for an empty array
Returns:
reduction

anyIndex

public abstract int anyIndex()
Returns the index of some element matching bound and filter constraints, or -1 if none.

Returns:
index of matching element, or -1 if none.

any

public abstract U any()
Returns some element matching bound and filter constraints, or null if none.

Returns:
an element, or null if none.

min

public U min(java.util.Comparator<? super U> comparator)
Returns the minimum element, or null if empty

Parameters:
comparator - the comparator
Returns:
minimum element, or null if empty

min

public U min()
Returns the minimum element, or null if empty, assuming that all elements are Comparables

Returns:
minimum element, or null if empty
Throws:
java.lang.ClassCastException - if any element is not Comparable.

max

public U max(java.util.Comparator<? super U> comparator)
Returns the maximum element, or null if empty

Parameters:
comparator - the comparator
Returns:
maximum element, or null if empty

max

public U max()
Returns the maximum element, or null if empty assuming that all elements are Comparables

Returns:
maximum element, or null if empty
Throws:
java.lang.ClassCastException - if any element is not Comparable.

summary

public ParallelArray.SummaryStatistics<U> summary(java.util.Comparator<? super U> comparator)
Returns summary statistics, using the given comparator to locate minimum and maximum elements.

Parameters:
comparator - the comparator to use for locating minimum and maximum elements
Returns:
the summary.

summary

public ParallelArray.SummaryStatistics<U> summary()
Returns summary statistics, assuming that all elements are Comparables

Returns:
the summary.

all

public abstract ParallelArray<U> all()
Returns a new ParallelArray holding elements

Returns:
a new ParallelArray holding elements

all

public abstract ParallelArray<U> all(java.lang.Class<? super U> elementType)
Returns a new ParallelArray with the given element type holding elements

Parameters:
elementType - the type of the elements
Returns:
a new ParallelArray holding elements

size

public abstract int size()
Return the number of elements selected using bound or filter restrictions. Note that this method must evaluate all selectors to return its result.

Returns:
the number of elements

withMapping

public abstract <V> ParallelArray.WithMapping<T,V> withMapping(Ops.Mapper<? super U,? extends V> mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper applied to current mapper's results

Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public abstract ParallelArray.WithDoubleMapping<T> withMapping(Ops.MapperToDouble<? super U> mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper applied to current mapper's results

Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public abstract ParallelArray.WithLongMapping<T> withMapping(Ops.MapperToLong<? super U> mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper applied to current mapper's results

Parameters:
mapper - the mapper
Returns:
operation prefix