use of org.eclipse.wst.xml.xpath2.processor.internal.RangeResultSequence in project webtools.sourceediting by eclipse.
the class OpTo method op_to.
/**
* Op-To operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of operation.
*/
public static ResultSequence op_to(Collection args) throws DynamicError {
// convert arguments
Collection cargs = Function.convert_arguments(args, expected_args());
// get arguments
Iterator iter = cargs.iterator();
ResultSequence r = (ResultSequence) iter.next();
int one = ((XSInteger) r.first()).int_value().intValue();
r = (ResultSequence) iter.next();
if (r.first() == null) {
return ResultBuffer.EMPTY;
}
int two = ((XSInteger) r.first()).int_value().intValue();
if (one > two)
return ResultBuffer.EMPTY;
// inclusive first and last
if (one == two) {
return new XSInteger(BigInteger.valueOf(one));
}
/*
* for(one++; one <= two; one++) { rs.add(new XSInteger(one)); }
*
* return rs;
*/
return new RangeResultSequence(one, two);
}
Aggregations