public override void onCompletion <T1>(CountedCompleter <T1> caller) { if (Node != null) { // Dump buffered elements from this leaf into the sink Node.ForEach(Action); Node = null; } else if (Spliterator != null) { // Dump elements output from this leaf's pipeline into the sink Helper.WrapAndCopyInto(Action, Spliterator); Spliterator = null; } // The completion of this task *and* the dumping of elements // "happens-before" completion of the associated left-most leaf task // of right subtree (if any, which can be this task's right sibling) // ForEachOrderedTask <S, T> leftDescendant = CompletionMap.Remove(this); if (leftDescendant != null) { leftDescendant.TryComplete(); } }
public override void onCompletion <T1>(CountedCompleter <T1> caller) { if (!Leaf) { S leftResult = leftChild.LocalResult; leftResult.combine(rightChild.LocalResult); LocalResult = leftResult; } // GC spliterator, left and right child base.OnCompletion(caller); }
public override void onCompletion <T1>(CountedCompleter <T1> caller) { if (Op.MustFindFirst) { for (FindTask <P_IN, P_OUT, O> child = leftChild, p = null; child != p; p = child, child = rightChild) { O result = child.LocalResult; if (result != null && Op.PresentPredicate.Test(result)) { LocalResult = result; FoundResult(result); break; } } } base.OnCompletion(caller); }
/// <summary> /// {@inheritDoc} /// /// @implNote /// Clears spliterator and children fields. Overriders MUST call /// {@code super.onCompletion} as the last thing they do if they want these /// cleared. /// </summary> public override void onCompletion <T1>(CountedCompleter <T1> caller) { Spliterator = null; LeftChild = RightChild = null; }