|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.extra166y.AbstractParallelAnyArray.OPap groovyx.gpars.extra166y.ParallelArrayWithMapping groovyx.gpars.extra166y.ParallelArrayWithFilter groovyx.gpars.extra166y.ParallelArrayWithBounds
public abstract class ParallelArrayWithBounds extends ParallelArrayWithFilter
A prefix view of ParallelArray that causes operations to apply only to elements within a given range. Instances of this class may be constructed only via prefix methods of ParallelArray or its other prefix classes.
Constructor Summary | |
ParallelArrayWithBounds(ForkJoinPool ex, int origin, int fence, java.lang.Object[] array)
|
Method Summary | |
---|---|
int
|
binarySearch(java.lang.Object target)
Assuming this array is sorted, returns the index of an element equal to given target, or -1 if not present. |
int
|
binarySearch(java.lang.Object target, java.util.Comparator 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. |
ParallelArrayWithBounds
|
cumulate(Reducer reducer, java.lang.Object base)
Replaces each element with the running cumulation of applying the given reducer. |
int
|
indexOf(java.lang.Object target)
Returns the index of some element equal to given target, or -1 if not present. |
java.lang.Object
|
precumulate(Reducer reducer, java.lang.Object base)
Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction. |
ParallelArrayWithBounds
|
sort(java.util.Comparator cmp)
Sorts the elements. |
ParallelArrayWithBounds
|
sort()
Sorts the elements, assuming all elements are Comparable. |
ParallelArrayWithBounds
|
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). |
Methods inherited from class ParallelArrayWithMapping | |
---|---|
all, all, any, apply, max, max, min, min, reduce, sequentially, summary, summary, withIndexedMapping, withIndexedMapping, withIndexedMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping, withMapping |
Constructor Detail |
---|
ParallelArrayWithBounds(ForkJoinPool ex, int origin, int fence, java.lang.Object[] array)
Method Detail |
---|
public int binarySearch(java.lang.Object target)
target
- the element to search for
public int binarySearch(java.lang.Object target, java.util.Comparator comparator)
target
- the element to search forcomparator
- the comparator
public ParallelArrayWithBounds cumulate(Reducer reducer, java.lang.Object base)
reducer
- the reducerbase
- the result for an empty array
public int indexOf(java.lang.Object target)
target
- the element to search for
public java.lang.Object precumulate(Reducer reducer, java.lang.Object base)
reducer
- the reducerbase
- the result for an empty array
public ParallelArrayWithBounds sort(java.util.Comparator cmp)
cmp
- the comparator to use
public ParallelArrayWithBounds sort()
public ParallelArrayWithBounds withBounds(int firstIndex, int upperBound)
pa.withBounds(2, 8).withBounds(3, 5)
indexes the
5th (= 2+3) and 6th elements of pa. However, indices
returned by methods such as indexOf
are
with respect to the underlying ParallelArray.
firstIndex
- the lower bound (inclusive)upperBound
- the upper bound (exclusive)
Copyright © 2008–2013 Václav Pech. All Rights Reserved.