/** Returns our index in our parent */
public int getIndexInParent() {
// FIXME: store numleft and numright in the tree
- if (peerTree_parent == null) return left == null ? 0 : left.numPeerChildren();
+ if (peerTree_parent == null) return left == null ? 0 : left.numPeerChildren() + 1;
else if (peerTree_parent.left == this) return peerTree_parent.getIndexInParent() - 1;
else if (peerTree_parent.right == this) return peerTree_parent.getIndexInParent() + 1;
else throw new Error("we're not a child of our parent!");