private void insertAtRoot(Event start, EventSet e, int offset) { root.addEventToLevel(start); XEDictionaryNode node; node = root; int j = offset; while (j < e.size() - 1) { node = node.get(e.eventAt(j)); j++; // System.out.println("Adding Event: " + e.eventAt(j)); node.addEventToLevel(e.eventAt(j)); } }
private void insertBelowRoot(Event start, EventSet e, int offset) { XEDictionaryNode node; node = root; // System.out.println("Event at offset: " + e.eventAt(offset)); node = node.get(e.eventAt(offset)); int j = offset; boolean matches = true; // match the events up to a given level while (matches && (j < e.size() - 1)) { j++; if (node.isEventInLevel(e.eventAt(j))) { // System.out.println("Match at level: " + e.eventAt(j)); node = node.get(e.eventAt(j)); } else { matches = false; } } for (int i = j; i < e.size(); i++) { // System.out.println("Adding Event: " + e.eventAt(i)); node.addEventToLevel(e.eventAt(i)); node = node.get(e.eventAt(i)); } }