int (Object object, Object child) { if (object == state) { if (roots == null) roots = state.getRoots(); for (int i = 0; i < roots.size(); i++) { if (child == roots.get(i)) return i; } } else if (object instanceof Node && child instanceof Node) { Entry<Node> entry = getEntry((Node)object, true); if (entry != null) return entry.getIndexOf((Node)child); } return -1; }