/** * Called when found a difference between two nodes. It can be a removal ({@code right} is * null), an added node ({@code left} is null}, or a modified feature/tree (neither is * null); but {@code left} and {@code right} can never be equal. * <p> * Depending on the type of node, this method will call {@link Consumer#tree} or * {@link Consumer#feature}, and continue the traversal down the trees in case it was a tree * and {@link Consumer#tree} returned null. */ @Nullable protected final WalkAction node(@Nullable final NodeRef left, @Nullable final NodeRef right) { if (info.consumer.isCancelled()) { return null; } checkState(left != null || right != null, "both nodes can't be null"); checkArgument(!Objects.equal(left, right)); final TYPE type = left == null ? right.getType() : left.getType(); if (TYPE.FEATURE.equals(type)) { info.consumer.feature(left, right); return null; } checkState(TYPE.TREE.equals(type)); return traverseTree(left, right); }
NodeRef rightRef = NodeRef.createRoot(rnode); this.walkConsumer = new CancellableConsumer(consumer);
List<WalkAction> bucketBucket(RevTree left, RevTree right) { checkArgument(left.bucketsSize() > 0); checkArgument(right.bucketsSize() > 0); if (info.consumer.isCancelled()) { return Collections.emptyList(); if (info.consumer.isCancelled()) { return Collections.emptyList();
if (info.consumer.isCancelled()) { return; while (li.hasNext() && ri.hasNext() && !info.consumer.isCancelled()) { final Node lpeek = li.peek(); final Node rpeek = ri.peek(); checkState(info.consumer.isCancelled() || !li.hasNext() || !ri.hasNext(), "either the left or the right iterator should have been fully consumed"); while (!info.consumer.isCancelled() && li.hasNext()) { WalkAction action = node(newRef(leftParent, li.next()), null); if (action != null) { while (!info.consumer.isCancelled() && ri.hasNext()) { WalkAction action = node(null, newRef(rightParent, ri.next())); if (action != null) { if (!info.consumer.isCancelled()) { invokeAll(tasks);
if (info.consumer.isCancelled()) { return; while (li.hasNext() && ri.hasNext() && !info.consumer.isCancelled()) { final Node lpeek = li.peek(); final Node rpeek = ri.peek(); checkState(info.consumer.isCancelled() || !li.hasNext() || !ri.hasNext(), "either the left or the right iterator should have been fully consumed"); while (!info.consumer.isCancelled() && li.hasNext()) { WalkAction action = node(newRef(leftParent, li.next()), null); if (action != null) { while (!info.consumer.isCancelled() && ri.hasNext()) { WalkAction action = node(null, newRef(rightParent, ri.next())); if (action != null) { if (!info.consumer.isCancelled()) { invokeAll(tasks);
nodesByBucket, left, rightLeaf); if (info.consumer.isCancelled()) { return Collections.emptyList(); if (info.consumer.isCancelled()) { return Collections.emptyList();
nodesByBucket, left, right); if (info.consumer.isCancelled()) { return Collections.emptyList(); if (info.consumer.isCancelled()) { return Collections.emptyList();
nodesByBucket, left, right); if (info.consumer.isCancelled()) { return Collections.emptyList(); if (info.consumer.isCancelled()) { return Collections.emptyList();
List<WalkAction> bucketBucket(RevTree left, RevTree right) { checkArgument(!left.buckets().isEmpty()); checkArgument(!right.buckets().isEmpty()); if (info.consumer.isCancelled()) { return Collections.emptyList(); if (info.consumer.isCancelled()) { return Collections.emptyList();
NodeRef rightRef = NodeRef.createRoot(rnode); this.walkConsumer = new CancellableConsumer(consumer);
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return; final NodeRef rightParent = info.right.parentRef; final BucketIndex index = super.bucketIndex; if (consumer.bucket(leftParent, rightParent, index, null, rightBucket)) { if (leftNodes.hasNext()) { if (rightTree.buckets().isEmpty()) { consumer.endBucket(leftParent, rightParent, index, null, rightBucket);
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return; final NodeRef rightParent = info.right.parentRef; final BucketIndex index = super.bucketIndex; if (consumer.bucket(leftParent, rightParent, index, leftBucket, null)) { if (rightNodes.hasNext()) { if (leftTree.buckets().isEmpty()) { consumer.endBucket(leftParent, rightParent, index, leftBucket, null);
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return; final NodeRef rightParent = info.right.parentRef; final BucketIndex index = super.bucketIndex; if (consumer.bucket(leftParent, rightParent, index, null, rightBucket)) { if (leftNodes.hasNext()) { if (rightTree.bucketsSize() == 0) { consumer.endBucket(leftParent, rightParent, index, null, rightBucket);
if (info.consumer.isCancelled()) { return; final BucketIndex index = super.bucketIndex; if (info.consumer.bucket(leftParent, rightParent, index, leftBucket, rightBucket)) { super.compute(); info.consumer.endBucket(leftParent, rightParent, index, leftBucket, rightBucket);
nodesByBucket, left, rightLeaf); if (info.consumer.isCancelled()) { return Collections.emptyList(); if (info.consumer.isCancelled()) { return Collections.emptyList();
return; if (info.consumer.isCancelled()) { return; if (!info.consumer.isCancelled()) { invokeAll(tasks);
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return; final NodeRef rightParent = info.right.parentRef; final BucketIndex index = super.bucketIndex; if (consumer.bucket(leftParent, rightParent, index, leftBucket, null)) { if (rightNodes.hasNext()) { if (leftTree.bucketsSize() == 0) { consumer.endBucket(leftParent, rightParent, index, leftBucket, null);
if (info.consumer.isCancelled()) { return; final BucketIndex index = super.bucketIndex; if (info.consumer.bucket(leftParent, rightParent, index, leftBucket, rightBucket)) { super.compute(); info.consumer.endBucket(leftParent, rightParent, index, leftBucket, rightBucket);
return; if (info.consumer.isCancelled()) { return; if (!info.consumer.isCancelled()) { invokeAll(tasks);
@Override protected void compute() { final @Nullable NodeRef leftNode = info.left.parentRef; final @Nullable NodeRef rightNode = info.right.parentRef; if (Objects.equal(leftNode, rightNode)) { return; } if (info.consumer.isCancelled()) { return; } if (info.consumer.tree(leftNode, rightNode)) { RevTree left; RevTree right; left = leftNode == null || RevTree.EMPTY_TREE_ID.equals(leftNode.getObjectId()) ? RevTree.EMPTY : info.left.source.getTree(leftNode.getObjectId()); right = rightNode == null || RevTree.EMPTY_TREE_ID.equals(rightNode.getObjectId()) ? RevTree.EMPTY : info.right.source.getTree(rightNode.getObjectId()); if (info.reportFeatures || (left.numTrees() > 0 || right.numTrees() > 0)) { TraverseTreeContents traverseTreeContents = new TraverseTreeContents(info, left, right, BucketIndex.root(left, right)); traverseTreeContents.compute(); } } info.consumer.endTree(leftNode, rightNode); } }