@Test public void testReplaceSubtree() { String text = "foo"; SetStatementTree tree = new SetStatementTree(); SetStatementTree oldChild = new SetStatementTree(); tree._children.put("foo", oldChild); SetStatementTree newChild = tree.replaceSubtree(text); assertThat(tree._children, hasEntry(equalTo(text), sameInstance(newChild))); assertThat(newChild, not(sameInstance(oldChild))); }
public SetStatementTree replaceSubtree(String partialStatementText) { _children.remove(partialStatementText); return getOrAddSubtree(partialStatementText); }
SetStatementTree { public SetStatementTree replaceSubtree(String partialStatementText) { _children.remove(partialStatementText); return getOrAddSubtree(partialStatementText); } }
SetStatementTree { public SetStatementTree replaceSubtree(String partialStatementText) { _children.remove(partialStatementText); return getOrAddSubtree(partialStatementText); } SetStatementTree(); private  SetStatementTree(@Nullable SetStatementTree parent); }
SetStatementTree { public SetStatementTree replaceSubtree(String partialStatementText) { _children.remove(partialStatementText); return getOrAddSubtree(partialStatementText); } SetStatementTree(); private  SetStatementTree(@Nullable SetStatementTree parent); void addSetStatementIndex(int setStatementIndex); @Nonnull SetStatementTree getOrAddSubtree(String partialStatementText); @Nullable SetStatementTree getParent(); @Nonnull Set<Integer> getSetStatementIndices(); SetStatementTree replaceSubtree(String partialStatementText); }
SetStatementTree { public SetStatementTree replaceSubtree(String partialStatementText) { _children.remove(partialStatementText); return getOrAddSubtree(partialStatementText); } SetStatementTree(); private  SetStatementTree(@Nullable SetStatementTree parent); void addSetStatementIndex(int setStatementIndex); @Nonnull SetStatementTree getOrAddSubtree(String partialStatementText); @Nullable SetStatementTree getParent(); @Nonnull Set<Integer> getSetStatementIndices(); SetStatementTree replaceSubtree(String partialStatementText);  }