Package org.apache.derby.iapi.types
Class DateTimeParser
- java.lang.Object
-
- org.apache.derby.iapi.types.DateTimeParser
-
class DateTimeParser extends java.lang.ObjectThis class provides a simple regular expression parser for standard format dates, times, and timestamps
-
-
Field Summary
Fields Modifier and Type Field Description private charcurrentSeparatorprivate intfieldStartprivate intlenprivate java.lang.Stringstr
-
Constructor Summary
Constructors Constructor Description DateTimeParser(java.lang.String str)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidcheckEnd()Check that we are at the end of the string: that the rest of the characters, if any, are blanks.(package private) chargetCurrentSeparator()(package private) charnextSeparator()(package private) intparseChoice(java.lang.String[] choices)Determine if the next characters are one of a choice of strings.(package private) intparseInt(int maxDigits, boolean truncationAllowed, char[] separator, boolean isFraction)Parse the next integer.private voidupdateCurrentSeparator()
-
-
-
Method Detail
-
parseInt
int parseInt(int maxDigits, boolean truncationAllowed, char[] separator, boolean isFraction) throws StandardExceptionParse the next integer.- Parameters:
maxDigits- the maximum number of digitstruncationAllowed- If true then leading zeroes may be ommitted. If false then the integer must be exactly ndigits long.separator- The separator at the end of the integer. If zero then the integer must be at the end of the string but may be followed by spaces.isFraction- If true then the returned integer will be multiplied by 10**(maxDigits - actualDigitCount)- Returns:
- the integer.
- Throws:
StandardException- invalid syntax.
-
parseChoice
int parseChoice(java.lang.String[] choices) throws StandardExceptionDetermine if the next characters are one of a choice of strings.- Parameters:
choices- An array of strings.- Returns:
- An index in choices.
- Throws:
StandardException- if the next characters are not in choices.
-
updateCurrentSeparator
private void updateCurrentSeparator()
-
checkEnd
void checkEnd() throws StandardExceptionCheck that we are at the end of the string: that the rest of the characters, if any, are blanks.- Throws:
StandardException- if there are more non-blank characters.
-
nextSeparator
char nextSeparator()
- Returns:
- the next separator, 0 if there are none
-
getCurrentSeparator
char getCurrentSeparator()
- Returns:
- the separator between the last parsed integer and the next integer, 0 if the parser is at the end of the string.
-
-