use of org.eclipse.wst.xml.xpath2.processor.DynamicError in project webtools.sourceediting by eclipse.
the class FnMinutesFromDateTime method minutes_from_date_time.
/**
* Minutes-from-DateTime operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:minutes-from-dateTime operation.
*/
public static ResultSequence minutes_from_date_time(Collection args) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
if (arg1.empty()) {
return ResultBuffer.EMPTY;
}
XSDateTime dt = (XSDateTime) arg1.first();
int res = dt.minute();
return new XSInteger(BigInteger.valueOf(res));
}
use of org.eclipse.wst.xml.xpath2.processor.DynamicError in project webtools.sourceediting by eclipse.
the class FnMonthFromDateTime method month_from_date_time.
/**
* Month-from-DateTime operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:month-from-dateTime operation.
*/
public static ResultSequence month_from_date_time(Collection args) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
if (arg1.empty()) {
return ResultBuffer.EMPTY;
}
XSDateTime dt = (XSDateTime) arg1.first();
int res = dt.month();
return new XSInteger(BigInteger.valueOf(res));
}
use of org.eclipse.wst.xml.xpath2.processor.DynamicError in project webtools.sourceediting by eclipse.
the class FnName method name.
/**
* Name operation.
*
* @param args
* Result from the expressions evaluation.
* @param context
* Dynamic context.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:name operation.
*/
public static ResultSequence name(Collection args, EvaluationContext ec) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
// get arg
ResultSequence arg1 = null;
if (cargs.isEmpty()) {
if (ec.getContextItem() == null)
throw DynamicError.contextUndefined();
else {
arg1 = ResultBuffer.wrap(ec.getContextItem());
}
} else {
arg1 = (ResultSequence) cargs.iterator().next();
}
if (arg1.empty()) {
return new XSString("");
}
NodeType an = (NodeType) arg1.first();
QName name = an.node_name();
String sname = "";
if (name != null)
sname = name.getStringValue();
return new XSString(sname);
}
use of org.eclipse.wst.xml.xpath2.processor.DynamicError in project webtools.sourceediting by eclipse.
the class FnZeroOrOne method zero_or_one.
/**
* Zero-or-One operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:zero-or-one operation.
*/
public static ResultSequence zero_or_one(Collection args) throws DynamicError {
assert args.size() == 1;
// get args
Iterator citer = args.iterator();
ResultSequence arg = (ResultSequence) citer.next();
if (arg.size() > 1)
throw DynamicError.more_one_item(null);
return arg;
}
use of org.eclipse.wst.xml.xpath2.processor.DynamicError in project webtools.sourceediting by eclipse.
the class FsGe method fs_ge_value.
/**
* Greater than or equal to operation on the values of the arguments.
*
* @param args
* input arguments.
* @param dc
* @throws DynamicError
* Dynamic error.
* @return Result of the operation.
*/
public static ResultSequence fs_ge_value(Collection args, DynamicContext dc) throws DynamicError {
ResultSequence greater = FsGt.fs_gt_value(args, dc);
if (((XSBoolean) greater.first()).value())
return greater;
ResultSequence equal = FsEq.fs_eq_value(args, dc);
if (((XSBoolean) equal.first()).value())
return equal;
return ResultSequenceFactory.create_new(new XSBoolean(false));
}
Aggregations