Search in sources :

Example 31 with XSInteger

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

the class FnHoursFromTime method hours_from_time.

/**
 * Hours-from-Time operation.
 *
 * @param args
 *            Result from the expressions evaluation.
 * @throws DynamicError
 *             Dynamic error.
 * @return Result of fn:hours-from-time operation.
 */
public static ResultSequence hours_from_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;
    }
    XSTime dt = (XSTime) arg1.first();
    int res = dt.hour();
    return new XSInteger(BigInteger.valueOf(res));
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) XSInteger(org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger) Collection(java.util.Collection) XSTime(org.eclipse.wst.xml.xpath2.processor.internal.types.XSTime)

Example 32 with XSInteger

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

the class FnMinutesFromDuration method minutes_from_duration.

/**
 * Minutes-from-Duration operation.
 *
 * @param args
 *            Result from the expressions evaluation.
 * @throws DynamicError
 *             Dynamic error.
 * @return Result of fn:minutes-from-duration operation.
 */
public static ResultSequence minutes_from_duration(Collection args) throws DynamicError {
    Collection cargs = Function.convert_arguments(args, expected_args());
    ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
    if (arg1.empty()) {
        return ResultBuffer.EMPTY;
    }
    XSDuration dtd = (XSDuration) arg1.first();
    int res = dtd.minutes();
    if (dtd.negative())
        res *= -1;
    return new XSInteger(BigInteger.valueOf(res));
}
Also used : XSDuration(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration) ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) XSInteger(org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger) Collection(java.util.Collection)

Example 33 with XSInteger

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

the class FnMonthsFromDuration method months_from_duration.

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

Example 34 with XSInteger

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

the class FnYearFromDateTime method year_from_date_time.

/**
 * Year-from-DateTime operation.
 *
 * @param args
 *            Result from the expressions evaluation.
 * @throws DynamicError
 *             Dynamic error.
 * @return Result of fn:year-from-dateTime operation.
 */
public static ResultSequence year_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.year();
    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 35 with XSInteger

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

the class RangeResultSequence method iterator.

/**
 * interate through range.
 *
 * @return tail
 */
public ListIterator iterator() {
    // XXX life is getting hard...
    if (_size != 0) {
        ResultSequence newtail = ResultSequenceFactory.create_new();
        for (; _start <= _end; _start++) newtail.add(new XSInteger(BigInteger.valueOf(_start)));
        newtail.concat(_tail);
        _tail.release();
        _tail = newtail;
        _size = 0;
        _start = 0;
        _end = 0;
    }
    return _tail.iterator();
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence)

Aggregations

XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)34 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)32 Collection (java.util.Collection)20 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)12 Iterator (java.util.Iterator)8 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)8 XSDuration (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration)6 URL (java.net.URL)5 XSModel (org.apache.xerces.xs.XSModel)5 Item (org.eclipse.wst.xml.xpath2.api.Item)5 XSDateTime (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime)5 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)4 BigInteger (java.math.BigInteger)3 XSBoolean (org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean)3 XSDate (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate)3 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)2 AnyAtomicType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType)2 XSTime (org.eclipse.wst.xml.xpath2.processor.internal.types.XSTime)2