Class GYearValue

  extended by net.sf.saxon.value.Value
      extended by net.sf.saxon.value.AtomicValue
          extended by net.sf.saxon.value.CalendarValue
              extended by net.sf.saxon.value.GDateValue
                  extended by net.sf.saxon.value.GYearValue
All Implemented Interfaces:
Serializable, PullEvent, SequenceIterable, GroundedValue, Item, ValueRepresentation, ConversionResult

public class GYearValue
extends GDateValue

Implementation of the xs:gYear data type

See Also:
Serialized Form

Field Summary
Fields inherited from class net.sf.saxon.value.GDateValue
day, daysPerMonth, month, monthData, xsd10rules, year
Fields inherited from class net.sf.saxon.value.CalendarValue
Fields inherited from class net.sf.saxon.value.AtomicValue
Fields inherited from class net.sf.saxon.value.Value
Fields inherited from interface
Constructor Summary
GYearValue(int year, int tz, AtomicType type)
GYearValue(int year, int tz, boolean xsd10)
Method Summary
 CalendarValue add(DurationValue duration)
          Add a duration to this date/time value
 CalendarValue adjustTimezone(int tz)
          Return a new date, time, or dateTime with the same normalized value, but in a different timezone
 ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, ConversionRules rules)
          Convert to target data type
 AtomicValue copyAsSubType(AtomicType typeLabel)
          Make a copy of this date, time, or dateTime value
 CharSequence getPrimitiveStringValue()
          Convert the value to a string, using the serialization rules for the primitive type.
 BuiltInAtomicType getPrimitiveType()
          Determine the primitive type of the value.
static ConversionResult makeGYearValue(CharSequence value, ConversionRules rules)
Methods inherited from class net.sf.saxon.value.GDateValue
compareTo, equals, getCalendar, getComparisonKey, getComponent, getDay, getMonth, getSchemaComparable, getYear, hashCode, isLeapYear, isValidDate, setLexicalValue, toDateTime
Methods inherited from class net.sf.saxon.value.CalendarValue
adjustTimezone, appendTimezone, appendTimezone, getTimezoneInMinutes, getXPathComparable, hasTimezone, isIdentical, makeCalendarValue, removeTimezone, setTimezoneInMinutes, subtract
Methods inherited from class net.sf.saxon.value.AtomicValue
asAtomic, checkPermittedContents, convert, convert, convert, effectiveBooleanValue, getCardinality, getItemType, getLength, getStringValue, getStringValueCS, getTypedValue, getTypeLabel, isNaN, itemAt, iterate, process, setTypeLabel, subsequence, toString
Methods inherited from class net.sf.saxon.value.Value
asItem, asItem, asIterator, asValue, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, iterate, reduce
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public GYearValue(int year,
                  int tz,
                  boolean xsd10)


public GYearValue(int year,
                  int tz,
                  AtomicType type)
Method Detail


public static ConversionResult makeGYearValue(CharSequence value,
                                              ConversionRules rules)


public AtomicValue copyAsSubType(AtomicType typeLabel)
Make a copy of this date, time, or dateTime value

Specified by:
copyAsSubType in class AtomicValue
typeLabel -
the copied value


public BuiltInAtomicType getPrimitiveType()
Determine the primitive type of the value. This delivers the same answer as getItemType().getPrimitiveItemType(). The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration, and xs:untypedAtomic. For external objects, the result is AnyAtomicType.

Specified by:
getPrimitiveType in class AtomicValue
the primitive type


public ConversionResult convertPrimitive(BuiltInAtomicType requiredType,
                                         boolean validate,
                                         ConversionRules rules)
Convert to target data type

Specified by:
convertPrimitive in class AtomicValue
requiredType - an integer identifying the required atomic type
rules -
validate - true if validation is required. If set to false, the caller guarantees that the value is valid for the target data type, and that further validation is therefore not required. Note that a validation failure may be reported even if validation was not requested.
an AtomicValue, a value of the required type; or an ErrorValue


public CharSequence getPrimitiveStringValue()
Description copied from class: AtomicValue
Convert the value to a string, using the serialization rules for the primitive type. This is the result of conversion to a string except that postprocessing defined by the saxon:preprocess facet is not (yet) applied.

Specified by:
getPrimitiveStringValue in class AtomicValue
the value converted to a string according to the rules for the primitive type


public CalendarValue add(DurationValue duration)
                  throws XPathException
Add a duration to this date/time value

Specified by:
add in class CalendarValue
duration - the duration to be added (which might be negative)
a new date/time value representing the result of adding the duration. The original object is not modified.


public CalendarValue adjustTimezone(int tz)
Return a new date, time, or dateTime with the same normalized value, but in a different timezone

Specified by:
adjustTimezone in class CalendarValue
tz - the new timezone, in minutes
the date/time in the new timezone

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.