Package spoon.pattern

Enum Quantifier

java.lang.Object
java.lang.Enum<Quantifier>
spoon.pattern.Quantifier
All Implemented Interfaces:
Serializable, Comparable<Quantifier>

public enum Quantifier extends Enum<Quantifier>
Defines a matching strategy for pattern parameters, default is GREEDY.
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Force the matcher to read in, or eat, the entire input prior to attempting the next match (default).
    The possessive quantifier always eats the entire input string, trying once (and only once) for a match.
    The reluctant quantifier takes the opposite approach: It start at the beginning of the input, then reluctantly eats one character at a time looking for a match.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Quantifier
    valueOf​(String name)
    Returns the enum constant of this type with the specified name.
    static Quantifier[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • GREEDY

      public static final Quantifier GREEDY
      Force the matcher to read in, or eat, the entire input prior to attempting the next match (default). If the next match attempt (the entire input) fails, the matcher backs off the input by one and tries again, repeating the process until a match is found or there are no more elements left to back off from.
    • RELUCTANT

      public static final Quantifier RELUCTANT
      The reluctant quantifier takes the opposite approach: It start at the beginning of the input, then reluctantly eats one character at a time looking for a match. The last thing it tries is the entire input.
    • POSSESSIVE

      public static final Quantifier POSSESSIVE
      The possessive quantifier always eats the entire input string, trying once (and only once) for a match. Unlike the greedy quantifiers, possessive quantifiers never back off, even if doing so would allow the overall match to succeed.
  • Method Details

    • values

      public static Quantifier[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Quantifier valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null