Skip to content

Instantly share code, notes, and snippets.

@claymccoy
Created August 18, 2008 15:58
Show Gist options
  • Save claymccoy/5998 to your computer and use it in GitHub Desktop.
Save claymccoy/5998 to your computer and use it in GitHub Desktop.
TreeNode ellipse = null;
for (TreeNode treeNode : shape.getChildren()) {
if ("ellipse".equals(treeNode.getName())) {
ellipse = treeNode;
break;
}
}
if (null == ellipse) {
ellipse = new TreeNode("ellipse");
shape.addChild(ellipse);
}
TreeNode circle = null;
for (TreeNode treeNode : ellipse.getChildren()) {
if ("circle".equals(treeNode.getName())) {
circle = treeNode;
break;
}
}
if (null == circle) {
circle = new TreeNode("circle");
ellipse.addChild(circle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment