beast2 icon indicating copy to clipboard operation
beast2 copied to clipboard

Node.setRight(Node rightChild) called on a node with no children will result in getChildCount() returning 2, and getChild(0) will return null

Open alexeid opened this issue 8 years ago • 0 comments

If Node.setRight(Node rightChild) is called on a node with no children it will result in getChildCount() returning 2 when there is only one non-null child node. Should we consider failing at the setRight() if there is no left child? Otherwise a single call will lead to an invalid state (I assume having a right child and no left child is invalid). In the case of Node.addChild(Node child) there is no equivalent side-effect and getChildCount() will always return the correct number. Perhaps setLeft and setRight should be deprecated?

alexeid avatar Jun 07 '17 01:06 alexeid