All Implemented Interfaces:
Serializable, IClusterable

public final class IntegerGroup extends Group
A Group that captures integer values (positive and negative whole numbers, not Java ints).
Author:
Jonathan Locke
See Also:
  • Constructor Details

    • IntegerGroup

      public IntegerGroup()
      Constructs an IntegerGroup that parses Strings that match the INTEGER pattern in base 10.
      See Also:
    • IntegerGroup

      public IntegerGroup(MetaPattern pattern)
      Constructs an IntegerGroup that parses Strings that match the given pattern in base 10.
      Parameters:
      pattern - The capturing pattern
    • IntegerGroup

      public IntegerGroup(MetaPattern pattern, int radix)
      Constructs an IntegerGroup that parses Strings that match the given pattern in the given radix.
      Parameters:
      pattern - The capturing pattern
      radix - The radix to use when parsing captured Strings
  • Method Details

    • getInt

      public int getInt(Matcher matcher)
      Parameters:
      matcher - The matcher
      Returns:
      The value
      See Also:
    • getInt

      public int getInt(Matcher matcher, int defaultValue)
      Gets an int by parsing the String matched by this capturing group. The IntegerGroup's radix is used in the conversion.
      Parameters:
      matcher - The matcher
      defaultValue - The default value to use if this group is omitted because it is optional
      Returns:
      The parsed int value
    • getLong

      public long getLong(Matcher matcher)
      Parameters:
      matcher - The matcher
      Returns:
      The value
      See Also:
    • getLong

      public long getLong(Matcher matcher, long defaultValue)
      Gets a long by parsing the String matched by this capturing group. The IntegerGroup's radix is used in the conversion. parsing radix.
      Parameters:
      defaultValue - The default value to use if this group is omitted because it is optional
      matcher - The matcher
      Returns:
      The parsed long value