Class PatternTokenReader

java.lang.Object
ch.andre601.expressionparser.tokens.readers.TokenReader
ch.andre601.expressionparser.tokens.readers.PatternTokenReader

public class PatternTokenReader extends TokenReader
TokenReader instance that parses the provided text by looking for appearances of a provided pattern and in such a case returns the provided Token instance.
  • Constructor Details

    • PatternTokenReader

      public PatternTokenReader(Token token, String pattern)
      Creates a new PatternTokenReader instance with the provided Token instance being used for the provided Pattern String.
      Calling this constructor creates a case-insensitive PatternTokenReader. Should you require a case-sensitive one, use PatternTokenReader(Token, String, false) instead.
      Parameters:
      token - The Token to use for this PatternTokenReader.
      pattern - The pattern to use for this PatternTokenReader.
      Throws:
      IllegalArgumentException - Should token be null, Pattern be null or Pattern be empty.
      See Also:
    • PatternTokenReader

      public PatternTokenReader(Token token, String pattern, boolean ignoreCase)
      Creates a new PatternTokenReader instance with the provided Token instance being used for the provided Pattern String. The Boolean option allows you to toggle, whether the lookup should ignore casing of the text.
      Parameters:
      token - The Token to use for this PatternTokenReader.
      pattern - The pattern to use for this PatternTokenReader.
      ignoreCase - Whether the PatternTokenReader should ignore case when looking for the pattern.
      Throws:
      IllegalArgumentException - Should token be null, Pattern be null or Pattern be empty.
  • Method Details