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 GDateValue

    java.lang.Object
      net.sf.saxon.value.Value
          net.sf.saxon.value.AtomicValue
              net.sf.saxon.value.CalendarValue
                  net.sf.saxon.value.GDateValue

All Implemented Interfaces:
  Serializable, Comparable, SequenceIterable, Item, ValueRepresentation

Direct Known Subclasses:
  DateValue, GDayValue, GMonthDayValue, GMonthValue, GYearMonthValue, GYearValue

    public abstract class GDateValue

extends CalendarValue

Abstract superclass for the primitive types containing date components: xs:date, xs:gYear, xs:gYearMonth, xs:gMonth, xs:gMonthDay, xs:gDay

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.value.CalendarValue
`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
`GDateValue()`

Method Summary
`int` | `compareTo(CalendarValue other, Configuration config)` Compare this value to another value of the same type, using the supplied context object to get the implicit timezone if required.
`int` | `compareTo(Object other)` Compare the value to another date value.
`Object` | `convertToJava(Class target, XPathContext context)` Convert to Java object (for passing to external functions)
`boolean` | `equals(Object other)` Compare two (sequence) values for equality.
`GregorianCalendar` | `getCalendar()` Get a Java Calendar object that represents this date/time value.
`ComparisonKey` | `getComparisonKey(Configuration config)` Get a comparison key for this value.
`byte` | `getDay()` Get the day component of the date (in local form)
`byte` | `getMonth()` Get the month component of the date (in local form)
`int` | `getYear()` Get the year component of the date (in local form)
`int` | `hashCode()` Return a hash code to support the equals() function
`static boolean` | `isLeapYear(int year)` Test whether a year is a leap year
`static boolean` | `isValidDate(int year, int month, int day)`
`void` | `setLexicalValue(CharSequence s)` Initialize the DateValue using a character string in the format yyyy-mm-dd and an optional time zone.
`DateTimeValue` | `toDateTime()` Convert to DateTime

Methods inherited from class net.sf.saxon.value.CalendarValue
`add, adjustTimezone, adjustTimezone, appendTimezone, appendTimezone, getStringValue, getTimezoneInMinutes, hasTimezone, removeTimezone, setTimezoneInMinutes, subtract`

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, convert, convertJavaObjectToXPath, fromItem, getCanonicalLexicalRepresentation, getIterator, getSchemaComparable, iterate, makeQNameValue, reduce, stringToNumber`

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

Constructor Detail

### GDateValue

    public GDateValue()

Method Detail

### getYear

    public int getYear()

  Get the year component of the date (in local form)

### getMonth

    public byte getMonth()

  Get the month component of the date (in local form)

### getDay

    public byte getDay()

  Get the day component of the date (in local form)

### getCalendar

    public GregorianCalendar getCalendar()

  Description copied from class: `CalendarValue`
  Get a Java Calendar object that represents this date/time value. The Calendar object will be newly created for the purpose

  Specified by:
    `getCalendar` in class `CalendarValue`
  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)

### convertToJava

    public Object convertToJava(Class target,
                                XPathContext context)
                         throws XPathException

  Convert to Java object (for passing to external functions)

  Overrides:
    `convertToJava` in class `Value`
  Throws:
    `XPathException`

### setLexicalValue

    public void setLexicalValue(CharSequence s)
                         throws XPathException

  Initialize the DateValue using a character string in the format yyyy-mm-dd and an optional time zone. Input must have format [-]yyyy-mm-dd[([+|-]hh:mm | Z)]

  Parameters:
    `s` - the supplied string value
  Throws:
    `XPathException`

### isValidDate

    public static boolean isValidDate(int year,
                                      int month,
                                      int day)

### isLeapYear

    public static boolean isLeapYear(int year)

  Test whether a year is a leap year

### compareTo

    public int compareTo(Object other)

  Compare the value to another date value. This method is used only during schema processing, and uses XML Schema semantics rather than XPath semantics.

  Specified by:
    `compareTo` in interface `Comparable`
  Overrides:
    `compareTo` in class `Value`
  Parameters:
    `other` - The other date value. Must be an object of class DateValue.
  Returns:
    negative value if this one is the earlier, 0 if they are chronologically equal, positive value if this one is the later. For this purpose, dateTime values with an unknown timezone are considered to be UTC values (the Comparable interface requires a total ordering).
  Throws:
    `ClassCastException` - if the other value is not a DateValue (the parameter is declared as Object to satisfy the Comparable interface)

### compareTo

    public int compareTo(CalendarValue other,
                         Configuration config)

  Compare this value to another value of the same type, using the supplied context object to get the implicit timezone if required. This method implements the XPath comparison semantics.

  Specified by:
    `compareTo` in class `CalendarValue`

### toDateTime

    public DateTimeValue toDateTime()

  Convert to DateTime

  Specified by:
    `toDateTime` in class `CalendarValue`

### getComparisonKey

    public 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

  Specified by:
    `getComparisonKey` in class `CalendarValue`

### equals

    public boolean equals(Object other)

  Description copied from class: `Value`
  Compare two (sequence) values for equality. This supports identity constraints in XML Schema, which allow list-valued elements and attributes to participate in key and uniqueness constraints. This method returns false if any error occurs during the comparison, or if any of the items in either sequence is a node rather than an atomic value.

  Overrides:
    `equals` in class `Value`

### hashCode

    public int hashCode()

  Description copied from class: `Value`
  Return a hash code to support the equals() function

  Overrides:
    `hashCode` in class `Value`

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.