Class OneOrMoreMatcher

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

public class OneOrMoreMatcher extends AbstractMatcher
A Matcher that repeatedly tries its submatcher against the input. Succeeds if its submatcher succeeds at least once.
  • Field Details

    • subMatcher

      public final Matcher subMatcher
  • Constructor Details

    • OneOrMoreMatcher

      public OneOrMoreMatcher(Rule subRule)
  • Method Details

    • match

      public boolean match(MatcherContext context)
      Description copied from interface: Matcher
      Tries a match on the given MatcherContext.
      Parameters:
      context - the MatcherContext
      Returns:
      true if the match was successful
    • accept

      public <R> R accept(MatcherVisitor<R> visitor)
      Description copied from interface: Matcher
      Accepts the given matcher visitor.
      Parameters:
      visitor - the visitor
      Returns:
      the value returned by the given visitor
    • 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)
    • hasCustomLabel

      public boolean hasCustomLabel()
      Specified by:
      hasCustomLabel in interface Matcher
      Overrides:
      hasCustomLabel in class AbstractMatcher
      Returns:
      true if this matcher has been assigned a custom label
    • defaultLabel

      public OneOrMoreMatcher defaultLabel(String defaultLabel)