public int getIndexOfChild(Object parent, Object child)
  {
    if(!(parent instanceof ObjectNode))
      throw new RuntimeException("unexpected object of " + parent.getClass() + " passed");
    if(!(child instanceof ObjectNode))
      throw new RuntimeException("unexpected object of " + child.getClass() + " passed");
    ObjectNode onp = (ObjectNode)parent;
    ObjectNode onc = (ObjectNode)child;
    ObjectNode[] ch = onp.children();
    for(int i = 0; i < ch.length; i++)
    {
      if(ch[i].equals(child))
        return i;
    }
    return -1;
  }