| java.lang.Object net.sf.saxon.value.Value net.sf.saxon.value.AtomicValue net.sf.saxon.value.CalendarValue net.sf.saxon.value.DateValue
All known Subclasses: net.sf.saxon.value.GYearValue, net.sf.saxon.value.GYearMonthValue, net.sf.saxon.value.GMonthDayValue, net.sf.saxon.value.GMonthValue, net.sf.saxon.value.GDayValue,
DateValue | public class DateValue extends CalendarValue (Code) | | A value of type Date. Note that a Date may include a TimeZone.
|
Field Summary | |
protected byte | day | protected byte | month | protected int | year |
Constructor Summary | |
protected | DateValue() | protected | DateValue(int year, byte month, byte day) Constructor given a year, month, and day. | protected | DateValue(int year, byte month, byte day, int tz) Constructor given a year, month, and day, and timezone. | public | DateValue(CharSequence s) | public | DateValue(GregorianCalendar calendar, int tz) |
Method Summary | |
public CalendarValue | add(DurationValue duration) | public CalendarValue | adjustTimezone(int timezone) Return a new date with the same normalized value, but
in a different timezone. | public int | compareTo(Object other) Compare the value to another date value. | public 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. | public AtomicValue | convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) | public Object | convertToJava(Class target, XPathContext context) | public CalendarValue | copy() | public static DateValue | dateFromJulianDayNumber(int julianDayNumber) Get the Gregorian date corresponding to a particular Julian day number. | public boolean | equals(Object other) | public GregorianCalendar | getCalendar() | public AtomicValue | getComponent(int component) Get a component of the value. | public byte | getDay() | final public static int | getDayOfWeek(int year, int month, int day) Get the day of the week. | final public static int | getDayWithinYear(int year, int month, int day) | public ItemType | getItemType(TypeHierarchy th) | public static int | getJulianDayNumber(int year, int month, int day) Calculate the Julian day number at 00:00 on a given date. | public byte | getMonth() | public CharSequence | getStringValueCS() | final public static int | getWeekNumber(int year, int month, int day) Get the ISO week number for a given date. | final public static int | getWeekNumberWithinMonth(int year, int month, int day) Get the week number within a month. | public int | getYear() | public int | hashCode() | public static boolean | isLeapYear(int year) | public static boolean | isValidDate(int year, int month, int day) | public static void | main(String[] args) | public void | setLexicalValue(CharSequence s) Initialize the DateValue using a character string in the format yyyy-mm-dd and an optional time zone. | public SecondsDurationValue | subtract(CalendarValue other, XPathContext context) | public DateTimeValue | toDateTime() | public static DateValue | tomorrow(int year, byte month, byte day) | public static DateValue | yesterday(int year, byte month, byte day) |
month | protected byte month(Code) | | |
DateValue | protected DateValue()(Code) | | Default constructor needed for subtyping
|
DateValue | protected DateValue(int year, byte month, byte day)(Code) | | Constructor given a year, month, and day. Performs no validation.
|
DateValue | protected DateValue(int year, byte month, byte day, int tz)(Code) | | Constructor given a year, month, and day, and timezone. Performs no validation.
|
DateValue | public DateValue(GregorianCalendar calendar, int tz)(Code) | | Create a DateValue
Parameters: calendar - the absolute date/time value Parameters: tz - the timezone offset from UTC in minutes |
adjustTimezone | public CalendarValue adjustTimezone(int timezone)(Code) | | Return a new date with the same normalized value, but
in a different timezone. This is called only for a DateValue that has an explicit timezone
Parameters: timezone - the new timezone offset, in minutes the time in the new timezone. This will be a new TimeValue unless no changewas required to the original value |
compareTo | public int compareTo(Object other)(Code) | | Compare the value to another date value. This method is used only during schema processing,
and uses XML Schema semantics rather than XPath semantics.
Parameters: other - The other date value. Must be an object of class DateValue. 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 unknowntimezone are considered to be UTC values (the Comparable interface requiresa total ordering). throws: ClassCastException - if the other value is not a DateValue (the parameteris declared as Object to satisfy the Comparable interface) |
compareTo | public int compareTo(CalendarValue other, XPathContext context)(Code) | | 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.
|
convertPrimitive | public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)(Code) | | Convert to target data type
Parameters: requiredType - an integer identifying the required atomic type Parameters: context - an AtomicValue, a value of the required type; or an ErrorValue |
dateFromJulianDayNumber | public static DateValue dateFromJulianDayNumber(int julianDayNumber)(Code) | | Get the Gregorian date corresponding to a particular Julian day number. The algorithm
is taken from http://www.hermetic.ch/cal_stud/jdn.htm#comp
a DateValue with no timezone information set |
getComponent | public AtomicValue getComponent(int component) throws XPathException(Code) | | Get a component of the value. Returns null if the timezone component is
requested and is not present.
|
getDay | public byte getDay()(Code) | | Get the day component of the date (in local form)
|
getDayOfWeek | final public static int getDayOfWeek(int year, int month, int day)(Code) | | Get the day of the week. The days of the week are numbered from
1 (Monday) to 7 (Sunday)
|
getDayWithinYear | final public static int getDayWithinYear(int year, int month, int day)(Code) | | Get the ordinal day number within the year (1 Jan = 1, 1 Feb = 32, etc)
|
getItemType | public ItemType getItemType(TypeHierarchy th)(Code) | | Determine the data type of the expression
Type.DATE_TYPE, Parameters: th - |
getJulianDayNumber | public static int getJulianDayNumber(int year, int month, int day)(Code) | | Calculate the Julian day number at 00:00 on a given date. This algorithm is taken from
http://vsg.cape.com/~pbaum/date/jdalg.htm and
http://vsg.cape.com/~pbaum/date/jdalg2.htm
(adjusted to handle BC dates correctly)
|
getMonth | public byte getMonth()(Code) | | Get the month component of the date (in local form)
|
getStringValueCS | public CharSequence getStringValueCS()(Code) | | Convert to string
ISO 8601 representation. |
getWeekNumber | final public static int getWeekNumber(int year, int month, int day)(Code) | | Get the ISO week number for a given date. The days of the week are numbered from
1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday)
that includes the first Thursday of that year
|
getWeekNumberWithinMonth | final public static int getWeekNumberWithinMonth(int year, int month, int day)(Code) | | Get the week number within a month. This is required for the XSLT format-date() function,
and the rules are not entirely clear. The days of the week are numbered from
1 (Monday) to 7 (Sunday), and by analogy with the ISO week number, we consider that week 1
in any calendar month is the week (from Monday to Sunday) that includes the first Thursday
of that month. Unlike the ISO week number, we put the previous days in week zero.
|
getYear | public int getYear()(Code) | | Get the year component of the date (in local form)
|
hashCode | public int hashCode()(Code) | | |
isLeapYear | public static boolean isLeapYear(int year)(Code) | | Test whether a year is a leap year
|
isValidDate | public static boolean isValidDate(int year, int month, int day)(Code) | | |
setLexicalValue | public void setLexicalValue(CharSequence s) throws XPathException(Code) | | 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: net.sf.saxon.trans.XPathException - |
tomorrow | public static DateValue tomorrow(int year, byte month, byte day)(Code) | | Get the date that immediately follows a given date
a new DateValue with no timezone information |
yesterday | public static DateValue yesterday(int year, byte month, byte day)(Code) | | Get the date that immediately precedes a given date
a new DateValue with no timezone information |
Fields inherited from net.sf.saxon.value.CalendarValue | final public static int NO_TIMEZONE(Code)(Java Doc)
|
Fields inherited from net.sf.saxon.value.Value | final public static Class[] EMPTY_CLASS_ARRAY(Code)(Java Doc)
|
Methods inherited from net.sf.saxon.value.Value | public static Item asItem(ValueRepresentation value, XPathContext context) throws XPathException(Code)(Java Doc) public static SequenceIterator asIterator(ValueRepresentation val, XPathContext context) throws XPathException(Code)(Java Doc) public static Value asValue(ValueRepresentation val)(Code)(Java Doc) public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException(Code)(Java Doc) public static CharSequence collapseWhitespace(CharSequence in)(Code)(Java Doc) public static Object convert(Item item) throws XPathException(Code)(Java Doc) public static Value convertJavaObjectToXPath(Object object, SequenceType requiredType, Configuration config) throws XPathException(Code)(Java Doc) public Object convertToJava(Class target, XPathContext context) throws XPathException(Code)(Java Doc) public void display(int level, NamePool pool, PrintStream out)(Code)(Java Doc) public boolean effectiveBooleanValue(XPathContext context) throws XPathException(Code)(Java Doc) public boolean equals(Object obj)(Code)(Java Doc) public String evaluateAsString(XPathContext context) throws XPathException(Code)(Java Doc) public Item evaluateItem(XPathContext context) throws XPathException(Code)(Java Doc) public int getCardinality()(Code)(Java Doc) final public int getDependencies()(Code)(Java Doc) public ItemType getItemType(TypeHierarchy th)(Code)(Java Doc) public static SequenceIterator getIterator(ValueRepresentation val) throws XPathException(Code)(Java Doc) public int getLength() throws XPathException(Code)(Java Doc) final public Container getParentExpression()(Code)(Java Doc) public int getSpecialProperties()(Code)(Java Doc) public String getStringValue() throws XPathException(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public Item itemAt(int n) throws XPathException(Code)(Java Doc) final public Iterator iterateSubExpressions()(Code)(Java Doc) public static QNameValue makeQNameValue(Object object, Configuration config)(Code)(Java Doc) public static CharSequence normalizeWhitespace(CharSequence in)(Code)(Java Doc) final public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)(Code)(Java Doc) public void process(XPathContext context) throws XPathException(Code)(Java Doc) final public Expression promote(PromotionOffer offer)(Code)(Java Doc) public Value reduce() throws XPathException(Code)(Java Doc) public boolean schemaEquals(Value obj)(Code)(Java Doc) final public Expression simplify(StaticContext env)(Code)(Java Doc) public static double stringToNumber(CharSequence s) throws NumberFormatException(Code)(Java Doc) public String toString()(Code)(Java Doc) public static CharSequence trimWhitespace(CharSequence in)(Code)(Java Doc) final public Expression typeCheck(StaticContext env, ItemType contextItemType)(Code)(Java Doc)
|
|
|