net.sf.saxon.value

Class GYearValue

Implemented Interfaces:
ConversionResult, GroundedValue, Item, PullEvent, Serializable, SequenceIterable, Serializable, ValueRepresentation

public class GYearValue
extends GDateValue

Implementation of the xs:gYear data type

Field Summary

Fields inherited from class net.sf.saxon.value.GDateValue

day, daysPerMonth, month, monthData, year

Fields inherited from class net.sf.saxon.value.CalendarValue

NO_TIMEZONE

Fields inherited from class net.sf.saxon.value.AtomicValue

typeLabel

Fields inherited from class net.sf.saxon.value.Value

EMPTY_CLASS_ARRAY, INDETERMINATE_ORDERING

Fields inherited from interface net.sf.saxon.om.ValueRepresentation

EMPTY_VALUE_ARRAY

Constructor Summary

GYearValue(int year, int tz)
GYearValue(int year, int tz, AtomicType type)

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, XPathContext context)
Convert to target data type
AtomicValue
copyAsSubType(AtomicType typeLabel)
Make a copy of this date, time, or dateTime value
BuiltInAtomicType
getPrimitiveType()
Determine the primitive type of the value.
CharSequence
getStringValueCS()
Get the value of the item as a CharSequence.
static ConversionResult
makeGYearValue(CharSequence value)

Methods inherited from class net.sf.saxon.value.GDateValue

compareTo, convertToJava, equals, getCalendar, getComparisonKey, getDay, getMonth, getSchemaComparable, getYear, hashCode, isLeapYear, isValidDate, setLexicalValue, toDateTime

Methods inherited from class net.sf.saxon.value.CalendarValue

add, adjustTimezone, adjustTimezone, appendTimezone, appendTimezone, compareTo, getCalendar, getComparisonKey, getStringValue, getTimezoneInMinutes, getXPathComparable, hasTimezone, removeTimezone, setTimezoneInMinutes, subtract, toDateTime

Methods inherited from class net.sf.saxon.value.AtomicValue

asAtomic, checkPermittedContents, convert, convert, convertPrimitive, copyAsSubType, effectiveBooleanValue, equals, getCardinality, getComponent, getItemType, getLength, getPrimitiveType, getSchemaComparable, getStringValue, getStringValueCS, getTypeLabel, getTypedValue, getXPathComparable, isNaN, itemAt, iterate, process, setTypeLabel, subsequence, toString

Methods inherited from class net.sf.saxon.value.Value

asItem, asItem, asIterator, asValue, checkPermittedContents, convertJavaObjectToXPath, convertToJava, convertToJava, effectiveBooleanValue, equals, fromItem, getCanonicalLexicalRepresentation, getCardinality, getItemType, getIterator, getLength, getSchemaComparable, getStringValue, getStringValueCS, itemAt, iterate, iterate, makeQNameValue, process, reduce, stringToNumber, toString

Constructor Details

GYearValue

public GYearValue(int year,
                  int tz)

GYearValue

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

Method Details

add

public CalendarValue add(DurationValue duration)
            throws XPathException
Add a duration to this date/time value
Overrides:
add in interface CalendarValue
Parameters:
duration - the duration to be added (which might be negative)
Returns:
a new date/time value representing the result of adding the duration. The original object is not modified.
Throws:
XPathException -

adjustTimezone

public CalendarValue adjustTimezone(int tz)
Return a new date, time, or dateTime with the same normalized value, but in a different timezone
Overrides:
adjustTimezone in interface CalendarValue
Parameters:
tz - the new timezone, in minutes
Returns:
the date/time in the new timezone

convertPrimitive

public ConversionResult convertPrimitive(BuiltInAtomicType requiredType,
                                         boolean validate,
                                         XPathContext context)
Convert to target data type
Overrides:
convertPrimitive in interface AtomicValue
Parameters:
requiredType - an integer identifying the required atomic type
context -
Returns:
an AtomicValue, a value of the required type; or an ErrorValue

copyAsSubType

public AtomicValue copyAsSubType(AtomicType typeLabel)
Make a copy of this date, time, or dateTime value
Overrides:
copyAsSubType in interface AtomicValue
Parameters:
typeLabel -

getPrimitiveType

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.
Overrides:
getPrimitiveType in interface AtomicValue

getStringValueCS

public CharSequence getStringValueCS()
Get the value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String.
Specified by:
getStringValueCS in interface Item
getStringValueCS in interface ValueRepresentation
Overrides:
getStringValueCS in interface AtomicValue

makeGYearValue

public static ConversionResult makeGYearValue(CharSequence value)