use of org.eclipse.wst.xml.xpath2.processor.DynamicContext 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.processor.DynamicContext 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.DynamicContext 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.DynamicContext in project webtools.sourceediting by eclipse.
the class XSDouble method gt.
/**
* Comparison between this number and the supplied representation.
*
* @param arg
* Representation to be compared with (must currently be of type
* XSDouble)
* @return True if the supplied type represents a number smaller than this
* one stored. False otherwise
*/
public boolean gt(AnyType arg, DynamicContext context) throws DynamicError {
Item carg = convertArg(arg);
XSDouble val = (XSDouble) get_single_type(carg, XSDouble.class);
return double_value() > val.double_value();
}
use of org.eclipse.wst.xml.xpath2.processor.DynamicContext in project webtools.sourceediting by eclipse.
the class FsEq method do_cmp_general_op.
// voodoo 3
/**
* Actual equality operation for fs_eq_general.
*
* @param args
* input arguments.
* @param type
* type of the arguments.
* @param mname
* Method name for template simulation.
* @throws DynamicError
* Dynamic error.
* @return Result of the operation.
*/
public static ResultSequence do_cmp_general_op(Collection args, Class type, String mname, DynamicContext dc) throws DynamicError {
// do the voodoo
Method comparator = null;
try {
Class[] margsdef = { Collection.class, DynamicContext.class };
comparator = type.getMethod(mname, margsdef);
} catch (NoSuchMethodException err) {
throw new RuntimeException("Can�'t find method : " + mname, err);
}
// sanity check args and get them
if (args.size() != 2)
DynamicError.throw_type_error();
Iterator argiter = args.iterator();
org.eclipse.wst.xml.xpath2.api.ResultSequence one = (org.eclipse.wst.xml.xpath2.api.ResultSequence) argiter.next();
org.eclipse.wst.xml.xpath2.api.ResultSequence two = (org.eclipse.wst.xml.xpath2.api.ResultSequence) argiter.next();
// XXX ?
if (one.empty() || two.empty())
return ResultSequenceFactory.create_new(new XSBoolean(false));
// atomize
one = FnData.atomize(one);
two = FnData.atomize(two);
// we gotta find a pair that satisfied the condition
for (Iterator i = one.iterator(); i.hasNext(); ) {
AnyType a = (AnyType) i.next();
for (Iterator j = two.iterator(); j.hasNext(); ) {
AnyType b = (AnyType) j.next();
if (do_general_pair(a, b, comparator, dc))
return ResultSequenceFactory.create_new(new XSBoolean(true));
}
}
return ResultSequenceFactory.create_new(new XSBoolean(false));
}
Aggregations