/** * 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 @NotNull public NodeState getChildNode(@NotNull String name) { checkValidName(name); return MISSING_NODE; }
private static boolean isInitializationPhase(NodeState before, NodeState after) { return !comparePropertiesAgainstBaseState(after, before, new DefaultNodeStateDiff() { @Override public boolean propertyAdded(PropertyState after) { return !after.getName().equals(VERSION_STORE_INIT); } }); } }
@Override public long getPropertyCount() { return count(getProperties()); }
/** * Checks whether the given object is equal to this one. Two node states * are considered equal if all their properties and child nodes match, * regardless of ordering. Subclasses may override this method with a * more efficient equality check if one is available. * * @param that target of the comparison * @return {@code true} if the objects are equal, * {@code false} otherwise */ @Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof NodeState) { return equals(this, (NodeState) that); } else { return false; } }
/** * Returns a string representation of this node state. * * @return string representation */ public String toString() { return toString(this); }
@Override public Iterable<String> getChildNodeNames() { return Iterables.transform( getChildNodeEntries(), new Function<ChildNodeEntry, String>() { @Override public String apply(ChildNodeEntry input) { return input.getName(); } }); }
@Override public synchronized long getChildNodeCount(long max) { if (childNodeCount == -1) { long count; if (treePermission.canReadAll()) { count = state.getChildNodeCount(max); } else { count = super.getChildNodeCount(max); } if (count == Long.MAX_VALUE) { return count; } childNodeCount = count; } return childNodeCount; }
@Override public boolean getBoolean(@Nonnull String name) { return getBoolean(this, name); }
/** * Checks whether the given object is equal to this one. Two node states * are considered equal if all their properties and child nodes match, * regardless of ordering. Subclasses may override this method with a * more efficient equality check if one is available. * * @param that target of the comparison * @return {@code true} if the objects are equal, * {@code false} otherwise */ @Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof NodeState) { return equals(this, (NodeState) that); } else { return false; } }
@Override public long getPropertyCount() { return count(getProperties()); }
@Override public String toString() { return AbstractNodeState.toString(this); }
@Override public Iterable<String> getChildNodeNames() { return Iterables.transform( getChildNodeEntries(), new Function<ChildNodeEntry, String>() { @Override public String apply(ChildNodeEntry input) { return input.getName(); } }); }
@Override public synchronized long getChildNodeCount(long max) { if (childNodeCount == -1) { long count; if (treePermission.canReadAll()) { count = state.getChildNodeCount(max); } else { count = super.getChildNodeCount(max); } if (count == Long.MAX_VALUE) { return count; } childNodeCount = count; } return childNodeCount; }
@Override public boolean getBoolean(@NotNull String name) { return getBoolean(this, name); }
/** * 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 @Nonnull public NodeState getChildNode(@Nonnull String name) { checkValidName(name); return MISSING_NODE; }
private static boolean isInitializationPhase(NodeState before, NodeState after) { return !comparePropertiesAgainstBaseState(after, before, new DefaultNodeStateDiff() { @Override public boolean propertyAdded(PropertyState after) { return !after.getName().equals(VERSION_STORE_INIT); } }); } }
@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; }
/** * Returns a string representation of this node state. * * @return string representation */ public String toString() { return toString(this); }