@Override public boolean hasProperty(String name) { return head().getCurrentNodeState().hasProperty(checkNotNull(name)); }
@Override @NotNull public NodeState getNodeState() { return head().getImmutableNodeState(); }
@Nonnull @Override public NodeBuilder removeProperty(String name) { checkState(exists(), "This builder does not exist: " + name); if (head().getMutableNodeState().removeProperty(checkNotNull(name))) { updated(); } return this; }
@Override public Head update() { long rootRevision = rootHead.revision; if (revision != rootRevision) { // root revision changed: recursively re-get state from parent NodeState parentState = builder.parent.head().getCurrentNodeState(); NodeState newState = parentState.getChildNode(builder.name); if (newState instanceof MutableNodeState) { // transition state to ConnectedHead builder.head = new ConnectedHead( builder, (MutableNodeState) newState); return builder.head; } else { // update to match the latest revision state = newState; revision = rootRevision; } } return this; }
@Override public Head update() { long rootRevision = rootHead.revision; if (revision != rootRevision) { // root revision changed: recursively re-get state from parent NodeState parentState = builder.parent.head().getCurrentNodeState(); NodeState newState = parentState.getChildNode(builder.name); if (newState instanceof MutableNodeState) { // transition state to ConnectedHead builder.head = new ConnectedHead( builder, (MutableNodeState) newState); return builder.head; } else { // update to match the latest revision state = newState; revision = rootRevision; } } return this; }
@Override public long getChildNodeCount(long max) { return head().getCurrentNodeState().getChildNodeCount(max); }
@Override @CheckForNull public String getName(@Nonnull String name) { return head().getCurrentNodeState().getName(checkNotNull(name)); }
@Override @CheckForNull public String getString(@Nonnull String name) { return head().getCurrentNodeState().getString(checkNotNull(name)); }
@Override public boolean exists() { return head().getCurrentNodeState().exists(); }
@Override public boolean isModified() { return head().isModified(); }
@Override @NotNull public Iterable<String> getNames(@NotNull String name) { return head().getCurrentNodeState().getNames(checkNotNull(name)); }
@Override public long getChildNodeCount(long max) { return head().getCurrentNodeState().getChildNodeCount(max); }
@Override @Nullable public String getName(@NotNull String name) { return head().getCurrentNodeState().getName(checkNotNull(name)); }
@Override public boolean getBoolean(@NotNull String name) { return head().getCurrentNodeState().getBoolean(checkNotNull(name)); }
@Override public boolean hasProperty(String name) { return head().getCurrentNodeState().hasProperty(checkNotNull(name)); }
@Override public boolean hasChildNode(@NotNull String name) { return head().getCurrentNodeState().hasChildNode(checkNotNull(name)); }
@Override public Head update() { if (revision != builder.rootBuilder.baseRevision) { // the root builder's base state has been reset: transition back // to unconnected and connect again if necessary. // No need to pass base() instead of base as the subsequent // call to update will take care of updating to the latest state. builder.head = new UnconnectedHead(builder, builder.base); return builder.head.update(); } else { return this; } }
@Override public PropertyState getProperty(String name) { return head.update().getCurrentNodeState().getProperty(checkNotNull(name)); }
@Override @Nonnull public Iterable<String> getNames(@Nonnull String name) { return head().getCurrentNodeState().getNames(checkNotNull(name)); }
@Override public boolean getBoolean(@Nonnull String name) { return head().getCurrentNodeState().getBoolean(checkNotNull(name)); }