Class DurationDV
- java.lang.Object
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.TypeValidator
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.DurationDV
-
public class DurationDV extends AbstractDateTimeDV
Validator for <duration> datatype (W3C Schema Datatypes)- Version:
- $Id$
- Author:
- Elena Litani, Gopal Sharma, SUN Microsystem Inc.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DAYTIMEDURATION_TYPE
static int
DURATION_TYPE
static int
YEARMONTHDURATION_TYPE
-
Fields inherited from class org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV
datatypeFactory, DAY, MONTH, YEAR
-
Fields inherited from class org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.TypeValidator
EQUAL, GREATER_THAN, INDETERMINATE, LESS_THAN
-
-
Constructor Summary
Constructors Constructor Description DurationDV()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected short
compareDates(org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date1, org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date2, boolean strict)
Compares 2 given durations.protected String
dateToString(org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date)
Object
getActualValue(String content, ValidationContext context)
protected Duration
getDuration(org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date)
protected org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData
parse(String str, int durationType)
Parses, validates and computes normalized version of duration objectprotected double
parseSecond(String buffer, int start, int end)
-
Methods inherited from class org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV
append, append, append2, compare, compareOrder, findUTCSign, fQuotient, fQuotient, getAllowedFacets, getDate, getFractionalSecondsAsBigDecimal, getTime, getTimeZone, getXMLGregorianCalendar, getYearMonth, indexOf, isIdentical, isNextCharUTCSign, maxDayInMonthFor, mod, modulo, normalize, parseInt, parseIntYear, parseTimeZone, resetDateObj, saveUnnormalized, validateDateTime
-
Methods inherited from class org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.TypeValidator
checkExtraRules, getDataLength, getDigit, getFractionDigits, getTotalDigits, isDigit
-
-
-
-
Field Detail
-
DURATION_TYPE
public static final int DURATION_TYPE
- See Also:
- Constant Field Values
-
YEARMONTHDURATION_TYPE
public static final int YEARMONTHDURATION_TYPE
- See Also:
- Constant Field Values
-
DAYTIMEDURATION_TYPE
public static final int DAYTIMEDURATION_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getActualValue
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException
- Specified by:
getActualValue
in classTypeValidator
- Throws:
InvalidDatatypeValueException
-
parse
protected org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData parse(String str, int durationType) throws SchemaDateTimeException
Parses, validates and computes normalized version of duration object- Parameters:
str
- The lexical representation of duration object PnYn MnDTnH nMnSdurationType
-- Returns:
- normalized date representation
- Throws:
SchemaDateTimeException
- Invalid lexical representation
-
compareDates
protected short compareDates(org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date1, org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date2, boolean strict)
Compares 2 given durations. (refer to W3C Schema Datatypes "3.2.6 duration")- Overrides:
compareDates
in classAbstractDateTimeDV
- Parameters:
date1
- Unnormalized durationdate2
- Unnormalized durationstrict
- (min/max)Exclusive strict == true ( LESS_THAN ) or ( GREATER_THAN ) (min/max)Inclusive strict == false (LESS_EQUAL) or (GREATER_EQUAL)- Returns:
- INDETERMINATE if the order relationship between date1 and date2 is indeterminate. EQUAL if the order relation between date1 and date2 is EQUAL. If the strict parameter is true, return LESS_THAN if date1 is less than date2 and return GREATER_THAN if date1 is greater than date2. If the strict parameter is false, return LESS_THAN if date1 is less than OR equal to date2 and return GREATER_THAN if date1 is greater than OR equal to date2
-
parseSecond
protected double parseSecond(String buffer, int start, int end) throws NumberFormatException
- Overrides:
parseSecond
in classAbstractDateTimeDV
- Throws:
NumberFormatException
-
dateToString
protected String dateToString(org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date)
- Overrides:
dateToString
in classAbstractDateTimeDV
-
getDuration
protected Duration getDuration(org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.DateTimeData date)
- Overrides:
getDuration
in classAbstractDateTimeDV
-
-