Search in sources :

Example 16 with XSDate

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate in project webtools.sourceediting by eclipse.

the class FnYearFromDate method expected_args.

/**
 * Obtain a list of expected arguments.
 *
 * @return Result of operation.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        _expected_args.add(new SeqType(new XSDate(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : XSDate(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate) SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList)

Example 17 with XSDate

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate in project webtools.sourceediting by eclipse.

the class XSDate method constructor.

/**
 * Creates a new result sequence consisting of the retrievable date value in
 * the supplied result sequence
 *
 * @param arg
 *            The result sequence from which to extract the date value.
 * @throws DynamicError
 * @return A new result sequence consisting of the date value supplied.
 */
public ResultSequence constructor(ResultSequence arg) throws DynamicError {
    if (arg.empty())
        return ResultBuffer.EMPTY;
    Item aat = arg.first();
    if (!isCastable(aat)) {
        throw DynamicError.invalidType();
    }
    XSDate dt = castDate(aat);
    if (dt == null)
        throw DynamicError.cant_cast(null);
    return dt;
}
Also used : Item(org.eclipse.wst.xml.xpath2.api.Item)

Example 18 with XSDate

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate in project webtools.sourceediting by eclipse.

the class XSDate method lt.

/**
 * Comparison on this and the supplied dates (taking timezones into account)
 *
 * @param arg
 *            XSDate representation of the date to compare to
 * @throws DynamicError
 * @return True if in time, this date lies before the date supplied. False
 *         otherwise.
 */
public boolean lt(AnyType arg, DynamicContext context) throws DynamicError {
    XSDate val = (XSDate) NumericType.get_single_type((Item) arg, XSDate.class);
    Calendar thiscal = normalizeCalendar(calendar(), tz());
    Calendar thatcal = normalizeCalendar(val.calendar(), val.tz());
    return thiscal.before(thatcal);
}
Also used : Item(org.eclipse.wst.xml.xpath2.api.Item) GregorianCalendar(java.util.GregorianCalendar) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) Calendar(java.util.Calendar)

Aggregations

XSDate (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate)13 ArrayList (java.util.ArrayList)6 Collection (java.util.Collection)6 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)6 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)6 Item (org.eclipse.wst.xml.xpath2.api.Item)5 Calendar (java.util.Calendar)4 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)4 GregorianCalendar (java.util.GregorianCalendar)3 XSDayTimeDuration (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDayTimeDuration)3 XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)3 Iterator (java.util.Iterator)2 XSTime (org.eclipse.wst.xml.xpath2.processor.internal.types.XSTime)2 Duration (javax.xml.datatype.Duration)1 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)1 XSDateTime (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime)1 XSDuration (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration)1