Modifier and Type | Field and Description |
---|---|
protected volatile boolean | canceled
Indicates whether this task has been canceled. |
protected final AtomicReference | sharedResult
The result for this computation; this is shared among all tasks and set exactly once |
Access | Constructor and Description |
---|---|
protected | AbstractShortCircuitTask(PipelineHelper<P_OUT>
the helper, Spliterator<P_IN> PipelineHelper describing the stream pipeline
up to this operationthe spliterator)Spliterator describing the source for this
pipelineConstructor for root tasks. |
protected | AbstractShortCircuitTask(K
parent task in the computation tree parent, Spliterator<P_IN> the spliterator)Spliterator for the portion of the
computation tree described by this taskConstructor for non-root nodes. |
Modifier and Type | Method and Description |
---|---|
protected void | |
protected void | |
public void | compute()
Overrides java. |
protected abstract R | Returns: the result to return when no task finds a resultReturns the value indicating the computation completed with no task finding a short-circuitable result. |
public R | getLocalResult()
Overrides java. |
public R | getRawResult()
Overrides java. |
protected void | setLocalResult(R
The result to set for this task localResult)Overrides java. |
protected void | |
protected boolean | Returns: true if this task or any parent is canceled.Queries whether this task is canceled. |
canceled | back to summary |
---|---|
protected volatile boolean canceled Indicates whether this task has been canceled. Tasks may cancel other tasks in the computation under various conditions, such as in a find-first operation, a task that finds a value will cancel all tasks that are later in the encounter order. |
sharedResult | back to summary |
---|---|
protected final AtomicReference<R> sharedResult The result for this computation; this is shared among all tasks and set exactly once |
AbstractShortCircuitTask | back to summary |
---|---|
protected AbstractShortCircuitTask(PipelineHelper<P_OUT> helper, Spliterator<P_IN> spliterator) Constructor for root tasks.
|
AbstractShortCircuitTask | back to summary |
---|---|
protected AbstractShortCircuitTask(K parent, Spliterator<P_IN> spliterator) Constructor for non-root nodes.
|
cancel | back to summary |
---|---|
protected void cancel() Mark this task as canceled |
cancelLaterNodes | back to summary |
---|---|
protected void cancelLaterNodes() Cancels all tasks which succeed this one in the encounter order. This includes canceling all the current task's right sibling, as well as the later right siblings of all its parents. |
compute | back to summary |
---|---|
public void compute() Overrides java. Overrides AbstractTask version to include checks for early exits while splitting or computing.
|
getEmptyResult | back to summary |
---|---|
protected abstract R getEmptyResult() Returns the value indicating the computation completed with no task
finding a short-circuitable result. For example, for a "find" operation,
this might be null or an empty
|
getLocalResult | back to summary |
---|---|
public R getLocalResult() Overrides java. Retrieves the local result for this task. If this task is the root, retrieves the shared result instead.
|
getRawResult | back to summary |
---|---|
public R getRawResult() Overrides java. Retrieves the local result for this task
|
setLocalResult | back to summary |
---|---|
protected void setLocalResult(R localResult) Overrides java. Sets a local result for this task. If this task is the root, set the shared result instead (if not already set).
|
shortCircuit | back to summary |
---|---|
protected void shortCircuit(R result) Declares that a globally valid result has been found. If another task has
not already found the answer, the result is installed in
|
taskCanceled | back to summary |
---|---|
protected boolean taskCanceled() Queries whether this task is canceled. A task is considered canceled if it or any of its parents have been canceled.
|