if (toadd.parent != null) { throw new IllegalArgumentException("Cannot add " + toadd.debugString() + " as a child of " + debugString() + " since component is already attached to the tree." + "\n Please detach it first using the remove method."); if (childmap.get(childkey) != null) { throw new IllegalArgumentException("Cannot add leaf " + toadd.debugString() + " as a child of " + debugString() + " since it would displace an existing child of the same name. " + "\n Please remove the existing component first.");