/** * 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)) { if (info.reportFeatures) { info.consumer.feature(left, right); } return null; } checkState(TYPE.TREE.equals(type)); return traverseTree(left, right); }
/** * 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); }
nodesByBucket, left, rightLeaf); 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();
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return;
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return;
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return;
if (info.consumer.isCancelled()) { return;
protected void compute() { final CancellableConsumer consumer = info.consumer; if (consumer.isCancelled()) { return;
if (info.consumer.isCancelled()) { return;
return; if (info.consumer.isCancelled()) { return; if (!info.consumer.isCancelled()) { invokeAll(tasks);
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); } }
@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()); TraverseTreeContents traverseTreeContents = new TraverseTreeContents(info, left, right, BucketIndex.root(left, right)); traverseTreeContents.compute(); } info.consumer.endTree(leftNode, rightNode); } }
@Override public boolean tree(NodeRef left, NodeRef right) { return !isCancelled() && delegate.tree(left, right); }
@Override public boolean tree(NodeRef left, NodeRef right) { return !isCancelled() && delegate.tree(left, right); }
@Override public boolean feature(NodeRef left, NodeRef right) { boolean continuteTraversal = !isCancelled() && delegate.feature(left, right); if (!continuteTraversal) { abortTraversal(); } return continuteTraversal; }
@Override public boolean feature(NodeRef left, NodeRef right) { boolean continuteTraversal = !isCancelled() && delegate.feature(left, right); if (!continuteTraversal) { abortTraversal(); } return continuteTraversal; }
@Override public boolean bucket(NodeRef leftParent, NodeRef rightParent, BucketIndex bucketIndex, Bucket left, Bucket right) { return !isCancelled() && delegate.bucket(leftParent, rightParent, bucketIndex, left, right); } }
@Override public boolean bucket(NodeRef leftParent, NodeRef rightParent, BucketIndex bucketIndex, Bucket left, Bucket right) { return !isCancelled() && delegate.bucket(leftParent, rightParent, bucketIndex, left, right); } }