org.apache.derby.iapi.types
Class DateTimeParser

java.lang.Object
  extended byorg.apache.derby.iapi.types.DateTimeParser

class DateTimeParser
extends java.lang.Object

This class provides a simple regular expression parser for standard format dates, times, and timestamps


Field Summary
private  char currentSeparator
           
private  int fieldStart
           
private  int len
           
private  java.lang.String str
           
private  java.lang.String trimmedString
           
 
Constructor Summary
(package private) DateTimeParser(java.lang.String str)
           
 
Method Summary
(package private)  java.lang.String checkEnd()
          Check that we are at the end of the string: that the rest of the characters, if any, are blanks.
(package private)  char getCurrentSeparator()
           
(package private)  java.lang.String getTrimmedString()
          Get the parsed string with trailing blanks removed.
(package private)  char nextSeparator()
           
(package private)  int parseChoice(java.lang.String[] choices)
          Determine if the next characters are one of a choice of strings.
(package private)  int parseInt(int maxDigits, boolean truncationAllowed, char[] separator, boolean isFraction)
          Parse the next integer.
private  void updateCurrentSeparator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

str

private java.lang.String str

trimmedString

private java.lang.String trimmedString

len

private int len

fieldStart

private int fieldStart

currentSeparator

private char currentSeparator
Constructor Detail

DateTimeParser

DateTimeParser(java.lang.String str)
Method Detail

parseInt

int parseInt(int maxDigits,
             boolean truncationAllowed,
             char[] separator,
             boolean isFraction)
       throws StandardException
Parse the next integer.

Parameters:
maxDigits - the maximum number of digits
truncationAllowed - 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 StandardException
Determine 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

java.lang.String checkEnd()
                    throws StandardException
Check that we are at the end of the string: that the rest of the characters, if any, are blanks.

Returns:
the original string with trailing blanks trimmed off.
Throws:
StandardException - if there are more non-blank characters.

getTrimmedString

java.lang.String getTrimmedString()
Get the parsed string with trailing blanks removed. This method is only valid after checkEnd has been called.

Returns:
The string with trailing blanks removed.

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.

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.