java.io.Serializable
, PullEvent
, SequenceIterable
, GroundedValue
, Item
, ValueRepresentation
, ConversionResult
DateTimeValue
, GDateValue
, TimeValue
public abstract class CalendarValue extends AtomicValue
Modifier and Type | Field | Description |
---|---|---|
static int |
NO_TIMEZONE |
typeLabel
EMPTY_CLASS_ARRAY, INDETERMINATE_ORDERING
EMPTY_VALUE_ARRAY
Constructor | Description |
---|---|
CalendarValue() |
Modifier and Type | Method | Description |
---|---|---|
abstract CalendarValue |
add(DurationValue duration) |
Add a duration to this date/time value
|
abstract CalendarValue |
adjustTimezone(int tz) |
Return a new date, time, or dateTime with the same normalized value, but
in a different timezone
|
CalendarValue |
adjustTimezone(DayTimeDurationValue tz) |
Return a new date, time, or dateTime with the same normalized value, but
in a different timezone, specified as a dayTimeDuration
|
static void |
appendTimezone(int tz,
FastStringBuffer sb) |
Format a timezone and append it to a buffer
|
void |
appendTimezone(FastStringBuffer sb) |
Add a string representation of the timezone, typically
formatted as "Z" or "+03:00" or "-10:00", to a supplied
string buffer
|
abstract int |
compareTo(CalendarValue other,
XPathContext context) |
Compare this value to another value of the same type, using the supplied Configuration
to get the implicit timezone if required.
|
abstract java.util.GregorianCalendar |
getCalendar() |
Get a Java Calendar object that represents this date/time value.
|
abstract ComparisonKey |
getComparisonKey(XPathContext context) |
Get a comparison key for this value.
|
java.lang.String |
getStringValue() |
Convert the value to a string
|
int |
getTimezoneInMinutes() |
Get the timezone value held in this object.
|
java.lang.Object |
getXPathComparable(boolean ordered,
StringCollator collator,
XPathContext context) |
Get an object value that implements the XPath equality and ordering comparison semantics for this value.
|
boolean |
hasTimezone() |
Determine whether this value includes a timezone
|
CalendarValue |
removeTimezone() |
Return a date, time, or dateTime with the same localized value, but
without the timezone component
|
void |
setTimezoneInMinutes(int minutes) |
Modify the timezone value held in this object.
|
DayTimeDurationValue |
subtract(CalendarValue other,
XPathContext context) |
Determine the difference between two points in time, as a duration
|
abstract DateTimeValue |
toDateTime() |
Convert the value to a DateTime, retaining all the components that are actually present, and
substituting conventional values for components that are missing
|
asAtomic, checkPermittedContents, convert, convert, convertPrimitive, copyAsSubType, effectiveBooleanValue, equals, getCardinality, getComponent, getItemType, getLength, getPrimitiveType, getSchemaComparable, getStringValueCS, getTypedValue, getTypeLabel, isNaN, itemAt, iterate, process, setTypeLabel, subsequence, toString
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asItem, asItem, asIterator, asValue, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, iterate, makeQNameValue, reduce, stringToNumber
public static final int NO_TIMEZONE
public final boolean hasTimezone()
public final void setTimezoneInMinutes(int minutes)
minutes
- The timezone offset from GMT in minutes, positive or negative; or the special
value NO_TIMEZONE indicating that the value is not in a timezone (this is the default if this
method is not called)public abstract DateTimeValue toDateTime()
public final int getTimezoneInMinutes()
public final java.lang.String getStringValue()
getStringValue
in interface Item
getStringValue
in interface ValueRepresentation
getStringValue
in class AtomicValue
Item.getStringValueCS()
public abstract java.util.GregorianCalendar getCalendar()
public abstract CalendarValue add(DurationValue duration) throws XPathException
duration
- the duration to be added (which might be negative)XPathException
public DayTimeDurationValue subtract(CalendarValue other, XPathContext context) throws XPathException
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.XPathException
- for example if one value is a date and the other is a timepublic final CalendarValue removeTimezone()
public abstract CalendarValue adjustTimezone(int tz)
tz
- the new timezone offset from UTC, in minutespublic final CalendarValue adjustTimezone(DayTimeDurationValue tz) throws XPathException
tz
- the new timezone, in minutesXPathException
public java.lang.Object getXPathComparable(boolean ordered, StringCollator collator, XPathContext context) throws NoDynamicContextException
getXPathComparable
in class AtomicValue
ordered
- true if an ordered comparison is required. In this case the result is null if the
type is unordered; in other cases the returned value will be a Comparable.collator
- collation used for stringscontext
- the XPath dynamic evaluation context, used in cases where the comparison is context
sensitive @return an Object whose equals() and hashCode() methods implement the XPath comparison semantics
with respect to this atomic value. If ordered is specified, the result will either be null if
no ordering is defined, or will be a ComparableNoDynamicContextException
- if the comparison depends on dynamic context information that
is not available, for example implicit timezonepublic abstract int compareTo(CalendarValue other, XPathContext context) throws NoDynamicContextException
other
- the other value to be comparedcontext
- the XPath dynamic evaluation contextNoDynamicContextException
- if the supplied context is an early evaluation context and the
result depends on the implicit timezone, which is not available at compile timepublic abstract ComparisonKey getComparisonKey(XPathContext context) throws NoDynamicContextException
context
- XPath dynamic evaluation context, used to obtain implicit timezoneNoDynamicContextException
- if the implicit timezone is needed and is not availablepublic final void appendTimezone(FastStringBuffer sb)
sb
- The StringBuffer that will be updated with the resulting string
representationpublic static void appendTimezone(int tz, FastStringBuffer sb)
tz
- the timezonesb
- the buffer