net.sf.saxon.value
Class GDateValue
- ConversionResult, GroundedValue, Item, PullEvent, Serializable, SequenceIterable, Serializable, ValueRepresentation
public abstract class GDateValue
Abstract superclass for the primitive types containing date components: xs:date, xs:gYear,
xs:gYearMonth, xs:gMonth, xs:gMonthDay, xs:gDay
protected byte | day
|
protected static byte[] | daysPerMonth - Test whether a candidate date is actually a valid date in the proleptic Gregorian calendar
|
protected byte | month
|
protected static short[] | monthData
|
protected int | year
|
int | compareTo(CalendarValue other, XPathContext context) - Compare this value to another value of the same type, using the supplied context object
to get the implicit timezone if required.
|
Object | convertToJava(Class target, XPathContext context) - Convert to Java object (for passing to external functions)
|
boolean | equals(Object o) - The equals() methods on atomic values is defined to follow the semantics of eq when applied
to two atomic values.
|
GregorianCalendar | getCalendar()
|
ComparisonKey | getComparisonKey(XPathContext context) - 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)
|
Comparable | getSchemaComparable() - Get a Comparable value that implements the XML Schema ordering comparison semantics for this value.
|
int | getYear() - Get the year component of the date (in local form)
|
int | hashCode()
|
static boolean | isLeapYear(int year) - Test whether a year is a leap year
|
static boolean | isValidDate(int year, int month, int day) - Determine whether a given date is valid
|
protected static ConversionResult | setLexicalValue(GDateValue d, 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.
|
add , adjustTimezone , adjustTimezone , appendTimezone , appendTimezone , compareTo , getCalendar , getComparisonKey , getStringValue , getTimezoneInMinutes , getXPathComparable , hasTimezone , removeTimezone , setTimezoneInMinutes , subtract , toDateTime |
asAtomic , checkPermittedContents , convert , convert , convertPrimitive , copyAsSubType , effectiveBooleanValue , equals , getCardinality , getComponent , getItemType , getLength , getPrimitiveType , getSchemaComparable , getStringValue , getStringValueCS , getTypeLabel , getTypedValue , getXPathComparable , isNaN , itemAt , iterate , process , setTypeLabel , subsequence , toString |
asItem , asItem , asIterator , asValue , checkPermittedContents , convertJavaObjectToXPath , convertToJava , convertToJava , effectiveBooleanValue , equals , fromItem , getCanonicalLexicalRepresentation , getCardinality , getItemType , getIterator , getLength , getSchemaComparable , getStringValue , getStringValueCS , itemAt , iterate , iterate , makeQNameValue , process , reduce , stringToNumber , toString |
daysPerMonth
protected static byte[] daysPerMonth
Test whether a candidate date is actually a valid date in the proleptic Gregorian calendar
month
protected byte month
monthData
protected static final short[] monthData
compareTo
public int compareTo(CalendarValue other,
XPathContext context)
throws NoDynamicContextException
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.
- compareTo in interface CalendarValue
other
- the value to be comparedcontext
- the XPath dynamic evaluation context (needed only to get the implicit timezone)
- -1 if this value is less, 0 if equal, +1 if greater
equals
public boolean equals(Object o)
The equals() methods on atomic values is defined to follow the semantics of eq when applied
to two atomic values. When the other operand is not an atomic value, the result is undefined
(may be false, may be an exception). When the other operand is an atomic value that cannot be
compared with this one, the method returns false.
The hashCode() method is consistent with equals().
This implementation performs a context-free comparison: it fails with ClassCastException
if one value has a timezone and the other does not.
- equals in interface AtomicValue
- true if the other operand is an atomic value and the two values are equal as defined
by the XPath eq operator
getDay
public byte getDay()
Get the day component of the date (in local form)
getMonth
public byte getMonth()
Get the month component of the date (in local form)
- the month component (1-12)
getSchemaComparable
public Comparable getSchemaComparable()
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value.
An implementation must be provided for all atomic types.
In the case of data types that are partially ordered, the returned Comparable extends the standard
semantics of the compareTo() method by returning the value
Value.INDETERMINATE_ORDERING
when there
is no defined order relationship between two given values. This value is also returned when two values
of different types are compared.
- getSchemaComparable in interface AtomicValue
- a Comparable that follows XML Schema comparison rules
getYear
public int getYear()
Get the year component of the date (in local form)
hashCode
public int hashCode()
isLeapYear
public static boolean isLeapYear(int year)
Test whether a year is a leap year
- true if the supplied year is a leap year
isValidDate
public static boolean isValidDate(int year,
int month,
int day)
Determine whether a given date is valid
year
- the yearmonth
- the month (1-12)day
- the day (1-31)
- true if this is a valid date
setLexicalValue
protected static ConversionResult setLexicalValue(GDateValue d,
CharSequence s)
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)]
d
- the "raw" DateValue to be populateds
- the supplied string value
- either the supplied GDateValue, with its data initialized; or a ValidationFailure