use of org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType 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.processor.internal.types.AnyType 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.AnyType in project webtools.sourceediting by eclipse.
the class XSFloat method convertResultSequence.
private ResultSequence convertResultSequence(ResultSequence arg) throws DynamicError {
ResultSequence carg = arg;
Iterator it = carg.iterator();
while (it.hasNext()) {
AnyType type = (AnyType) it.next();
if (type.string_type().equals("xs:untypedAtomic") || type.string_type().equals("xs:string")) {
throw DynamicError.throw_type_error();
}
}
carg = constructor(carg);
return carg;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType 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.AnyType in project webtools.sourceediting by eclipse.
the class XSDouble method convertResultSequence.
private ResultSequence convertResultSequence(ResultSequence arg) throws DynamicError {
ResultSequence carg = arg;
Iterator it = carg.iterator();
while (it.hasNext()) {
AnyType type = (AnyType) it.next();
if (type.string_type().equals("xs:untypedAtomic") || type.string_type().equals("xs:string")) {
throw DynamicError.throw_type_error();
}
}
carg = constructor(carg);
return carg;
}
Aggregations