/** * Generic default comparison algorithm that simply walks through the * property and child node lists of the given base state and compares * the entries one by one with corresponding ones (if any) in this state. */ @Override public boolean compareAgainstBaseState(NodeState base, NodeStateDiff diff) { return compareAgainstBaseState(this, base, diff); }
/** * Generic default comparison algorithm that simply walks through the * property and child node lists of the given base state and compares * the entries one by one with corresponding ones (if any) in this state. */ @Override public boolean compareAgainstBaseState(NodeState base, NodeStateDiff diff) { return compareAgainstBaseState(this, base, diff); }
@Override public boolean compareAgainstBaseState(final NodeState base, final NodeStateDiff diff) { return AbstractNodeState.compareAgainstBaseState(this, base, new DecoratingDiff(diff, this)); }
@Override public boolean childNodeChanged(String name, NodeState before, NodeState after) { return AbstractNodeState.compareAgainstBaseState(after, before, new AssertingDiff()); }
@Override public boolean compareAgainstBaseState(NodeState base, NodeStateDiff diff) { if (this == base) { return true; } else if (base == EMPTY_NODE || !base.exists()) { // special case return EmptyNodeState.compareAgainstEmptyState(this, diff); } else if (this.base == base) { return modified.compareAgainstBaseState(this.base, diff); } else if (base instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) base; if (this.base.getPath().equals(other.getPath())) { if (revisionEquals(this.base, other)) { return modified.compareAgainstBaseState(this.base, diff); } } } // fall back to the generic node state diff algorithm return super.compareAgainstBaseState(base, diff); }
public static boolean assertEquals(NodeState before, NodeState after) { //Do not rely on default compareAgainstBaseState as that works at lastRev level //and we need proper equals return before.exists() == after.exists() && AbstractNodeState.compareAgainstBaseState(after, before, new AssertingDiff()); }
@Override public boolean compareAgainstBaseState(NodeState base, NodeStateDiff diff) { if (this == base) { return true; } else if (base == EMPTY_NODE || !base.exists()) { // special case return EmptyNodeState.compareAgainstEmptyState(this, diff); } else if (this.base == base) { return modified.compareAgainstBaseState(this.base, diff); } else if (base instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) base; if (this.base.getPath().equals(other.getPath())) { if (revisionEquals(this.base, other)) { return modified.compareAgainstBaseState(this.base, diff); } } } // fall back to the generic node state diff algorithm return super.compareAgainstBaseState(base, diff); }
return super.compareAgainstBaseState(base, diff);
return super.compareAgainstBaseState(base, diff);
@Override public boolean compareAgainstBaseState(NodeState base, NodeStateDiff diff) { if (base instanceof CompositeNodeState) { CompositeNodeState multiBase = (CompositeNodeState) base; NodeStateDiff wrappingDiff = new WrappingDiff(diff, multiBase); boolean full = getWrappedNodeState().compareAgainstBaseState(multiBase.getWrappedNodeState(), new ChildrenDiffFilter(wrappingDiff, ctx.getGlobalStore(), true)); for (MountedNodeStore mns : ctx.getContributingStoresForNodes(path, nodeStates)) { if (ctx.getGlobalStore() == mns) { continue; } NodeStateDiff childrenDiffFilter = new ChildrenDiffFilter(wrappingDiff, mns, false); NodeState contributing = nodeStates.get(mns); NodeState contributingBase = multiBase.nodeStates.get(mns); full = full && contributing.compareAgainstBaseState(contributingBase, childrenDiffFilter); } return full; } else { return super.compareAgainstBaseState(base, diff); } }
return EmptyNodeState.compareAgainstEmptyState(this, diff); } else if (!(base instanceof SegmentNodeState)) { // fallback return AbstractNodeState.compareAgainstBaseState(this, base, diff);