net.sf.saxon.value
public abstract class CalendarValue extends AtomicValue
Field Summary | |
---|---|
static int | NO_TIMEZONE |
Method Summary | |
---|---|
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 | appendString(FastStringBuffer sb, int value, int size)
Append an integer, formatted with leading zeros to a fixed size, to a string 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 |
static void | appendTimezone(int tz, FastStringBuffer sb)
Format a timezone and append it to a buffer |
static void | appendTwoDigits(FastStringBuffer sb, int value)
Append an integer, formatted as two digits, to a 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 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. |
int | getTimezoneInMinutes()
Get the timezone value held in this object. |
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 |
boolean | isIdentical(Value v) |
static ConversionResult | makeCalendarValue(CharSequence s)
Parse a string to create a CalendarValue whose actual type will depend on the format of the string |
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 |
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
Parameters: tz the new timezone offset from UTC, in minutes
Returns: the date/time in the new timezone
Parameters: tz the new timezone, in minutes
Returns: the date/time in the new timezone
Parameters: sb the string buffer value the integer to be formatted size the number of digits required (max 9)
Parameters: sb The StringBuffer that will be updated with the resulting string representation
Parameters: tz the timezone sb the buffer
Parameters: sb the string buffer value the integer to be formatted (must be in the range 0..99
Parameters: other the other value to be compared context the XPath dynamic evaluation context
Returns: the comparison result
Throws: NoDynamicContextException if the supplied context is an early evaluation context and the result depends on the implicit timezone, which is not available at compile time
Returns: A Calendar object representing the date and time. Note that Java can only represent the time to millisecond precision, and that it does not support the full range of timezones required by XPath (-14:00 to +14:00)
Parameters: context XPath dynamic evaluation context, used to obtain implicit timezone
Returns: a comparison key
Throws: NoDynamicContextException if the implicit timezone is needed and is not available
Returns: 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
Parameters: 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 strings context 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 Comparable
Returns: true if there is a timezone in the value, false if not
Parameters: s a string in the lexical space of one of the date/time types (date, time, dateTime, gYearMonth, gYear, gMonth, gMonthDay, or gDay
Returns: either a value of the appropriate type, or a ValidationFailure if the format is invalid
Returns: the result of removing the timezone
Parameters: 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)
Parameters: other the other point in time context 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 xs:dayTimeDuration
Throws: net.sf.saxon.trans.XPathException for example if one value is a date and the other is a time
Returns: the equivalent DateTimeValue