Search in sources :

Example 6 with XSDateTime

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

the class FnMonthFromDateTime method month_from_date_time.

/**
 * Month-from-DateTime operation.
 *
 * @param args
 *            Result from the expressions evaluation.
 * @throws DynamicError
 *             Dynamic error.
 * @return Result of fn:month-from-dateTime operation.
 */
public static ResultSequence month_from_date_time(Collection args) throws DynamicError {
    Collection cargs = Function.convert_arguments(args, expected_args());
    ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
    if (arg1.empty()) {
        return ResultBuffer.EMPTY;
    }
    XSDateTime dt = (XSDateTime) arg1.first();
    int res = dt.month();
    return new XSInteger(BigInteger.valueOf(res));
}
Also used : XSDateTime(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime) ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) XSInteger(org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger) Collection(java.util.Collection)

Example 7 with XSDateTime

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

the class FnAdjustDateTimeToTimeZone method expectedArgs.

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

Example 8 with XSDateTime

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

the class FnHoursFromDateTime 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 XSDateTime(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : XSDateTime(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime) SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList)

Example 9 with XSDateTime

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

the class FnHoursFromDateTime method hours_from_date_time.

/**
 * Hours-from-DateTime operation.
 *
 * @param args
 *            Result from the expressions evaluation.
 * @throws DynamicError
 *             Dynamic error.
 * @return Result of fn:hours-from-dateTime operation.
 */
public static ResultSequence hours_from_date_time(Collection args) throws DynamicError {
    Collection cargs = Function.convert_arguments(args, expected_args());
    ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
    if (arg1.empty()) {
        return ResultBuffer.EMPTY;
    }
    XSDateTime dt = (XSDateTime) arg1.first();
    int res = dt.hour();
    return new XSInteger(BigInteger.valueOf(res));
}
Also used : XSDateTime(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime) ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) XSInteger(org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger) Collection(java.util.Collection)

Example 10 with XSDateTime

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

the class FnYearFromDateTime 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 XSDateTime(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : XSDateTime(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime) SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList)

Aggregations

XSDateTime (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime)18 Collection (java.util.Collection)9 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)9 ArrayList (java.util.ArrayList)8 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)8 XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)5 Duration (javax.xml.datatype.Duration)3 XSDayTimeDuration (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDayTimeDuration)3 Iterator (java.util.Iterator)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 BigDecimal (java.math.BigDecimal)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 Item (org.eclipse.wst.xml.xpath2.api.Item)1 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)1 CalendarType (org.eclipse.wst.xml.xpath2.processor.internal.types.CalendarType)1 XSDate (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate)1 XSDecimal (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal)1 XSDuration (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration)1 XSTime (org.eclipse.wst.xml.xpath2.processor.internal.types.XSTime)1