예제 #1
0
 @Override
 public List<PatternNote> generate(PatternNote baseNote) {
   List<PatternNote> list = new ArrayList<>();
   list.add(baseNote);
   for (PatternStep element : stepList) {
     baseNote = element.transform(baseNote);
     list.add(baseNote);
   }
   return list;
 }
예제 #2
0
 public boolean isPrefix(String[] segments, int startIndex) {
   int pos = startIndex;
   for (int i = 0; pos < segments.length && i < steps.size(); i++, pos++) {
     PatternStep step = steps.get(i);
     if (!step.matches(segments[pos])) {
       return false;
     }
   }
   if (pos == segments.length) {
     return true;
   }
   return next.isPrefix(segments, pos);
 }
예제 #3
0
 public boolean matches(String[] segments, int startIndex) {
   int remaining = segments.length - startIndex;
   if (remaining < minSegments || remaining > maxSegments) {
     return false;
   }
   int pos = startIndex;
   for (int i = 0; i < steps.size(); i++, pos++) {
     PatternStep step = steps.get(i);
     if (!step.matches(segments[pos])) {
       return false;
     }
   }
   return next.matches(segments, pos);
 }