use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSFloat 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.processor.internal.types.XSFloat 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.processor.internal.types.XSFloat in project webtools.sourceediting by eclipse.
the class XSFloat method times.
/**
* Mathematical multiplication operator between this XSFloat and the
* supplied ResultSequence.
*
* @param arg
* The ResultSequence to perform a multiplication with
* @return A XSFloat consisting of the result of the mathematical
* multiplication.
*/
public ResultSequence times(ResultSequence arg) throws DynamicError {
ResultSequence carg = constructor(arg);
XSFloat val = (XSFloat) get_single_type(carg, XSFloat.class);
return ResultSequenceFactory.create_new(new XSFloat(float_value() * val.float_value()));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSFloat in project webtools.sourceediting by eclipse.
the class FnSum method sum.
/**
* Sum operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:sum operation.
*/
public static ResultSequence sum(ResultSequence arg, AnyAtomicType zero) throws DynamicError {
if (arg.empty())
return ResultSequenceFactory.create_new(zero);
MathPlus total = null;
TypePromoter tp = new ScalarTypePromoter();
tp.considerSequence(arg);
for (Iterator i = arg.iterator(); i.hasNext(); ) {
AnyAtomicType conv = tp.promote((AnyType) i.next());
if (conv == null) {
conv = zero;
}
if (conv instanceof XSDouble && ((XSDouble) conv).nan() || conv instanceof XSFloat && ((XSFloat) conv).nan()) {
return ResultSequenceFactory.create_new(tp.promote(new XSFloat(Float.NaN)));
}
if (total == null) {
total = (MathPlus) conv;
} else {
total = (MathPlus) total.plus(ResultSequenceFactory.create_new(conv)).first();
}
}
return ResultSequenceFactory.create_new((AnyType) total);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSFloat in project webtools.sourceediting by eclipse.
the class XSFloat method div.
/**
* Mathematical division operator between this XSFloat and the supplied
* ResultSequence.
*
* @param arg
* The ResultSequence to perform a division with
* @return A XSFloat consisting of the result of the mathematical division.
*/
public ResultSequence div(ResultSequence arg) throws DynamicError {
ResultSequence carg = convertResultSequence(arg);
XSFloat val = (XSFloat) get_single_type(carg, XSFloat.class);
return ResultSequenceFactory.create_new(new XSFloat(float_value() / val.float_value()));
}
Aggregations