org.apache.xerces.impl.dv.xs

Class DurationDV


public class DurationDV
extends AbstractDateTimeDV

Validator for datatype (W3C Schema Datatypes)

Version:
$Id: DurationDV.java,v 1.8 2003/12/11 15:08:25 sandygao Exp $

Authors:
Elena Litani
Gopal Sharma, SUN Microsystem Inc.

Field Summary

Fields inherited from class org.apache.xerces.impl.dv.xs.AbstractDateTimeDV

CY, D, DAY, M, MONTH, TOTAL_SIZE, YEAR, h, hh, m, mm, ms, s, utc

Fields inherited from class org.apache.xerces.impl.dv.xs.TypeValidator

EQUAL, GREATER_THAN, INDETERMINATE, LESS_THAN

Method Summary

protected short
compareDates(int[] date1, int[] date2, boolean strict)
Compares 2 given durations.
protected String
dateToString(int[] date)
Object
getActualValue(String content, ValidationContext context)
protected int[]
parse(String str)
Parses, validates and computes normalized version of duration object

Methods inherited from class org.apache.xerces.impl.dv.xs.AbstractDateTimeDV

append, compare, compareDates, compareOrder, dateToString, fQuotient, fQuotient, findUTCSign, getAllowedFacets, getDate, getTime, getTimeZone, getYearMonth, indexOf, maxDayInMonthFor, mod, modulo, normalize, parseInt, parseIntYear, parseTimeZone, resetDateObj, validateDateTime

Methods inherited from class org.apache.xerces.impl.dv.xs.TypeValidator

checkExtraRules, compare, getActualValue, getAllowedFacets, getDataLength, getDigit, getFractionDigits, getTotalDigits, isDigit

Method Details

compareDates

protected short compareDates(int[] date1,
                             int[] date2,
                             boolean strict)
Compares 2 given durations. (refer to W3C Schema Datatypes "3.2.6 duration")
Overrides:
compareDates in interface AbstractDateTimeDV

Parameters:
date1 - Unnormalized duration
date2 - Unnormalized duration
strict - (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


dateToString

protected String dateToString(int[] date)
Overrides:
dateToString in interface AbstractDateTimeDV


getActualValue

public Object getActualValue(String content,
                             ValidationContext context)
            throws InvalidDatatypeValueException
Overrides:
getActualValue in interface TypeValidator


parse

protected int[] parse(String str)
            throws SchemaDateTimeException
Parses, validates and computes normalized version of duration object

Parameters:
str - The lexical representation of duration object PnYn MnDTnH nMnS

Returns:
normalized date representation

Throws:
SchemaDateTimeException - Invalid lexical representation


Copyright B) 1999-2004 Apache XML Project. All Rights Reserved.