jsr166z.forkjoin
Class ParallelLongArray.WithFilter

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

public abstract static class ParallelLongArray.WithFilter
extends ParallelLongArray.WithLongMapping

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


Method Summary
 long any()
          Returns some element matching bound and filter constraints
 void apply({long=>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({long,long=>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({long,long=>int} comparator)
          Returns the index corresponding to the least element or -1 if empty
 long max()
          Returns the maximum element, or Long.MIN_VALUE if empty assuming that all elements are Comparables
 long max({long,long=>int} comparator)
          Returns the maximum element, or Long.MIN_VALUE if empty
 long min()
          Returns the minimum element, or Long.MAX_VALUE if empty, assuming that all elements are Comparables
 long min({long,long=>int} comparator)
          Returns the minimum element, or Long.MAX_VALUE if empty
abstract  ParallelLongArray newArray()
          Returns a new ParallelArray holding elements
 void randomFill()
          Sets each element to a uniform random value having the same properties as Random.nextLong()
 void randomFill(long bound)
          Sets each element to a uniform random value having the same properties as Random.nextInt(int)
 long reduce({long,long=>long} reducer, long base)
          Returns reduction of elements
 void replaceWithCombination(long[] other, {long,long=>long} combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithCombination(ParallelLongArray other, {long,long=>long} combiner)
          Replaces elements with results of applying combine(thisElement, otherElement)
 void replaceWithGeneratedValue({=>long} generator)
          Replaces elements with results of applying the given generator.
 void replaceWithMappedIndex({int=>long} mapper)
          Replaces elements with the results of applying the given mapper to their indices
 void replaceWithTransform({long=>long} mapper)
          Replaces elements with the results of applying the given mapper to their current values.
 void replaceWithValue(long value)
          Replaces elements with the given value.
 long sum()
          Returns the sum of elements
abstract  ParallelLongArray.WithDoubleMapping withMapping({long=>double} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
abstract  ParallelLongArray.WithIntMapping withMapping({long=>int} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
abstract  ParallelLongArray.WithLongMapping withMapping({long=>long} mapper)
          Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper.
abstract
<U> ParallelLongArray.WithMapping<U>
withMapping({long=>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.ParallelLongArray.WithLongMapping
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({long=>void} procedure)
Applies the given procedure

Overrides:
apply in class ParallelLongArray.WithLongMapping
Parameters:
procedure - the procedure

reduce

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

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

sum

public long sum()
Returns the sum of elements

Overrides:
sum in class ParallelLongArray.WithLongMapping
Returns:
the sum of elements

min

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

Overrides:
min in class ParallelLongArray.WithLongMapping
Parameters:
comparator - the comparator
Returns:
minimum element, or Long.MAX_VALUE if empty

min

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

Overrides:
min in class ParallelLongArray.WithLongMapping
Returns:
minimum element, or Long.MAX_VALUE if empty

max

public long max({long,long=>int} comparator)
Returns the maximum element, or Long.MIN_VALUE if empty

Overrides:
max in class ParallelLongArray.WithLongMapping
Parameters:
comparator - the comparator
Returns:
maximum element, or Long.MIN_VALUE if empty

max

public long max()
Returns the maximum element, or Long.MIN_VALUE if empty assuming that all elements are Comparables

Overrides:
max in class ParallelLongArray.WithLongMapping
Returns:
maximum element, or Long.MIN_VALUE if empty

indexOfMin

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

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

indexOfMax

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

Overrides:
indexOfMax in class ParallelLongArray.WithLongMapping
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 ParallelLongArray.WithLongMapping
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 ParallelLongArray.WithLongMapping
Returns:
the index of greatest element or -1 if empty.
Throws:
java.lang.ClassCastException - if any element is not Comparable.

newArray

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

Specified by:
newArray in class ParallelLongArray.WithLongMapping
Returns:
a new ParallelArray holding elements

replaceWithTransform

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

Parameters:
mapper - the mapper

replaceWithMappedIndex

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

Parameters:
mapper - the mapper

replaceWithGeneratedValue

public void replaceWithGeneratedValue({=>long} 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.nextLong()


randomFill

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

Parameters:
bound - the upper bound of each random value
Throws:
java.lang.IllegalArgumentException - if bound less than or equal to zero

replaceWithValue

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

Parameters:
value - the value

replaceWithCombination

public void replaceWithCombination(ParallelLongArray other,
                                   {long,long=>long} 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(long[] other,
                                   {long,long=>long} 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 long any()
Returns some element matching bound and filter constraints

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

withMapping

public abstract <U> ParallelLongArray.WithMapping<U> withMapping({long=>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 ParallelLongArray.WithDoubleMapping withMapping({long=>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 ParallelLongArray.WithLongMapping withMapping({long=>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 ParallelLongArray.WithIntMapping withMapping({long=>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