Package apg
Class UdtLib.HexNum
- java.lang.Object
-
- apg.Parser.UdtCallback
-
- apg.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 thanmax
hexidecimal digits, where0 <= min <= max
. A hexidecimal digit is0-9
orA-F
(case insensitive).
-
-
Field Summary
-
Fields inherited from class apg.Parser.UdtCallback
callbackData
-
-
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.
-
-
-
Constructor Detail
-
HexNum
public HexNum(Parser p)
The default constructor.The default values are
min = 0, max = infinite
. Note thatmin = 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 andmin = 0
, if falsemin = 1
. In either casemax = 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 classParser.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 range0 <= L <=(n-1)
, wheren
is the remaining number of characters in the input string.
-
-