use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class XSDecimal method lt.
/**
* Comparison between this number and the supplied representation.
*
* @param arg
* Representation to be compared with (must currently be of type
* XSDecimal)
* @return True if the supplied type represents a number greater than this
* one stored. False otherwise
*/
public boolean lt(AnyType arg, DynamicContext context) throws DynamicError {
Item carg = convertArg(arg);
XSDecimal val = (XSDecimal) get_single_type(carg, XSDecimal.class);
return (_value.compareTo(val.getValue()) == -1);
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class XSFloat method lt.
/**
* Comparison between this number and the supplied representation.
*
* @param arg
* The datatype to compare with
* @return True if the supplied representation is a greater number than the
* one stored. False otherwise
* @throws DynamicError
*/
public boolean lt(AnyType arg, DynamicContext context) throws DynamicError {
Item carg = convertArg(arg);
XSFloat val = (XSFloat) get_single_type(carg, XSFloat.class);
return float_value() < val.float_value();
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class XSFloat method plus.
/**
* Mathematical addition operator between this XSFloat and the supplied
* ResultSequence.
*
* @param arg
* The ResultSequence to perform an addition with
* @return A XSFloat consisting of the result of the mathematical addition.
*/
public ResultSequence plus(ResultSequence arg) throws DynamicError {
ResultSequence carg = convertResultSequence(arg);
Item at = get_single_arg(carg);
if (!(at instanceof XSFloat))
DynamicError.throw_type_error();
XSFloat val = (XSFloat) at;
return ResultSequenceFactory.create_new(new XSFloat(float_value() + val.float_value()));
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class XSFloat method eq.
/**
* Equality comparison between this number and the supplied representation.
* @param aa
* The datatype to compare with
*
* @return True if the two representations are of the same number. False
* otherwise
* @throws DynamicError
*/
public boolean eq(AnyType aa, DynamicContext dynamicContext) throws DynamicError {
Item carg = convertArg(aa);
if (!(carg instanceof XSFloat))
DynamicError.throw_type_error();
XSFloat f = (XSFloat) carg;
if (nan() && f.nan()) {
return false;
}
Float thatvalue = new Float(f.float_value());
Float thisvalue = new Float(float_value());
return thisvalue.equals(thatvalue);
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class FnString method string.
/**
* String operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:string operation.
*/
public static ResultSequence string(Collection args, EvaluationContext ec) throws DynamicError {
assert (args.size() == 0 || args.size() == 1);
ResultSequence arg1 = null;
if (args.isEmpty()) {
// support for arity = 0
return getResultSetForArityZero(ec);
} else {
arg1 = (ResultSequence) args.iterator().next();
}
// sanity check args
if (arg1.size() > 1)
throw new DynamicError(TypeError.invalid_type(null));
ResultBuffer rs = new ResultBuffer();
if (arg1.empty()) {
rs.add(new XSString(""));
} else {
Item at = arg1.first();
rs.add(new XSString(at.getStringValue()));
}
return rs.getSequence();
}
Aggregations