use of org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType 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.internal.types.AnyType 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));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType in project webtools.sourceediting by eclipse.
the class XSDate method gt.
/**
* Comparison on this and the supplied dates (taking timezones into account)
*
* @param arg
* XSDate representation of the date to compare to
* @throws DynamicError
* @return True if in time, this date lies after the date supplied. False
* otherwise.
*/
public boolean gt(AnyType arg, DynamicContext context) throws DynamicError {
XSDate val = (XSDate) NumericType.get_single_type((Item) arg, XSDate.class);
Calendar thiscal = normalizeCalendar(calendar(), tz());
Calendar thatcal = normalizeCalendar(val.calendar(), val.tz());
return thiscal.after(thatcal);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType in project webtools.sourceediting by eclipse.
the class XSDate method eq.
// comparisons
/**
* Equality comparison on this and the supplied dates (taking timezones into
* account)
*
* @param arg
* XSDate representation of the date to compare to
* @throws DynamicError
* @return True if the two dates are represent the same exact point in time.
* False otherwise.
*/
public boolean eq(AnyType arg, DynamicContext dynamicContext) throws DynamicError {
XSDate val = (XSDate) NumericType.get_single_type((Item) arg, XSDate.class);
Calendar thiscal = normalizeCalendar(calendar(), tz());
Calendar thatcal = normalizeCalendar(val.calendar(), val.tz());
return thiscal.equals(thatcal);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType in project webtools.sourceediting by eclipse.
the class XSInteger method convertArg.
protected Item convertArg(AnyType arg) throws DynamicError {
ResultSequence rs = ResultSequenceFactory.create_new(arg);
rs = constructor(rs);
Item carg = rs.first();
return carg;
}
Aggregations