use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class FnDaysFromDuration method days_from_duration.
/**
* Days-From-Duration operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:days-from-duration operation.
*/
public static ResultSequence days_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.days();
if (dtd.negative())
res *= -1;
return new XSInteger(BigInteger.valueOf(res));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class FnHoursFromDuration method hours_from_duration.
/**
* Hours-from-Duration operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:hours-from-duration operation.
*/
public static ResultSequence hours_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.hours();
if (dtd.negative())
res *= -1;
return new XSInteger(BigInteger.valueOf(res));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class XSInteger method mod.
/**
* Mathematical modulus operator between this XSInteger and the supplied
* ResultSequence.
*
* @param arg
* The ResultSequence to perform a modulus with
* @return A XSInteger consisting of the result of the mathematical modulus.
*/
public ResultSequence mod(ResultSequence arg) throws DynamicError {
ResultSequence carg = convertResultSequence(arg);
XSInteger val = (XSInteger) get_single_type(carg, XSInteger.class);
BigInteger result = int_value().remainder(val.int_value());
return ResultSequenceFactory.create_new(new XSInteger(result));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class XSInteger method gt.
/*
* (non-Javadoc)
* @see org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal#gt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)
*/
public boolean gt(AnyType arg, DynamicContext context) throws DynamicError {
Item carg = convertArg(arg);
XSInteger val = (XSInteger) get_single_type(carg, XSInteger.class);
int compareResult = int_value().compareTo(val.int_value());
return compareResult > 0;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class XSInteger method times.
/**
* Mathematical multiplication operator between this XSInteger and the
* supplied ResultSequence.
*
* @param arg
* The ResultSequence to perform a multiplication with
* @return A XSInteger consisting of the result of the mathematical
* multiplication.
*/
public ResultSequence times(ResultSequence arg) throws DynamicError {
ResultSequence carg = convertResultSequence(arg);
XSInteger val = (XSInteger) get_single_type(carg, XSInteger.class);
return ResultSequenceFactory.create_new(new XSInteger(int_value().multiply(val.int_value())));
}
Aggregations