org.apache.xerces.impl.dv.xs

Class DurationDV

public class DurationDV extends AbstractDateTimeDV

Validator for <duration> datatype (W3C Schema Datatypes)

Version: $Id: DurationDV.java,v 1.20 2005/05/06 15:31:14 ankitp Exp $

Author: Elena Litani Gopal Sharma, SUN Microsystem Inc.

UNKNOWN:

Field Summary
static intDAYTIMEDURATION_TYPE
static intDURATION_TYPE
static intYEARMONTHDURATION_TYPE
Method Summary
protected shortcompareDates(DateTimeData date1, DateTimeData date2, boolean strict)
Compares 2 given durations. (refer to W3C Schema Datatypes "3.2.6 duration")
protected StringdateToString(DateTimeData date)
ObjectgetActualValue(String content, ValidationContext context)
protected DurationgetDuration(DateTimeData date)
protected DateTimeDataparse(String str, int durationType)
Parses, validates and computes normalized version of duration object
protected doubleparseSecond(String buffer, int start, int end)

Field Detail

DAYTIMEDURATION_TYPE

public static final int DAYTIMEDURATION_TYPE

DURATION_TYPE

public static final int DURATION_TYPE

YEARMONTHDURATION_TYPE

public static final int YEARMONTHDURATION_TYPE

Method Detail

compareDates

protected short compareDates(DateTimeData date1, DateTimeData date2, boolean strict)
Compares 2 given durations. (refer to W3C Schema Datatypes "3.2.6 duration")

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(DateTimeData date)

getActualValue

public Object getActualValue(String content, ValidationContext context)

getDuration

protected Duration getDuration(DateTimeData date)

parse

protected DateTimeData parse(String str, int durationType)
Parses, validates and computes normalized version of duration object

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

Returns: normalized date representation

Throws: SchemaDateTimeException Invalid lexical representation

parseSecond

protected double parseSecond(String buffer, int start, int end)
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.