@Override public void setRoot(NodeState newRoot) { checkNotMerged(); this.root = ModifiedNodeState.squeeze(newRoot); }
NodeState snapshot() { assert base != null; if (properties.isEmpty() && nodes.isEmpty()) { return base; } else { return new ModifiedNodeState(base, properties, nodes); } }
@Override public long getChildNodeCount(long max) { assert base != null; return ModifiedNodeState.getChildNodeCount(base, nodes, max); }
beforeId = deduplicateNode(after.getBaseState()); if (before != null && before.getChildNodeCount(2) > 1 && after.getChildNodeCount(2) > 1) { base = before.getChildNodeMap(); childNodes = new ChildNodeCollectorDiff().diff(before, after);
@Override public Iterable<String> getChildNodeNames() { return getChildNodeNames(base, nodes, false); }
@NotNull @Override public Iterable<? extends PropertyState> getProperties() { return getProperties(base, properties, false); }
@Override public PropertyState getProperty(@NotNull String name) { return ModifiedNodeState.getProperty(base, properties, name); }
@Override public long getPropertyCount() { return ModifiedNodeState.getPropertyCount(base, properties); }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) that; if (!getPath().equals(other.getPath())) { // path does not match: not equals // (even if the properties are equal) return false; } if (revisionEquals(other)) { return true; } // revision does not match: might still be equals } else if (that instanceof ModifiedNodeState) { ModifiedNodeState modified = (ModifiedNodeState) that; if (modified.getBaseState() == this) { return EqualsDiff.equals(this, modified); } } if (that instanceof NodeState) { return AbstractNodeState.equals(this, (NodeState) that); } return false; }
@Override public Iterable<String> getChildNodeNames() { return getChildNodeNames(base, nodes, false); }
@Nonnull @Override public Iterable<? extends PropertyState> getProperties() { return getProperties(base, properties, false); }
@Override public PropertyState getProperty(@Nonnull String name) { return ModifiedNodeState.getProperty(base, properties, name); }
@Override public long getPropertyCount() { return getPropertyCount(base, properties); }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) that; if (!getPath().equals(other.getPath())) { // path does not match: not equals // (even if the properties are equal) return false; } if (revisionEquals(other)) { return true; } // revision does not match: might still be equals } else if (that instanceof ModifiedNodeState) { ModifiedNodeState modified = (ModifiedNodeState) that; if (modified.getBaseState() == this) { return EqualsDiff.equals(this, modified); } } if (that instanceof NodeState) { return AbstractNodeState.equals(this, (NodeState) that); } return false; }
@Override public void setRoot(NodeState newRoot) { checkNotMerged(); this.root = ModifiedNodeState.squeeze(newRoot); }
NodeState snapshot() { assert base != null; if (properties.isEmpty() && nodes.isEmpty()) { return base; } else { return new ModifiedNodeState(base, properties, nodes); } }
@Override public long getChildNodeCount(long max) { assert base != null; return ModifiedNodeState.getChildNodeCount(base, nodes, max); }
@Override @Nonnull public Iterable<String> getChildNodeNames() { assert base != null; return ModifiedNodeState.getChildNodeNames(base, nodes, true); }
@Override @NotNull public Iterable<? extends PropertyState> getProperties() { return ModifiedNodeState.getProperties(base, properties, true); }
@Override public PropertyState getProperty(@Nonnull String name) { return getProperty(base, properties, name); }