org.apache.xerces.impl.dv.xs

Class MonthDV


public class MonthDV
extends AbstractDateTimeDV

Validator for datatype (W3C Schema Datatypes)

Version:
$Id: MonthDV.java,v 1.9 2003/01/16 18:34:04 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)
Overwrite compare algorithm to optimize month comparison REVISIT: this one is lack of the third parameter: boolean strict, so it doesn't override the method in the base.
protected String
dateToString(int[] date)
Converts month object representation to String
Object
getActualValue(String content, ValidationContext context)
Convert a string to a compiled form
protected int[]
parse(String str)
Parses, validates and computes normalized version of gMonth 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)
Overwrite compare algorithm to optimize month comparison REVISIT: this one is lack of the third parameter: boolean strict, so it doesn't override the method in the base. But maybe this method is not correctly implemented, and I did encounter errors when trying to add the extra parameter. I'm leaving it as is. -SG

Parameters:
date1 -
date2 -

Returns:
less, greater, equal, indeterminate


dateToString

protected String dateToString(int[] date)
Converts month object representation to String
Overrides:
dateToString in interface AbstractDateTimeDV

Parameters:
date - month object

Returns:
lexical representation of month: --MM with an optional time zone sign


getActualValue

public Object getActualValue(String content,
                             ValidationContext context)
            throws InvalidDatatypeValueException
Convert a string to a compiled form
Overrides:
getActualValue in interface TypeValidator

Parameters:
content - The lexical representation of gMonth

Returns:
a valid and normalized gMonth object


parse

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

Parameters:
str - The lexical representation of gMonth object --MM with possible time zone Z or (-),(+)hh:mm

Returns:
normalized date representation

Throws:
SchemaDateTimeException - Invalid lexical representation


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