Package apg

Class UdtLib.HexNum

  • Enclosing class:
    UdtLib

    public static class UdtLib.HexNum
    extends Parser.UdtCallback
    UDT for a hexidecimal number.

    This is a string of at least min and not more than max hexidecimal digits, where 0 <= min <= max. A hexidecimal digit is 0-9 or A-F (case insensitive).

    • Constructor Summary

      Constructors 
      Constructor Description
      HexNum​(Parser p)
      The default constructor.
      HexNum​(Parser p, boolean optional)
      Constructor with choice for whether the number is optional or not.
      HexNum​(Parser p, int minDigits, int maxDigits)
      Constructor with explicit choices for all options.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int callback​(int offset)
      The UDT function.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HexNum

        public HexNum​(Parser p)
        The default constructor.

        The default values are min = 0, max = infinite. Note that min = 0, indicates that the hexidecimal number phrase is optional.

        Parameters:
        p - the Parser object this UDT is attached to.
      • HexNum

        public HexNum​(Parser p,
                      boolean optional)
        Constructor with choice for whether the number is optional or not.
        Parameters:
        p - the Parser object this UDT is attached to.
        optional - if true, the number is optional and min = 0, if false min = 1. In either case max = infinite.
      • HexNum

        public HexNum​(Parser p,
                      int minDigits,
                      int maxDigits)
        Constructor with explicit choices for all options.
        Parameters:
        p - the Parser object this UDT is attached to.
        minDigits - minimum number of digits allowed (must be >= 0)
        maxDigits - maximum number of digits allowed (must be >= minDigits)
    • Method Detail

      • callback

        public int callback​(int offset)
        Description copied from class: Parser.UdtCallback
        The UDT function.
        Specified by:
        callback in class Parser.UdtCallback
        Parameters:
        offset - offset into the input string to the first character of the parsed phrase.
        Returns:
        the matched phrase length, L, or -1 if no phrase was matched. The phrase length must be in the range 0 <= L <=(n-1), where n is the remaining number of characters in the input string.