int (Object parent, Object child) { Object group = myGroup; if (group == null) { if (myRoot.equals(parent) && myNode.equals(child)) return 0; } else { if (myRoot.equals(parent) && group.equals(child)) return 0; if (group.equals(parent) && myNode.equals(child)) return 0; } if (myNode.equals(parent) && myLeaf.equals(child)) return 0; throw new IllegalStateException(); }