jsr166z.forkjoin
Class ParallelLongArray.WithBounds

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

public static final class ParallelLongArray.WithBounds
extends ParallelLongArray.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.
 ParallelLongArray combine(long[] other, {long,long=>long} combiner)
          Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element.
 ParallelLongArray combine(ParallelLongArray other, {long,long=>long} combiner)
          Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element.
 void cumulate({long,long=>long} reducer, long base)
          Replaces each element with the running cumulation of applying the given reducer.
 void cumulateSum()
          Replaces each element with the running sum
 ParallelLongArray newArray()
          Returns a new ParallelArray holding elements
 long precumulate({long,long=>long} reducer, long base)
          Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction.
 long 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({long,long=>int} cmp)
          Sorts the elements.
 ParallelLongArray.WithFilter withFilter({long=>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
 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.
 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.
 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.
<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.WithFilter
any, apply, indexOfMax, indexOfMax, indexOfMin, indexOfMin, max, max, min, min, randomFill, 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 ParallelLongArray.WithFilter withFilter({long=>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> 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.

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

withMapping

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

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

withMapping

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

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

withMapping

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

Specified by:
withMapping in class ParallelLongArray.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 ParallelLongArray.WithLongMapping
Returns:
index of matching element, or -1 if none.

combine

public ParallelLongArray combine(long[] other,
                                 {long,long=>long} 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 ParallelLongArray combine(ParallelLongArray other,
                                 {long,long=>long} 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 ParallelLongArray.WithLongMapping
Returns:
the number of elements within bounds

cumulate

public void cumulate({long,long=>long} reducer,
                     long 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 long precumulate({long,long=>long} reducer,
                        long 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 long precumulateSum()
Replaces each element with its prefix sum

Returns:
the total sum

sort

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

Parameters:
cmp - the comparator to use

sort

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


newArray

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

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