jsr166z.forkjoin
Class ParallelIntArray.WithMapping<U>

java.lang.Object
  extended by jsr166z.forkjoin.ParallelIntArray.WithMapping<U>
Enclosing class:
ParallelIntArray

public abstract static class ParallelIntArray.WithMapping<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  U any()
          Returns mapping of 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({U=>void} procedure)
          Applies the given procedure to mapped elements
 int indexOfMax()
          Returns the index corresponding to the greatest mapped element or -1 if empty, assuming that all elements are Comparables
 int indexOfMax(java.util.Comparator<? super U> comparator)
          Returns the index corresponding to the greatest mapped element, or -1 if empty
 int indexOfMin()
          Returns the index corresponding to the least mapped element or -1 if empty, assuming that all elements are Comparables
 int indexOfMin(java.util.Comparator<? super U> comparator)
          Returns the index corresponding to the least mapped element or -1 if empty
 U max()
          Returns the maximum mapped element, or null if empty assuming that all elements are Comparables
 U max(java.util.Comparator<? super U> comparator)
          Returns the maximum mapped element, or null if empty
 U min()
          Returns the minimum mapped element, or null if empty, assuming that all elements are Comparables
 U min(java.util.Comparator<? super U> comparator)
          Returns the minimum mapped element, or null if empty
abstract  ParallelArray<U> newArray()
          Returns a new ParallelArray holding mapped elements
abstract  ParallelArray<U> newArray(java.lang.Class<? super U> elementType)
          Returns a new ParallelArray with the given element type holding mapped elements
 U reduce({U,U=>U} reducer, U base)
          Returns reduction of mapped elements
abstract  int size()
          Return the number of elements selected using bound or filter restrictions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

apply

public void apply({U=>void} procedure)
Applies the given procedure to mapped elements

Parameters:
procedure - the procedure

reduce

public U reduce({U,U=>U} reducer,
                U base)
Returns reduction of mapped 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 mapping of some element matching bound and filter constraints, or null if none.

Returns:
mapping of matching element, or null if none.

min

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

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

min

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

Returns:
minimum mapped 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 mapped element, or null if empty

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

max

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

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

indexOfMin

public int indexOfMin(java.util.Comparator<? super U> comparator)
Returns the index corresponding to the least mapped element or -1 if empty

Parameters:
comparator - the comparator
Returns:
the index of least mapped element or -1 if empty.

indexOfMax

public int indexOfMax(java.util.Comparator<? super U> comparator)
Returns the index corresponding to the greatest mapped element, or -1 if empty

Parameters:
comparator - the comparator
Returns:
the index of greatest mapped element or -1 if empty.

indexOfMin

public int indexOfMin()
Returns the index corresponding to the least mapped element or -1 if empty, assuming that all elements are Comparables

Returns:
the index of least element or -1 if empty.
Throws:
java.lang.ClassCastException - if any element is not Comparable.

indexOfMax

public int indexOfMax()
Returns the index corresponding to the greatest mapped element or -1 if empty, assuming that all elements are Comparables

Returns:
the index of greatest mapped element or -1 if empty.
Throws:
java.lang.ClassCastException - if any element is not Comparable.

newArray

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

Returns:
a new ParallelArray holding mapped elements

newArray

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

Parameters:
elementType - the type of the elements
Returns:
a new ParallelArray holding mapped 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