All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jangaroo.extxml.util.Rule Maven / Gradle / Ivy

The newest version!
package net.jangaroo.extxml.util;

import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.List;

/**
 * A Rule defines a regular expression ({@link java.util.regex.Pattern}) and code to be executed
 * when a line matches that pattern. The code will be invoked with the current State.
 */
public abstract class Rule {

  public Rule(String pattern) {
    this.pattern = Pattern.compile(pattern,0);
  }

  public Matcher createMatcher(String line) {
    return pattern.matcher(line);
  }

  public abstract void matched(State state, List groups);

  private Pattern pattern;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy