Class IntegerGroup

    • Constructor Detail

      • IntegerGroup

        public IntegerGroup()
        Constructs an IntegerGroup that parses Strings that match the INTEGER pattern in base 10.
        See Also:
        MetaPattern.INTEGER
      • 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 Detail

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