Class FirstOfStringsMatcher

  • All Implemented Interfaces:
    Cloneable, Matcher, Rule, GraphNode<Matcher>

    public class FirstOfStringsMatcher
    extends FirstOfMatcher
    A specialized FirstOfMatcher that handles FirstOf(string, string, ...) rules much faster that the regular FirstOfMatcher. If fast string matching is enabled this matcher uses a prebuilt character tree to efficiently determine whether the next input characters match the rule expression.
    • Field Detail

      • strings

        public final char[][] strings
    • Constructor Detail

      • FirstOfStringsMatcher

        public FirstOfStringsMatcher​(Rule[] subRules,
                                     char[][] strings)
    • Method Detail

      • match

        public boolean match​(MatcherContext context)
        Description copied from interface: Matcher
        Tries a match on the given MatcherContext.
        Specified by:
        match in interface Matcher
        Overrides:
        match in class FirstOfMatcher
        Parameters:
        context - the MatcherContext
        Returns:
        true if the match was successful
      • getLabel

        public String getLabel()
        Specified by:
        getLabel in interface Matcher
        Overrides:
        getLabel in class AbstractMatcher
        Returns:
        the label of the matcher (which is identical to the label of the Rule this matcher matches)
      • defaultLabel

        public T defaultLabel​(String defaultLabel)