예제 #1
0
 @Override
 public boolean match(T node) {
   boolean matched = false;
   for (NodePattern<T> p : nodePatterns) {
     if (p.match(node)) {
       matched = true;
       break;
     }
   }
   return matched;
 }
 protected <T> boolean match(
     int bid, SequenceMatcher.MatchedStates<T> matchedStates, boolean consume) {
   if (consume) {
     // Get element and return if it matched or not
     T node = matchedStates.get();
     // TODO: Fix type checking
     if (pattern.match(node)) {
       // If matched, need to add next states to the queue of states to be processed
       matchedStates.addStates(bid, next);
       return true;
     } else {
       return false;
     }
   } else {
     // Not consuming element - add this state back to queue of states to be processed
     // This state was not successfully matched
     matchedStates.addState(bid, this);
     return false;
   }
 }
예제 #3
0
 @Override
 public boolean match(T node) {
   return !p.match(node);
 }