jsr166z.forkjoin
Class ParallelDoubleArray.WithFilter

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

public abstract static class ParallelDoubleArray.WithFilter
extends ParallelDoubleArray.WithDoubleMapping

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


Method Summary
 double any()
          Returns some element matching bound and filter constraints
 void apply({double=>void} procedure)
          Applies the given procedure
 int indexOfMax()
          Returns the index corresponding to the greatest element or -1 if empty, assuming that all elements are Comparables
 int indexOfMax({double,double=>int} comparator)
          Returns the index corresponding to the greatest element, or -1 if empty
 int indexOfMin()
          Returns the index corresponding to the least element or -1 if empty, assuming that all elements are Comparables
 int indexOfMin({double,double=>int} comparator)
          Returns the index corresponding to the least element or -1 if empty
 double max()
          Returns the maximum element, or -Double.MAX_VALUE if empty assuming that all elements are Comparables
 double max({double,double=>int} comparator)
          Returns the maximum element, or -Double.MAX_VALUE if empty
 double min()
          Returns the minimum element, or Double.MAX_VALUE if empty, assuming that all elements are Comparables
 double min({double,double=>int} comparator)
          Returns the minimum element, or Double.MAX_VALUE if empty
abstract  ParallelDoubleArray newArray()
          Returns a new ParallelArray holding elements
 void randomFill()
          Sets each element to a uniform random value having the same properties as Random.nextDouble()
 double reduce({double,double=>double} reducer, double base)
          Returns reduction of elements
 void replaceWithCombination(double[] other, {double,double=>double} combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithCombination(ParallelDoubleArray other, {double,double=>double} combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithGeneratedValue({=>double} generator)
          Replaces elements with results of applying the given generator.
 void replaceWithMappedIndex({int=>double} mapper)
          Replaces elements with the results of applying the given mapper to their indices
 void replaceWithTransform({double=>double} mapper)
          Replaces elements with the results of applying the given mapper to their current values.
 void replaceWithValue(double value)
          Replaces elements with the given value.
 double sum()
          Returns the sum of elements
abstract  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.
abstract  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.
abstract  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.
abstract
<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.WithDoubleMapping
anyIndex, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

apply

public void apply({double=>void} procedure)
Applies the given procedure

Overrides:
apply in class ParallelDoubleArray.WithDoubleMapping
Parameters:
procedure - the procedure

reduce

public double reduce({double,double=>double} reducer,
                     double base)
Returns reduction of elements

Overrides:
reduce in class ParallelDoubleArray.WithDoubleMapping
Parameters:
reducer - the reducer
base - the result for an empty array
Returns:
reduction

sum

public double sum()
Returns the sum of elements

Overrides:
sum in class ParallelDoubleArray.WithDoubleMapping
Returns:
the sum of elements

min

public double min({double,double=>int} comparator)
Returns the minimum element, or Double.MAX_VALUE if empty

Overrides:
min in class ParallelDoubleArray.WithDoubleMapping
Parameters:
comparator - the comparator
Returns:
minimum element, or Double.MAX_VALUE if empty

min

public double min()
Returns the minimum element, or Double.MAX_VALUE if empty, assuming that all elements are Comparables

Overrides:
min in class ParallelDoubleArray.WithDoubleMapping
Returns:
minimum element, or Double.MAX_VALUE if empty

max

public double max({double,double=>int} comparator)
Returns the maximum element, or -Double.MAX_VALUE if empty

Overrides:
max in class ParallelDoubleArray.WithDoubleMapping
Parameters:
comparator - the comparator
Returns:
maximum element, or -Double.MAX_VALUE if empty

max

public double max()
Returns the maximum element, or -Double.MAX_VALUE if empty assuming that all elements are Comparables

Overrides:
max in class ParallelDoubleArray.WithDoubleMapping
Returns:
maximum element, or -Double.MAX_VALUE if empty

indexOfMin

public int indexOfMin({double,double=>int} comparator)
Returns the index corresponding to the least element or -1 if empty

Overrides:
indexOfMin in class ParallelDoubleArray.WithDoubleMapping
Parameters:
comparator - the comparator
Returns:
the index of least element or -1 if empty.

indexOfMax

public int indexOfMax({double,double=>int} comparator)
Returns the index corresponding to the greatest element, or -1 if empty

Overrides:
indexOfMax in class ParallelDoubleArray.WithDoubleMapping
Parameters:
comparator - the comparator
Returns:
the index of greatest element or -1 if empty.

indexOfMin

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

Overrides:
indexOfMin in class ParallelDoubleArray.WithDoubleMapping
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 element or -1 if empty, assuming that all elements are Comparables

Overrides:
indexOfMax in class ParallelDoubleArray.WithDoubleMapping
Returns:
the index of greatest element or -1 if empty.
Throws:
java.lang.ClassCastException - if any element is not Comparable.

newArray

public abstract ParallelDoubleArray newArray()
Returns a new ParallelArray holding elements

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

replaceWithTransform

public void replaceWithTransform({double=>double} mapper)
Replaces elements with the results of applying the given mapper to their current values.

Parameters:
mapper - the mapper

replaceWithMappedIndex

public void replaceWithMappedIndex({int=>double} mapper)
Replaces elements with the results of applying the given mapper to their indices

Parameters:
mapper - the mapper

replaceWithGeneratedValue

public void replaceWithGeneratedValue({=>double} generator)
Replaces elements with results of applying the given generator.

Parameters:
generator - the generator

randomFill

public void randomFill()
Sets each element to a uniform random value having the same properties as Random.nextDouble()


replaceWithValue

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

Parameters:
value - the value

replaceWithCombination

public void replaceWithCombination(ParallelDoubleArray other,
                                   {double,double=>double} 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(double[] other,
                                   {double,double=>double} 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.

any

public double any()
Returns some element matching bound and filter constraints

Specified by:
any in class ParallelDoubleArray.WithDoubleMapping
Returns:
matching element
Throws:
java.util.NoSuchElementException - if empty

withMapping

public abstract <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.

Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public abstract 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.

Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public abstract 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.

Parameters:
mapper - the mapper
Returns:
operation prefix

withMapping

public abstract 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.

Parameters:
mapper - the mapper
Returns:
operation prefix