Enum Quantifier

  • All Implemented Interfaces:
    Serializable, Comparable<Quantifier>

    public enum Quantifier
    extends Enum<Quantifier>
    Represents the Capture quantifier in a Pattern, i.e. the number of nodes that a capture should contain. Within a query, a capture can have different quantifiers for each pattern.
    Since:
    1.12.0
    Author:
    Ozren Dabić
    • Enum Constant Detail

      • ZERO

        public static final Quantifier ZERO
        The capture will not match any nodes, as said capture is not present in a specific pattern.
      • ZERO_OR_ONE

        public static final Quantifier ZERO_OR_ONE
        The capture will match at most one node. Example:
        
         ((_)? @capture)
         
      • ZERO_OR_MORE

        public static final Quantifier ZERO_OR_MORE
        The capture will match any number of nodes. Example:
        
         ((_)* @capture)
         
      • ONE

        public static final Quantifier ONE
        The capture will match exactly one node. Example:
        
         ((_) @capture)
         
      • ONE_OR_MORE

        public static final Quantifier ONE_OR_MORE
        The capture will match at least one node. Example:
        
         ((_)+ @capture)
         
    • 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​(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