jsr166y.forkjoin
public static final class ParallelDoubleArray.WithBounds extends ParallelDoubleArray.WithFilter
Modifier and Type | Method and Description |
---|---|
ParallelDoubleArray |
all()
Returns a new ParallelDoubleArray holding elements
|
ParallelDoubleArray |
allUniqueElements()
Returns a new ParallelDoubleArray containing only unique
elements (that is, without any duplicates).
|
int |
anyIndex()
Returns the index of some element matching bound and filter
constraints, or -1 if none.
|
int |
binarySearch(double target)
Assuming this array is sorted, returns the index of an
element equal to given target, or -1 if not present.
|
int |
binarySearch(double target,
Ops.DoubleComparator 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.
|
ParallelDoubleArray |
combine(double[] other,
Ops.DoubleReducer combiner)
Returns a ParallelDoubleArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
<U,V> ParallelDoubleArray |
combine(ParallelDoubleArray.WithBounds other,
Ops.DoubleReducer combiner)
Returns a ParallelDoubleArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
ParallelDoubleArray |
combine(ParallelDoubleArray other,
Ops.DoubleReducer combiner)
Returns a ParallelDoubleArray containing results of
applying combine(thisElement, otherElement)
for each element.
|
void |
cumulate(Ops.DoubleReducer reducer,
double base)
Replaces each element with the running cumulation of applying
the given reducer.
|
void |
cumulateSum()
Replaces each element with the running sum
|
int |
indexOf(double target)
Returns the index of some element equal to given target,
or -1 if not present
|
ParallelDoubleArray.WithFilter |
orFilter(Ops.DoublePredicate selector)
Returns an operation prefix that causes a method to operate
only on elements for which the current selector (if
present) or the given selector returns true
|
double |
precumulate(Ops.DoubleReducer reducer,
double base)
Replaces each element with the cumulation of applying the given
reducer to all previous values, and returns the total
reduction.
|
double |
precumulateSum()
Replaces each element with its prefix sum
|
void |
removeAll()
Removes from the array all elements matching bound and/or
filter constraints.
|
void |
removeConsecutiveDuplicates()
Removes consecutive elements that are equal (or null),
shifting others leftward, and possibly decreasing size.
|
int |
size()
Returns the number of elements within bounds
|
void |
sort()
Sorts the elements, assuming all elements are
Comparable.
|
void |
sort(Ops.DoubleComparator cmp)
Sorts the elements.
|
ParallelDoubleArray.WithBounds |
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).
|
ParallelDoubleArray.WithFilter |
withFilter(Ops.DoublePredicate 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
|
ParallelDoubleArray.WithDoubleMapping |
withMapping(Ops.DoubleMapper mapper)
Returns an operation prefix that causes a method to operate
on mapped elements of the array using the given mapper.
|
<U> ParallelDoubleArray.WithMapping<U> |
withMapping(Ops.MapperFromDouble<? extends U> mapper)
Returns an operation prefix that causes a method to operate
on mapped elements of the array using the given mapper.
|
ParallelDoubleArray.WithLongMapping |
withMapping(Ops.MapperFromDoubleToLong mapper)
Returns an operation prefix that causes a method to operate
on mapped elements of the array using the given mapper.
|
replaceWithCombination, replaceWithCombination, replaceWithCombination, replaceWithGeneratedValue, replaceWithMappedIndex, replaceWithTransform, replaceWithValue
public ParallelDoubleArray.WithBounds withBounds(int firstIndex, int upperBound)
firstIndex
- the lower bound (inclusive)upperBound
- the upper bound (exclusive)public ParallelDoubleArray.WithFilter withFilter(Ops.DoublePredicate selector)
withFilter
in class ParallelDoubleArray.WithFilter
selector
- the selectorpublic <U> ParallelDoubleArray.WithMapping<U> withMapping(Ops.MapperFromDouble<? extends U> mapper)
withMapping
in class ParallelDoubleArray.WithDoubleMapping
mapper
- the mapperpublic ParallelDoubleArray.WithDoubleMapping withMapping(Ops.DoubleMapper mapper)
withMapping
in class ParallelDoubleArray.WithDoubleMapping
mapper
- the mapperpublic ParallelDoubleArray.WithLongMapping withMapping(Ops.MapperFromDoubleToLong mapper)
withMapping
in class ParallelDoubleArray.WithDoubleMapping
mapper
- the mapperpublic ParallelDoubleArray.WithFilter orFilter(Ops.DoublePredicate selector)
ParallelDoubleArray.WithFilter
orFilter
in class ParallelDoubleArray.WithFilter
selector
- the selectorpublic int anyIndex()
ParallelDoubleArray.WithDoubleMapping
anyIndex
in class ParallelDoubleArray.WithDoubleMapping
public ParallelDoubleArray combine(double[] other, Ops.DoubleReducer combiner)
other
- the other arraycombiner
- the combinerjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public ParallelDoubleArray combine(ParallelDoubleArray other, Ops.DoubleReducer combiner)
other
- the other arraycombiner
- the combinerjava.lang.ArrayIndexOutOfBoundsException
- if other array is
shorter than this array.public <U,V> ParallelDoubleArray combine(ParallelDoubleArray.WithBounds other, Ops.DoubleReducer combiner)
other
- the other array segmentcombiner
- the combinerjava.lang.ArrayIndexOutOfBoundsException
- if other segment is
shorter than this array.public ParallelDoubleArray all()
ParallelDoubleArray.WithDoubleMapping
all
in class ParallelDoubleArray.WithDoubleMapping
public ParallelDoubleArray allUniqueElements()
ParallelDoubleArray.WithFilter
allUniqueElements
in class ParallelDoubleArray.WithFilter
public int indexOf(double target)
target
- the element to search forpublic int binarySearch(double target)
target
- the element to search forpublic int binarySearch(double target, Ops.DoubleComparator comparator)
target
- the element to search forcomparator
- the comparatorpublic int size()
size
in class ParallelDoubleArray.WithDoubleMapping
public void cumulate(Ops.DoubleReducer reducer, double base)
reducer
- the reducerbase
- the result for an empty arraypublic void cumulateSum()
public double precumulate(Ops.DoubleReducer reducer, double base)
reducer
- the reducerbase
- the result for an empty arraypublic double precumulateSum()
public void sort(Ops.DoubleComparator cmp)
cmp
- the comparator to usepublic void sort()
java.lang.ClassCastException
- if any element is not Comparable.public void removeAll()
ParallelDoubleArray.WithFilter
removeAll
in class ParallelDoubleArray.WithFilter
public void removeConsecutiveDuplicates()