Example #1
0
 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));
   }
 }
Example #2
0
 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));
   }
 }
Example #3
0
 public int find(EventSet e) {
   int matchlength = 0;
   boolean matched = false;
   XEDictionaryNode node = root;
   while ((matchlength < e.size()) && !matched) {
     if (node.isEventInLevel(e.eventAt(matchlength))) {
       node = node.get(e.eventAt(matchlength));
       matchlength++;
     } else {
       matched = true;
     }
   }
   return matchlength;
 }