|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.impl.dv.xs.TypeValidator | +--org.apache.xerces.impl.dv.xs.AbstractDateTimeDV
This is the base class of all date/time datatype validators. It implements common code for parsing, validating and comparing datatypes. Classes that extend this class, must implement parse() method. REVISIT: There are many instance variables, which would cause problems when we support grammar caching. A grammar is possibly used by two parser instances at the same time, then the same simple type decl object can be used to validate two strings at the same time. -SG
Field Summary | |
protected static int |
CY
|
protected static int |
D
|
protected static int |
DAY
|
protected java.lang.StringBuffer |
fBuffer
|
protected int[] |
fDateValue
|
protected int |
fEnd
|
protected int |
fEnumSize
|
protected int |
fStart
|
protected static int |
h
|
protected static int |
hh
|
protected static int |
m
|
protected static int |
M
|
protected java.lang.StringBuffer |
message
|
protected static int |
mm
|
protected static int |
MONTH
|
protected static int |
MONTH_SIZE
|
protected static int |
ms
|
protected static int |
s
|
protected int[] |
timeZone
|
protected static int |
TOTAL_SIZE
|
protected static int |
utc
|
protected static int |
YEAR
|
Fields inherited from class org.apache.xerces.impl.dv.xs.TypeValidator |
EQUAL, GREATER_THAN, INDETERMINATE, LESS_THAN |
Constructor Summary | |
AbstractDateTimeDV()
|
Method Summary | |
int |
compare(java.lang.Object value1,
java.lang.Object value2)
|
protected short |
compareDates(int[] date1,
int[] date2,
boolean strict)
Compare algorithm described in dateDime (3.2.7). |
protected short |
compareOrder(int[] date1,
int[] date2)
Given normalized values, determines order-relation between give date/time objects. |
protected java.lang.String |
dateToString(int[] date)
|
protected int |
findUTCSign(int start,
int end)
Return index of UTC char: 'Z', '+', '-' |
protected int |
fQuotient(int a,
int b)
|
protected int |
fQuotient(int temp,
int low,
int high)
|
short |
getAllowedFacets()
|
protected void |
getDate(int start,
int end,
int[] date)
Parses date CCYY-MM-DD |
protected void |
getTime(int start,
int end,
int[] data)
Parses time hh:mm:ss.sss and time zone if any |
protected void |
getTimeZone(int[] data,
int sign)
Parses time zone: 'Z' or {+,-} followed by hh:mm |
protected void |
getYearMonth(int start,
int end,
int[] date)
Parses date CCYY-MM |
protected int |
indexOf(int start,
int end,
char ch)
Computes index of given char within StringBuffer |
protected void |
initializeValues()
|
boolean |
isEqual(java.lang.Object value1,
java.lang.Object value2)
|
protected int |
maxDayInMonthFor(int year,
int month)
Given {year,month} computes maximum number of days for given month |
protected int |
mod(int a,
int b,
int quotient)
|
protected int |
modulo(int temp,
int low,
int high)
|
protected void |
normalize(int[] date)
If timezone present - normalize dateTime [E Adding durations to dateTimes] |
protected abstract int[] |
parse(java.lang.String content,
int[] date)
Implemented by each subtype, calling appropriate function to parse given date/time |
protected int |
parseInt(int start,
int end)
Given start and end position, parses string value |
protected int |
parseIntYear(int end)
|
protected void |
parseTimeZone(int end,
int[] date)
Shared code from Date and YearMonth datatypes. |
protected void |
reportError(java.lang.String msg,
java.lang.String value)
Use this function to report errors in constructor |
protected void |
resetBuffer(java.lang.String str)
Resets fBuffer to store string representation of date/time |
protected void |
resetDateObj(int[] data)
Resets object representation of date/time |
protected void |
validateDateTime(int[] data)
Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601 Conventions] |
Methods inherited from class org.apache.xerces.impl.dv.xs.TypeValidator |
checkExtraRules, getActualValue, getDataLength, getFractionDigits, getTotalDigits |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int CY
protected static final int M
protected static final int D
protected static final int h
protected static final int m
protected static final int s
protected static final int ms
protected static final int utc
protected static final int hh
protected static final int mm
protected static final int TOTAL_SIZE
protected static final int MONTH_SIZE
protected static final int YEAR
protected static final int MONTH
protected static final int DAY
protected int[] timeZone
protected int fEnumSize
protected int fEnd
protected int fStart
protected java.lang.StringBuffer fBuffer
protected int[] fDateValue
protected java.lang.StringBuffer message
Constructor Detail |
public AbstractDateTimeDV()
Method Detail |
protected void initializeValues()
public short getAllowedFacets()
getAllowedFacets
in class TypeValidator
public boolean isEqual(java.lang.Object value1, java.lang.Object value2)
isEqual
in class TypeValidator
public int compare(java.lang.Object value1, java.lang.Object value2)
compare
in class TypeValidator
protected abstract int[] parse(java.lang.String content, int[] date) throws SchemaDateTimeException
content
- String value of the date/timedate
- Storage to represent date/time object.
If null - new object will be created, otherwise
date will be reset and reusedSchemaDateTimeException
- protected short compareDates(int[] date1, int[] date2, boolean strict)
date1
- normalized date representation of the first valuedate2
- normalized date representation of the second valuestrict
- protected short compareOrder(int[] date1, int[] date2)
date1
- date/time objectdate2
- date/time objectprotected void getTime(int start, int end, int[] data) throws java.lang.RuntimeException
start
- end
- data
- java.lang.RuntimeException
- protected void getDate(int start, int end, int[] date) throws java.lang.RuntimeException
start
- end
- data
- java.lang.RuntimeException
- protected void getYearMonth(int start, int end, int[] date) throws java.lang.RuntimeException
start
- end
- data
- java.lang.RuntimeException
- protected void parseTimeZone(int end, int[] date) throws java.lang.RuntimeException
end
- date
- java.lang.RuntimeException
- protected void getTimeZone(int[] data, int sign) throws java.lang.RuntimeException
data
- sign
- java.lang.RuntimeException
- protected int indexOf(int start, int end, char ch)
start
- end
- ch
- character to look for in StringBufferprotected void validateDateTime(int[] data)
data
- protected int findUTCSign(int start, int end)
start
- end
- protected int parseInt(int start, int end) throws java.lang.NumberFormatException
value
- string to parsestart
- Start positionend
- end positionprotected int parseIntYear(int end)
protected void normalize(int[] date)
date
- CCYY-MM-DDThh:mm:ss+03protected void resetBuffer(java.lang.String str)
str
- Lexical representation of date/timeprotected void resetDateObj(int[] data)
data
- date/time objectprotected int maxDayInMonthFor(int year, int month)
year
- month
- protected int mod(int a, int b, int quotient)
protected int fQuotient(int a, int b)
protected int modulo(int temp, int low, int high)
protected int fQuotient(int temp, int low, int high)
protected java.lang.String dateToString(int[] date)
protected void reportError(java.lang.String msg, java.lang.String value)
msg
- value
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |