Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:
  Serializable, Comparable, SequenceIterable, Item, ValueRepresentation

Direct Known Subclasses:
  DateTimeValue, GDateValue, TimeValue

    public abstract class CalendarValue

extends AtomicValue
implements Comparable

Abstract superclass for Date, Time, and DateTime.

See Also:
  Serialized Form

Field Summary
`static int` | `NO_TIMEZONE`

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
`CalendarValue()`

Method Summary
`abstract CalendarValue` | `add(DurationValue duration)` Add a duration to this date/time value
`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
`abstract CalendarValue` | `adjustTimezone(int tz)` Return a new date, time, or dateTime with the same normalized value, but in a different timezone
`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)`
`abstract int` | `compareTo(CalendarValue other, Configuration config)` Compare this value to another value of the same type, using the supplied ConversionContext to get the implicit timezone if required.
`abstract GregorianCalendar` | `getCalendar()` Get a Java Calendar object that represents this date/time value.
`abstract ComparisonKey` | `getComparisonKey(Configuration config)` Get a comparison key for this value.
`String` | `getStringValue()` Convert the value to a string
`int` | `getTimezoneInMinutes()` Get the timezone value held in this object.
`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

Methods inherited from class net.sf.saxon.value.AtomicValue
`checkPermittedContents, convert, convert, convertPrimitive, copy, effectiveBooleanValue, getCardinality, getComponent, getItemType, getLength, getPrimitiveType, getStringValueCS, getTypedValue, getTypeLabel, getXPathComparable, hasBuiltInType, isMultiValued, itemAt, iterate, process, setTypeLabel, toString`

Methods inherited from class net.sf.saxon.value.Value
`asItem, asItem, asIterator, asValue, compareTo, convert, convertJavaObjectToXPath, convertToJava, equals, fromItem, getCanonicalLexicalRepresentation, getIterator, getSchemaComparable, hashCode, iterate, makeQNameValue, reduce, stringToNumber`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.lang.Comparable
`compareTo`

Field Detail

### NO_TIMEZONE

    public static final int NO_TIMEZONE

See Also:
  Constant Field Values

Constructor Detail

### CalendarValue

    public CalendarValue()

Method Detail

### hasTimezone

    public final boolean hasTimezone()

  Determine whether this value includes a timezone

  Returns:
    true if there is a timezone in the value, false if not

### setTimezoneInMinutes

    public final void setTimezoneInMinutes(int minutes)

  Modify the timezone value held in this object. This must be done only while the value is being constructed.

  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)

### toDateTime

    public 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

### getTimezoneInMinutes

    public final int getTimezoneInMinutes()

  Get the timezone value held in this object.

  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

### getStringValue

    public final String getStringValue()

  Convert the value to a string

  Specified by:
    `getStringValue` in interface `Item`
  Specified by:
    `getStringValue` in interface `ValueRepresentation`
  Specified by:
    `getStringValue` in class `AtomicValue`
  Returns:
    the string value of the item
  See Also:
    `Item.getStringValueCS()`

### getCalendar

    public abstract GregorianCalendar getCalendar()

  Get a Java Calendar object that represents this date/time value. The Calendar object will be newly created for the purpose

  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)

### add

    public abstract CalendarValue add(DurationValue duration)
                               throws XPathException

  Add a duration to this date/time value

  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`

### subtract

    public DayTimeDurationValue subtract(CalendarValue other,
                                         XPathContext context)
                                  throws XPathException

  Determine the difference between two points in time, as a duration

  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:
    `XPathException` - for example if one value is a date and the other is a time

### removeTimezone

    public final CalendarValue removeTimezone()

  Return a date, time, or dateTime with the same localized value, but without the timezone component

  Returns:
    the result of removing the timezone

### adjustTimezone

    public abstract CalendarValue adjustTimezone(int tz)

  Return a new date, time, or dateTime with the same normalized value, but in a different timezone

  Parameters:
    `tz` - the new timezone, in minutes
  Returns:
    the date/time in the new timezone

### adjustTimezone

    public final CalendarValue adjustTimezone(DayTimeDurationValue tz)
                                       throws XPathException

  Return a new date, time, or dateTime with the same normalized value, but in a different timezone, specified as a dayTimeDuration

  Parameters:
    `tz` - the new timezone, in minutes
  Returns:
    the date/time in the new timezone
  Throws:
    `XPathException`

### compareTo

    public abstract int compareTo(CalendarValue other,
                                  Configuration config)

  Compare this value to another value of the same type, using the supplied ConversionContext to get the implicit timezone if required.

### getComparisonKey

    public abstract ComparisonKey getComparisonKey(Configuration config)

  Get a comparison key for this value. Two values are equal if and only if they their comparison keys are equal

### appendTimezone

    public final 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

  Parameters:
    `sb` - The StringBuffer that will be updated with the resulting string representation

### appendTimezone

    public static final void appendTimezone(int tz,
                                            FastStringBuffer sb)

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.