final DataOutput dOutInteger = abvsInteger.getDataOutput();
final FunctionHelper.TypedPointables tp = new FunctionHelper.TypedPointables();
@Override
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
TaggedValuePointable tvp = args[0];
int tid = getBaseTypeForArithmetics(tvp.getTag());
abvs.reset();
try {
switch (tid) {
case ValueTag.SEQUENCE_TAG:
tvp.getValue(tp.seqp);
if (tp.seqp.getEntryCount() == 0) {
XDMConstants.setEmptySequence(result);
return;
}
case ValueTag.XS_DECIMAL_TAG:
tvp.getValue(tp.decp);
aOp.operateDecimal(tp.decp, dOut);
result.set(abvs);
return;
case ValueTag.XS_INTEGER_TAG:
LongPointable longp = (LongPointable) LongPointable.FACTORY.createPointable();
switch (tvp.getTag()) {
case ValueTag.XS_INTEGER_TAG:
case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
case ValueTag.XS_NEGATIVE_INTEGER_TAG:
case ValueTag.XS_LONG_TAG:
case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
case ValueTag.XS_UNSIGNED_LONG_TAG:
case ValueTag.XS_POSITIVE_INTEGER_TAG:
case ValueTag.XS_INT_TAG:
case ValueTag.XS_UNSIGNED_INT_TAG:
case ValueTag.XS_SHORT_TAG:
case ValueTag.XS_UNSIGNED_SHORT_TAG:
case ValueTag.XS_BYTE_TAG:
case ValueTag.XS_UNSIGNED_BYTE_TAG:
abvsInteger.reset();
FunctionHelper.getIntegerPointable(tvp, dOutInteger);
longp.set(abvsInteger.getByteArray(), abvsInteger.getStartOffset() + 1,
LongPointable.TYPE_TRAITS.getFixedLength());
}
aOp.operateInteger(longp, dOut);
result.set(abvs);
return;
case ValueTag.XS_FLOAT_TAG:
tvp.getValue(tp.floatp);
aOp.operateFloat(tp.floatp, dOut);
result.set(abvs);
return;
case ValueTag.XS_DOUBLE_TAG:
tvp.getValue(tp.doublep);
aOp.operateDouble(tp.doublep, dOut);
result.set(abvs);
return;
}
} catch (SystemException se) {