Package spoon.pattern

Enum Quantifier

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Quantifier>

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

      Enum Constants 
      Enum Constant Description
      GREEDY
      Force the matcher to read in, or eat, the entire input prior to attempting the next match (default).
      POSSESSIVE
      The possessive quantifier always eats the entire input string, trying once (and only once) for a match.
      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.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Quantifier valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Quantifier[] values()
      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 Detail

      • 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 Detail

      • values

        public static Quantifier[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Quantifier c : Quantifier.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Quantifier valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null