jsr166z.forkjoin
Class ParallelDoubleArray.WithBounds

java.lang.Object
  extended by jsr166z.forkjoin.ParallelDoubleArray.WithDoubleMapping
      extended by jsr166z.forkjoin.ParallelDoubleArray.WithFilter
          extended by jsr166z.forkjoin.ParallelDoubleArray.WithBounds
Enclosing class:
ParallelDoubleArray

public static final class ParallelDoubleArray.WithBounds
extends ParallelDoubleArray.WithFilter

A restriction of parallel array operations to apply only within a given range of indices.


Method Summary
 int anyIndex()
          Returns the index of some element matching bound filter constraints, or -1 if none.
 ParallelDoubleArray combine(double[] other, {double,double=>double} combiner)
          Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element.
 ParallelDoubleArray combine(ParallelDoubleArray other, {double,double=>double} combiner)
          Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element.
 void cumulate({double,double=>double} reducer, double base)
          Replaces each element with the running cumulation of applying the given reducer.
 void cumulateSum()
          Replaces each element with the running sum
 ParallelDoubleArray newArray()
          Returns a new ParallelArray holding elements
 double precumulate({double,double=>double} reducer, double base)
          Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction.
 double precumulateSum()
          Replaces each element with its prefix sum
 int size()
          Returns the number of elements within bounds
 void sort()
          Sorts the elements, using natural comparator
 void sort({double,double=>int} cmp)
          Sorts the elements.
 ParallelDoubleArray.WithFilter withFilter({double=>boolean} selector)
          Returns an operation prefix that causes a method to operate only on the elements of the array for which the given selector returns true
 ParallelDoubleArray.WithDoubleMapping withMapping({double=>double} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
 ParallelDoubleArray.WithIntMapping withMapping({double=>int} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
 ParallelDoubleArray.WithLongMapping withMapping({double=>long} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
<U> ParallelDoubleArray.WithMapping<U>
withMapping({double=>U} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
 
Methods inherited from class jsr166z.forkjoin.ParallelDoubleArray.WithFilter
any, apply, indexOfMax, indexOfMax, indexOfMin, indexOfMin, max, max, min, min, randomFill, reduce, replaceWithCombination, replaceWithCombination, replaceWithGeneratedValue, replaceWithMappedIndex, replaceWithTransform, replaceWithValue, sum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

withFilter

public ParallelDoubleArray.WithFilter withFilter({double=>boolean} selector)
Returns an operation prefix that causes a method to operate only on the elements of the array for which the given selector returns true

Parameters:
selector - the selector
Returns:
operation prefix

withMapping

public <U> ParallelDoubleArray.WithMapping<U> withMapping({double=>U} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.

Specified by:
withMapping in class ParallelDoubleArray.WithFilter
Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public ParallelDoubleArray.WithDoubleMapping withMapping({double=>double} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.

Specified by:
withMapping in class ParallelDoubleArray.WithFilter
Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public ParallelDoubleArray.WithLongMapping withMapping({double=>long} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.

Specified by:
withMapping in class ParallelDoubleArray.WithFilter
Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public ParallelDoubleArray.WithIntMapping withMapping({double=>int} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.

Specified by:
withMapping in class ParallelDoubleArray.WithFilter
Parameters:
mapper - the mapper
Returns:
operation prefix

anyIndex

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

Specified by:
anyIndex in class ParallelDoubleArray.WithDoubleMapping
Returns:
index of matching element, or -1 if none.

combine

public ParallelDoubleArray combine(double[] other,
                                   {double,double=>double} combiner)
Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element.

Parameters:
other - the other array
combiner - the combiner
Returns:
the array of mappings
Throws:
java.lang.ArrayIndexOutOfBoundsException - if other array is shorter than this array.

combine

public ParallelDoubleArray combine(ParallelDoubleArray other,
                                   {double,double=>double} combiner)
Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element.

Parameters:
other - the other array
combiner - the combiner
Returns:
the array of mappings
Throws:
java.lang.ArrayIndexOutOfBoundsException - if other array is shorter than this array.

size

public int size()
Returns the number of elements within bounds

Specified by:
size in class ParallelDoubleArray.WithDoubleMapping
Returns:
the number of elements within bounds

cumulate

public void cumulate({double,double=>double} reducer,
                     double base)
Replaces each element with the running cumulation of applying the given reducer.

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

cumulateSum

public void cumulateSum()
Replaces each element with the running sum


precumulate

public double precumulate({double,double=>double} reducer,
                          double base)
Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction.

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

precumulateSum

public double precumulateSum()
Replaces each element with its prefix sum

Returns:
the total sum

sort

public void sort({double,double=>int} cmp)
Sorts the elements.

Parameters:
cmp - the comparator to use

sort

public void sort()
Sorts the elements, using natural comparator


newArray

public ParallelDoubleArray newArray()
Description copied from class: ParallelDoubleArray.WithFilter
Returns a new ParallelArray holding elements

Specified by:
newArray in class ParallelDoubleArray.WithFilter
Returns:
a new ParallelArray holding elements