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 and description |
---|
ParallelArrayWithBounds
(java.util.concurrent.ForkJoinPool ex, int origin, int fence, T[] array) |
Type | Name and description |
---|---|
int |
binarySearch(T target) Assuming this array is sorted, returns the index of an element equal to given target, or -1 if not present. |
int |
binarySearch(T target, java.util.Comparator<? super T> 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<T> |
cumulate(Reducer<T> reducer, T base) Replaces each element with the running cumulation of applying the given reducer. |
int |
indexOf(T target) Returns the index of some element equal to given target, or -1 if not present. |
T |
precumulate(Reducer<T> reducer, T base) Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction. |
ParallelArrayWithBounds<T> |
sort(java.util.Comparator<? super T> cmp) Sorts the elements. |
ParallelArrayWithBounds<T> |
sort() Sorts the elements, assuming all elements are Comparable. |
ParallelArrayWithBounds<T> |
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 | Name |
---|---|
class ParallelArrayWithFilter |
allNonidenticalElements, allUniqueElements, hasAllEqualElements, hasAllIdenticalElements, leafTransfer, leafTransferByIndex, oget, replaceWithGeneratedValue, replaceWithMappedIndex, replaceWithMappedIndex, replaceWithMapping, replaceWithMapping, replaceWithMapping, replaceWithValue, withFilter, withFilter, withIndexedFilter |
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 |
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.
target
- the element to search forAssuming 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.
target
- the element to search forcomparator
- the comparatorReplaces each element with the running cumulation of applying the given reducer.
reducer
- the reducerbase
- the result for an empty arrayReturns the index of some element equal to given target, or -1 if not present.
target
- the element to search forReplaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction.
reducer
- the reducerbase
- the result for an empty arraySorts the elements. Unlike Arrays.sort, this sort does not guarantee that elements with equal keys maintain their relative position in the array.
cmp
- the comparator to useSorts the elements, 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.
Returns an operation prefix that causes a method to operate
only on the elements of the array between firstIndex
(inclusive) and upperBound (exclusive). The bound
arguments are relative to the current bounds. For example
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–2014 Václav Pech. All Rights Reserved.