MemoryNodeBuilder implements NodeBuilder { public void reset(@NotNull NodeState newBase) { checkState(parent == null); base = checkNotNull(newBase); baseRevision = rootHead.setState(newBase) + 1; } protected  MemoryNodeBuilder(MemoryNodeBuilder parent, String name);  MemoryNodeBuilder(@NotNull NodeState base); final boolean isRoot(); void reset(@NotNull NodeState newBase); @Override @NotNull NodeState getNodeState(); @Override @NotNull NodeState getBaseState(); @Override boolean exists(); @Override boolean isNew(); @Override boolean isNew(String name); @Override boolean isModified(); @Override boolean isReplaced(); @Override boolean isReplaced(String name); @Override long getChildNodeCount(long max); @NotNull @Override Iterable<String> getChildNodeNames(); @Override boolean hasChildNode(@NotNull String name); @NotNull @Override NodeBuilder child(@NotNull String name); @NotNull @Override NodeBuilder getChildNode(@NotNull String name); @NotNull @Override NodeBuilder setChildNode(@NotNull String name); @NotNull @Override NodeBuilder setChildNode(@NotNull String name, @NotNull NodeState state); @Override boolean remove(); @Override boolean moveTo(@NotNull NodeBuilder newParent, @NotNull String newName); @Override long getPropertyCount(); @NotNull @Override Iterable<? extends PropertyState> getProperties(); @Override boolean hasProperty(String name); @Override PropertyState getProperty(String name); @Override boolean getBoolean(@NotNull String name); @Override @Nullable String getString(@NotNull String name); @Override @Nullable String getName(@NotNull String name); @Override @NotNull Iterable<String> getNames(@NotNull String name); @NotNull @Override NodeBuilder setProperty(@NotNull PropertyState property); @NotNull @Override NodeBuilder setProperty(String name, @NotNull T value); @NotNull @Override NodeBuilder setProperty(String name, @NotNull T value, Type<T> type); @NotNull @Override NodeBuilder removeProperty(String name); @Override Blob createBlob(InputStream stream); final String getPath(); @Override String toString();  }
@Test public void testReset() { NodeBuilder root = base.builder(); NodeBuilder child = root.child("x"); child.child("new"); assertTrue(child.hasChildNode("new")); assertTrue(root.child("x").hasChildNode("new")); ((MemoryNodeBuilder) root).reset(base); assertFalse(child.hasChildNode("new")); assertFalse(root.child("x").hasChildNode("new")); }