net.sf.saxon.value
Class CalendarValue
java.lang.Object
net.sf.saxon.value.Value
net.sf.saxon.value.AtomicValue
net.sf.saxon.value.CalendarValue
- All Implemented Interfaces:
- java.lang.Comparable, Expression, Item, java.io.Serializable, ValueRepresentation
- Direct Known Subclasses:
- DateTimeValue, DateValue, TimeValue
- public abstract class CalendarValue
- extends AtomicValue
- implements java.lang.Comparable
Abstract superclass for Date, Time, and DateTime
- See Also:
- Serialized Form
Method Summary |
abstract CalendarValue |
add(DurationValue duration)
|
abstract int |
compareTo(CalendarValue other,
ConversionContext conversion)
Compare this value to another value of the same type, using the supplied ConversionContext
to get the implicit timezone if required. |
abstract CalendarValue |
removeTimezone()
Return a date, time, or dateTime with the same localized value, but
without the timezone component |
abstract CalendarValue |
setTimezone(SecondsDurationValue tz)
Return a date, time, or dateTime with the same normalized value, but
in a different timezone |
SecondsDurationValue |
subtract(CalendarValue other,
ConversionContext context)
Determine the difference between two points in time, as a duration |
Methods inherited from class net.sf.saxon.value.AtomicValue |
checkPermittedContents, convert, convert, convertPrimitive, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getComponent, getImplementationMethod, getLength, getPrimitiveValue, getStringValue, getStringValueCS, getTypedValue, hasBuiltInType, iterate, process, schemaEquals, toString |
Methods inherited from class net.sf.saxon.value.Value |
asItem, asIterator, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, convertToJava, equals, getDependencies, getItemType, getIterator, getParentExpression, getSpecialProperties, hashCode, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, optimize, promote, reduce, simplify, stringToNumber, trimWhitespace, typeCheck |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
calendar
protected java.util.GregorianCalendar calendar
zoneSpecified
protected boolean zoneSpecified
CalendarValue
public CalendarValue()
add
public abstract CalendarValue add(DurationValue duration)
throws XPathException
- Throws:
XPathException
subtract
public SecondsDurationValue subtract(CalendarValue other,
ConversionContext context)
throws XPathException
- Determine the difference between two points in time, as a duration
- Parameters:
other
- the other point in timecontext
- the dynamic context, used to obtain timezone information. May be set to null
only if both values contain an explicit timezone, or if neither does so.
- Returns:
- the duration as an xdt:dayTimeDuration
- Throws:
XPathException
- for example if one value is a date and the other is a time
removeTimezone
public abstract CalendarValue removeTimezone()
throws XPathException
- Return a date, time, or dateTime with the same localized value, but
without the timezone component
- Returns:
- the result of removing the timezone
- Throws:
XPathException
setTimezone
public abstract CalendarValue setTimezone(SecondsDurationValue tz)
throws XPathException
- Return a date, time, or dateTime with the same normalized value, but
in a different timezone
- Returns:
- the date/time in the new timezone
- Throws:
XPathException
compareTo
public abstract int compareTo(CalendarValue other,
ConversionContext conversion)
- Compare this value to another value of the same type, using the supplied ConversionContext
to get the implicit timezone if required.