org.codehaus.gpars

groovyx.gpars.extra166y
[Java] Class ParallelLongArray

java.lang.Object
  AbstractParallelAnyArray.LUPap
      groovyx.gpars.extra166y.ParallelLongArray

public class ParallelLongArray
extends LUPap

An array of longs supporting parallel operations. This class provides methods supporting the same operations as ParallelArray, but specialized for scalar longs. It additionally provides a few methods specific to numerical values.

Sample usages. Here is a complete (although naive) prime filter program:

 import java.math.BigInteger;
 import jsr166y.*;
 import static extra166y.Ops.*;
 import static extra166y.ParallelLongArray.*;

 public class Sieve {
   public static void main(String[] args) {
     int n = Integer.parseInt(args[0]);
     // create array of divisors
     ParallelLongArray a = create(n-1, defaultExecutor());
     a.replaceWithMappedIndex(add2);
     int i = 0;
     long p = 2;
     while (p * p < n) { // repeatedly filter
         a = a.withFilter(notDivisibleBy(p)).all();
         p = a.get(++i);
     }
     System.out.printf("sieve(%d) = %s%n", n, a);
     // check result
     if (!a.withFilter(notProbablePrime).isEmpty())
         throw new Error();
   }
   static IntToLong add2 = new IntToLong() {
     public long op(int i) { return i + 2; } };
   static LongPredicate notDivisibleBy(final long p) {
     return new LongPredicate() {
       public boolean op(long n) { return n <= p || (n % p) != 0; }
     }; }
   static LongPredicate notProbablePrime = new LongPredicate() {
     private static final int CERTAINTY = 8;
     public boolean op(long n) {
       return !BigInteger.valueOf(n).isProbablePrime(CERTAINTY);
     }
   };
 }
 


Nested Class Summary
class ParallelLongArray.AsList

class ParallelLongArray.ListIter

static class ParallelLongArray.ParallelLongArrayIterator

static interface ParallelLongArray.SummaryStatistics

Summary statistics for a possibly bounded, filtered, and/or mapped ParallelLongArray.

 
Field Summary
ParallelLongArray.AsList listView

 
Constructor Summary
protected ParallelLongArray(ForkJoinPool executor, long[] array, int limit)

Constructor for use by subclasses to create a new ParallelLongArray using the given executor, and initially using the supplied array, with effective size bound by the given limit.

ParallelLongArray(ForkJoinPool executor, long[] array)

Trusted internal version of protected constructor.

 
Method Summary
ParallelLongArray addAll(long[] other)

Equivalent to asList().addAll but specialized for array arguments and likely to be more efficient.

ParallelLongArray addAll(ParallelLongArrayWithLongMapping other)

Appends all (possibly bounded, filtered, or mapped) elements of the given ParallelDoubleArray, resizing and/or reallocating this array if necessary.

ParallelLongArray all()

Returns a new ParallelLongArray holding all elements

ParallelLongArray allUniqueElements()

Returns a new ParallelLongArray containing only the unique elements of this array (that is, without any duplicates).

void appendElement(long e)

void apply(LongProcedure procedure)

Applies the given procedure to elements

java.util.List asList()

Returns a view of this ParallelLongArray as a List.

int binarySearch(long target)

Assuming this array is sorted, returns the index of an element equal to given target, or -1 if not present.

int binarySearch(long target, LongComparator comparator)

Assuming this array is sorted with respect to the given comparator, returns the index of an element equal to given target, or -1 if not present.

static ParallelLongArray create(int size, ForkJoinPool executor)

Creates a new ParallelLongArray using the given executor and an array of the given size

static ParallelLongArray createEmpty(int size, ForkJoinPool executor)

Creates a new ParallelLongArray using the given executor and an array of the given size, but with an initial effective size of zero, enabling incremental insertion via ParallelLongArray#asList#asList operations.

static ParallelLongArray createFromCopy(long[] source, ForkJoinPool executor)

Creates a new ParallelLongArray using the given executor and initially holding copies of the given source elements.

static ParallelLongArray createFromCopy(int size, long[] source, ForkJoinPool executor)

Creates a new ParallelLongArray using an array of the given size, initially holding copies of the given source truncated or padded with zeros to obtain the specified length.

static ParallelLongArray createUsingHandoff(long[] handoff, ForkJoinPool executor)

Creates a new ParallelLongArray initially using the given array and executor.

ParallelLongArray cumulate(LongReducer reducer, long base)

Replaces each element with the running cumulation of applying the given reducer.

ParallelLongArray cumulateSum()

Replaces each element with the running sum

static ForkJoinPool defaultExecutor()

Returns a common default executor for use in ParallelArrays.

long get(int i)

Returns the element of the array at the given index

long[] getArray()

Returns the underlying array used for computations

ForkJoinPool getExecutor()

Returns the executor used for computations

boolean hasAllEqualElements(ParallelLongArrayWithLongMapping other)

Returns true if all elements at the same relative positions of this and other array are equal.

int indexOf(long target)

Returns the index of some element equal to given target, or -1 if not present

void insertElementAt(int index, long e)

void insertSlotsAt(int index, int len)

Makes len slots available at index.

java.util.Iterator iterator()

Returns an iterator stepping through each element of the array up to the current limit.

long max(LongComparator comparator)

Returns the maximum element, or Long.MIN_VALUE if empty

long max()

Returns the maximum element, or Long.MIN_VALUE if empty

long min(LongComparator comparator)

Returns the minimum element, or Long.MAX_VALUE if empty

long min()

Returns the minimum element, or Long.MAX_VALUE if empty,

long precumulate(LongReducer 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

long reduce(LongReducer reducer, long base)

Returns reduction of elements

ParallelLongArray removeAll(LongPredicate selector)

Removes from the array all elements for which the given selector holds.

ParallelLongArray removeConsecutiveDuplicates()

Removes consecutive elements that are equal, shifting others leftward, and possibly decreasing size.

void removeSlotAt(int index)

void removeSlotsAt(int fromIndex, int toIndex)

void replaceElementsParallelLongArrayWith(long[] a)

ParallelLongArray replaceWithGeneratedValue(LongGenerator generator)

Replaces elements with the results of applying the given generator.

ParallelLongArray replaceWithMappedIndex(IntToLong op)

Replaces elements with the results of applying the given op to their indices.

ParallelLongArray replaceWithMappedIndex(IntAndLongToLong op)

Replaces elements with the results of applying the given mapping to each index and current element value

ParallelLongArray replaceWithMapping(LongOp op)

Replaces elements with the results of applying the given op to their current values.

ParallelLongArray replaceWithMapping(BinaryLongOp combiner, ParallelLongArrayWithLongMapping other)

Replaces elements with results of applying op(thisElement, otherElement)

ParallelLongArray replaceWithMapping(BinaryLongOp combiner, long[] other)

Replaces elements with results of applying op(thisElement, otherElement)

ParallelLongArray replaceWithValue(long value)

Replaces elements with the given value.

void resizeArray(int newCap)

int seqIndexOf(long target)

int seqLastIndexOf(long target)

void set(int i, long x)

Sets the element of the array at the given index to the given value

void setLimit(int newLimit)

Ensures that the underlying array can be accessed up to the given upper bound, reallocating and copying the underlying array to expand if necessary.

int size()

Returns the effective size of the underlying array.

ParallelLongArray sort(LongComparator comparator)

Sorts the array.

ParallelLongArray sort()

Sorts the array, assuming all elements are Comparable.

long sum()

Returns the sum of elements

SummaryStatistics summary(LongComparator comparator)

Returns summary statistics, using the given comparator to locate minimum and maximum elements.

SummaryStatistics summary()

Returns summary statistics, using natural comparator

java.lang.String toString()

Equivalent to asList().toString()

ParallelLongArrayWithBounds withBounds(int firstIndex, int upperBound)

Returns an operation prefix that causes a method to operate only on the elements of the array between firstIndex (inclusive) and upperBound (exclusive).

ParallelLongArrayWithFilter withFilter(LongPredicate 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

ParallelLongArrayWithFilter withFilter(BinaryLongPredicate selector, ParallelLongArrayWithLongMapping other)

Returns an operation prefix that causes a method to operate only on elements for which the given binary selector returns true

ParallelLongArrayWithFilter withIndexedFilter(IntAndLongPredicate selector)

Returns an operation prefix that causes a method to operate only on elements for which the given indexed selector returns true

ParallelLongArrayWithMapping withIndexedMapping(IntAndLongToObject mapper)

Returns an operation prefix that causes a method to operate on mappings of this array using the given mapper that accepts as arguments an element's current index and value, and produces a new value.

ParallelLongArrayWithDoubleMapping withIndexedMapping(IntAndLongToDouble mapper)

Returns an operation prefix that causes a method to operate on mappings of this array using the given mapper that accepts as arguments an element's current index and value, and produces a new value.

ParallelLongArrayWithLongMapping withIndexedMapping(IntAndLongToLong mapper)

Returns an operation prefix that causes a method to operate on mappings of this array using the given mapper that accepts as arguments an element's current index and value, and produces a new value.

ParallelLongArrayWithMapping withMapping(LongToObject op)

Returns an operation prefix that causes a method to operate on mapped elements of the array using the given op.

ParallelLongArrayWithLongMapping withMapping(LongOp op)

Returns an operation prefix that causes a method to operate on mapped elements of the array using the given op.

ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op)

Returns an operation prefix that causes a method to operate on mapped elements of the array using the given op.

ParallelLongArrayWithMapping withMapping(LongAndObjectToObject combiner, ParallelArrayWithMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithMapping withMapping(LongAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithMapping withMapping(LongAndLongToObject combiner, ParallelLongArrayWithLongMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithDoubleMapping withMapping(LongAndObjectToDouble combiner, ParallelArrayWithMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithDoubleMapping withMapping(LongAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithDoubleMapping withMapping(LongAndLongToDouble combiner, ParallelLongArrayWithLongMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithLongMapping withMapping(LongAndObjectToLong combiner, ParallelArrayWithMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithLongMapping withMapping(LongAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

ParallelLongArrayWithLongMapping withMapping(BinaryLongOp combiner, ParallelLongArrayWithLongMapping other)

Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.

 

Field Detail

listView

ParallelLongArray.AsList listView


 
Constructor Detail

ParallelLongArray

protected ParallelLongArray(ForkJoinPool executor, long[] array, int limit)
Constructor for use by subclasses to create a new ParallelLongArray using the given executor, and initially using the supplied array, with effective size bound by the given limit. This constructor is designed to enable extensions via subclassing. To create a ParallelLongArray, use create, createEmpty, createUsingHandoff or createFromCopy.
Parameters:
executor - the executor
array - the array
limit - the upper bound limit


ParallelLongArray

ParallelLongArray(ForkJoinPool executor, long[] array)
Trusted internal version of protected constructor.


 
Method Detail

addAll

public ParallelLongArray addAll(long[] other)
Equivalent to asList().addAll but specialized for array arguments and likely to be more efficient.
Parameters:
other - the elements to add
Returns:
this (to simplify use in expressions)


addAll

public ParallelLongArray addAll(ParallelLongArrayWithLongMapping other)
Appends all (possibly bounded, filtered, or mapped) elements of the given ParallelDoubleArray, resizing and/or reallocating this array if necessary.
Parameters:
other - the elements to add
Returns:
this (to simplify use in expressions)


all

public ParallelLongArray all()
Returns a new ParallelLongArray holding all elements
Returns:
a new ParallelLongArray holding all elements


allUniqueElements

public ParallelLongArray allUniqueElements()
Returns a new ParallelLongArray containing only the unique elements of this array (that is, without any duplicates).
Returns:
the new ParallelLongArray


appendElement

final void appendElement(long e)


apply

public void apply(LongProcedure procedure)
Applies the given procedure to elements
Parameters:
procedure - the procedure


asList

public java.util.List asList()
Returns a view of this ParallelLongArray as a List. This List has the same structural and performance characteristics as java.util.ArrayList, and may be used to modify, replace or extend the bounds of the array underlying this ParallelLongArray. The methods supported by this list view are not in general implemented as parallel operations. This list is also not itself thread-safe. In particular, performing list updates while other parallel operations are in progress has undefined (and surely undesired) effects.
Returns:
a list view


binarySearch

public int binarySearch(long target)
Assuming this array is sorted, returns the index of an element equal to given target, or -1 if not present. If the array is not sorted, the results are undefined.
Parameters:
target - the element to search for
Returns:
the index or -1 if not present


binarySearch

public int binarySearch(long target, LongComparator comparator)
Assuming this array is sorted with respect to the given comparator, returns the index of an element equal to given target, or -1 if not present. If the array is not sorted, the results are undefined.
Parameters:
target - the element to search for
comparator - the comparator
Returns:
the index or -1 if not present


create

public static ParallelLongArray create(int size, ForkJoinPool executor)
Creates a new ParallelLongArray using the given executor and an array of the given size
Parameters:
size - the array size
executor - the executor


createEmpty

public static ParallelLongArray createEmpty(int size, ForkJoinPool executor)
Creates a new ParallelLongArray using the given executor and an array of the given size, but with an initial effective size of zero, enabling incremental insertion via ParallelLongArray#asList#asList operations.
Parameters:
size - the array size
executor - the executor


createFromCopy

public static ParallelLongArray createFromCopy(long[] source, ForkJoinPool executor)
Creates a new ParallelLongArray using the given executor and initially holding copies of the given source elements.
Parameters:
source - the source of initial elements
executor - the executor


createFromCopy

public static ParallelLongArray createFromCopy(int size, long[] source, ForkJoinPool executor)
Creates a new ParallelLongArray using an array of the given size, initially holding copies of the given source truncated or padded with zeros to obtain the specified length.
Parameters:
source - the source of initial elements
size - the array size
executor - the executor


createUsingHandoff

public static ParallelLongArray createUsingHandoff(long[] handoff, ForkJoinPool executor)
Creates a new ParallelLongArray initially using the given array and executor. In general, the handed off array should not be used for other purposes once constructing this ParallelLongArray. The given array may be internally replaced by another array in the course of methods that add or remove elements.
Parameters:
handoff - the array
executor - the executor


cumulate

public ParallelLongArray cumulate(LongReducer reducer, long base)
Replaces each element with the running cumulation of applying the given reducer. For example, if the contents are the numbers 1, 2, 3, and the reducer operation adds numbers, then after invocation of this method, the contents would be 1, 3, 6 (that is, 1, 1+2, 1+2+3);
Parameters:
reducer - the reducer
base - the result for an empty array
Returns:
this (to simplify use in expressions)


cumulateSum

public ParallelLongArray cumulateSum()
Replaces each element with the running sum
Returns:
this (to simplify use in expressions)


defaultExecutor

public static ForkJoinPool defaultExecutor()
Returns a common default executor for use in ParallelArrays. This executor arranges enough parallelism to use most, but not necessarily all, of the available processors on this system.
Returns:
the executor


get

public long get(int i)
Returns the element of the array at the given index
Parameters:
i - the index
Returns:
the element of the array at the given index


getArray

public long[] getArray()
Returns the underlying array used for computations
Returns:
the array


getExecutor

public ForkJoinPool getExecutor()
Returns the executor used for computations
Returns:
the executor


hasAllEqualElements

public boolean hasAllEqualElements(ParallelLongArrayWithLongMapping other)
Returns true if all elements at the same relative positions of this and other array are equal.
Parameters:
other - the other array


indexOf

public int indexOf(long target)
Returns the index of some element equal to given target, or -1 if not present
Parameters:
target - the element to search for
Returns:
the index or -1 if not present


insertElementAt

final void insertElementAt(int index, long e)


insertSlotsAt

final void insertSlotsAt(int index, int len)
Makes len slots available at index.


iterator

public java.util.Iterator iterator()
Returns an iterator stepping through each element of the array up to the current limit. This iterator does not support the remove operation. However, a full ListIterator supporting add, remove, and set operations is available via asList.
Returns:
an iterator stepping through each element.


max

public long max(LongComparator comparator)
Returns the maximum element, or Long.MIN_VALUE if empty
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
Returns:
maximum element, or Long.MIN_VALUE if empty


min

public long min(LongComparator comparator)
Returns the minimum element, or Long.MAX_VALUE if empty
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,
Returns:
minimum element, or Long.MAX_VALUE if empty


precumulate

public long precumulate(LongReducer reducer, long base)
Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction. For example, if the contents are the numbers 1, 2, 3, and the reducer operation adds numbers, then after invocation of this method, the contents would be 0, 1, 3 (that is, 0, 0+1, 0+1+2, and the return value would be 6 (that is, 1+2+3);
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


reduce

public long reduce(LongReducer reducer, long base)
Returns reduction of elements
Parameters:
reducer - the reducer
base - the result for an empty array
Returns:
reduction


removeAll

public ParallelLongArray removeAll(LongPredicate selector)
Removes from the array all elements for which the given selector holds.
Parameters:
selector - the selector
Returns:
this (to simplify use in expressions)


removeConsecutiveDuplicates

public ParallelLongArray removeConsecutiveDuplicates()
Removes consecutive elements that are equal, shifting others leftward, and possibly decreasing size. This method may be used after sorting to ensure that this ParallelLongArray contains a set of unique elements.
Returns:
this (to simplify use in expressions)


removeSlotAt

final void removeSlotAt(int index)


removeSlotsAt

final void removeSlotsAt(int fromIndex, int toIndex)


replaceElementsParallelLongArrayWith

final void replaceElementsParallelLongArrayWith(long[] a)


replaceWithGeneratedValue

public ParallelLongArray replaceWithGeneratedValue(LongGenerator generator)
Replaces elements with the results of applying the given generator. For example, to fill the array with uniform random values, use replaceWithGeneratedValue(Ops.longRandom())
Parameters:
generator - the generator
Returns:
this (to simplify use in expressions)


replaceWithMappedIndex

public ParallelLongArray replaceWithMappedIndex(IntToLong op)
Replaces elements with the results of applying the given op to their indices.
Parameters:
op - the op
Returns:
this (to simplify use in expressions)


replaceWithMappedIndex

public ParallelLongArray replaceWithMappedIndex(IntAndLongToLong op)
Replaces elements with the results of applying the given mapping to each index and current element value
Parameters:
op - the op
Returns:
this (to simplify use in expressions)


replaceWithMapping

public ParallelLongArray replaceWithMapping(LongOp op)
Replaces elements with the results of applying the given op to their current values.
Parameters:
op - the op
Returns:
this (to simplify use in expressions)


replaceWithMapping

public ParallelLongArray replaceWithMapping(BinaryLongOp combiner, ParallelLongArrayWithLongMapping other)
Replaces elements with results of applying op(thisElement, otherElement)
Parameters:
other - the other array
combiner - the combiner
Returns:
this (to simplify use in expressions)


replaceWithMapping

public ParallelLongArray replaceWithMapping(BinaryLongOp combiner, long[] other)
Replaces elements with results of applying op(thisElement, otherElement)
throws:
ArrayIndexOutOfBoundsException if other array has fewer elements than this array.
Parameters:
other - the other array
combiner - the combiner
Returns:
this (to simplify use in expressions)


replaceWithValue

public ParallelLongArray replaceWithValue(long value)
Replaces elements with the given value.
Parameters:
value - the value
Returns:
this (to simplify use in expressions)


resizeArray

final void resizeArray(int newCap)


seqIndexOf

final int seqIndexOf(long target)


seqLastIndexOf

final int seqLastIndexOf(long target)


set

public void set(int i, long x)
Sets the element of the array at the given index to the given value
Parameters:
i - the index
x - the value


setLimit

public final void setLimit(int newLimit)
Ensures that the underlying array can be accessed up to the given upper bound, reallocating and copying the underlying array to expand if necessary. Or, if the given limit is less than the length of the underlying array, causes computations to ignore elements past the given limit.
throws:
IllegalArgumentException if newLimit less than zero.
Parameters:
newLimit - the new upper bound


size

public int size()
Returns the effective size of the underlying array. The effective size is the current limit, if used (see setLimit), or the length of the array otherwise.
Returns:
the effective size of array


sort

public ParallelLongArray sort(LongComparator comparator)
Sorts the array. Unlike Arrays.sort, this sort does not guarantee that elements with equal keys maintain their relative position in the array.
Parameters:
comparator - the comparator to use
Returns:
this (to simplify use in expressions)


sort

public ParallelLongArray sort()
Sorts the array, assuming all elements are Comparable. Unlike Arrays.sort, this sort does not guarantee that elements with equal keys maintain their relative position in the array.
throws:
ClassCastException if any element is not Comparable.
Returns:
this (to simplify use in expressions)


sum

public long sum()
Returns the sum of elements
Returns:
the sum of elements


summary

public SummaryStatistics summary(LongComparator comparator)
Returns summary statistics, using the given comparator to locate minimum and maximum elements.
Parameters:
comparator - the comparator to use for locating minimum and maximum elements
Returns:
the summary.


summary

public SummaryStatistics summary()
Returns summary statistics, using natural comparator
Returns:
the summary.


toString

public java.lang.String toString()
Equivalent to asList().toString()
Returns:
a string representation


withBounds

public ParallelLongArrayWithBounds withBounds(int firstIndex, int upperBound)
Returns an operation prefix that causes a method to operate only on the elements of the array between firstIndex (inclusive) and upperBound (exclusive).
Parameters:
firstIndex - the lower bound (inclusive)
upperBound - the upper bound (exclusive)
Returns:
operation prefix


withFilter

public ParallelLongArrayWithFilter withFilter(LongPredicate 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


withFilter

public ParallelLongArrayWithFilter withFilter(BinaryLongPredicate selector, ParallelLongArrayWithLongMapping other)
Returns an operation prefix that causes a method to operate only on elements for which the given binary selector returns true
Parameters:
selector - the selector
Returns:
operation prefix


withIndexedFilter

public ParallelLongArrayWithFilter withIndexedFilter(IntAndLongPredicate selector)
Returns an operation prefix that causes a method to operate only on elements for which the given indexed selector returns true
Parameters:
selector - the selector
Returns:
operation prefix


withIndexedMapping

public ParallelLongArrayWithMapping withIndexedMapping(IntAndLongToObject mapper)
Returns an operation prefix that causes a method to operate on mappings of this array using the given mapper that accepts as arguments an element's current index and value, and produces a new value.
Parameters:
mapper - the mapper
Returns:
operation prefix


withIndexedMapping

public ParallelLongArrayWithDoubleMapping withIndexedMapping(IntAndLongToDouble mapper)
Returns an operation prefix that causes a method to operate on mappings of this array using the given mapper that accepts as arguments an element's current index and value, and produces a new value.
Parameters:
mapper - the mapper
Returns:
operation prefix


withIndexedMapping

public ParallelLongArrayWithLongMapping withIndexedMapping(IntAndLongToLong mapper)
Returns an operation prefix that causes a method to operate on mappings of this array using the given mapper that accepts as arguments an element's current index and value, and produces a new value.
Parameters:
mapper - the mapper
Returns:
operation prefix


withMapping

public ParallelLongArrayWithMapping withMapping(LongToObject op)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given op.
Parameters:
op - the op
Returns:
operation prefix


withMapping

public ParallelLongArrayWithLongMapping withMapping(LongOp op)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given op.
Parameters:
op - the op
Returns:
operation prefix


withMapping

public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given op.
Parameters:
op - the op
Returns:
operation prefix


withMapping

public ParallelLongArrayWithMapping withMapping(LongAndObjectToObject combiner, ParallelArrayWithMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithMapping withMapping(LongAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithMapping withMapping(LongAndLongToObject combiner, ParallelLongArrayWithLongMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithDoubleMapping withMapping(LongAndObjectToDouble combiner, ParallelArrayWithMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithDoubleMapping withMapping(LongAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithDoubleMapping withMapping(LongAndLongToDouble combiner, ParallelLongArrayWithLongMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithLongMapping withMapping(LongAndObjectToLong combiner, ParallelArrayWithMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithLongMapping withMapping(LongAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


withMapping

public ParallelLongArrayWithLongMapping withMapping(BinaryLongOp combiner, ParallelLongArrayWithLongMapping other)
Returns an operation prefix that causes a method to operate on binary mappings of this array and the other array.
throws:
IllegalArgumentException if other array is a filtered view (all filters must precede all mappings).
Parameters:
combiner - the combiner
other - the other array
Returns:
operation prefix


 

Copyright © 2008–2012 Václav Pech. All Rights Reserved.