final DataOutput dOutArgument2 = abvsArgument2.getDataOutput();
final FunctionHelper.TypedPointables tp1 = new FunctionHelper.TypedPointables();
final FunctionHelper.TypedPointables tp2 = new FunctionHelper.TypedPointables();
final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
final CastToDoubleOperation castToDouble = new CastToDoubleOperation();
return new AbstractTaggedValueArgumentScalarEvaluator(args) {
@Override
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
TaggedValuePointable tvp1 = args[0];
TaggedValuePointable tvp2 = args[1];
if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
tvp1.getValue(seqp);
if (seqp.getEntryCount() == 0) {
result.set(tvp1);
return;
}
throw new SystemException(ErrorCode.XPTY0004);
}
if (tvp2.getTag() == ValueTag.SEQUENCE_TAG) {
tvp2.getValue(seqp);
if (seqp.getEntryCount() == 0) {
result.set(tvp2);
return;
}
throw new SystemException(ErrorCode.XPTY0004);
}
abvs.reset();
try {
int tid1 = FunctionHelper.getBaseTypeForArithmetics(tvp1.getTag());
int tid2 = FunctionHelper.getBaseTypeForArithmetics(tvp2.getTag());
LongPointable longp1 = (LongPointable) LongPointable.FACTORY.createPointable();
DoublePointable doublep1 = (DoublePointable) DoublePointable.FACTORY.createPointable();
switch (tvp1.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:
abvsArgument1.reset();
FunctionHelper.getIntegerPointable(tvp1, dOutArgument1);
longp1.set(abvsArgument1.getByteArray(), abvsArgument1.getStartOffset() + 1,
LongPointable.TYPE_TRAITS.getFixedLength());
break;
case ValueTag.XS_DOUBLE_TAG:
tvp1.getValue(doublep1);
break;
case ValueTag.XS_UNTYPED_ATOMIC_TAG:
tid1 = ValueTag.XS_DOUBLE_TAG;
tvp1.getValue(tp1.utf8sp);
abvsArgument1.reset();
castToDouble.convertUntypedAtomic(tp1.utf8sp, dOutArgument1);
doublep1.set(abvsArgument1.getByteArray(), abvsArgument1.getStartOffset() + 1,
DoublePointable.TYPE_TRAITS.getFixedLength());
break;
}
LongPointable longp2 = (LongPointable) LongPointable.FACTORY.createPointable();
DoublePointable doublep2 = (DoublePointable) DoublePointable.FACTORY.createPointable();
switch (tvp2.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:
abvsArgument2.reset();
FunctionHelper.getIntegerPointable(tvp2, dOutArgument2);
longp2.set(abvsArgument2.getByteArray(), abvsArgument2.getStartOffset() + 1,
LongPointable.TYPE_TRAITS.getFixedLength());
break;
case ValueTag.XS_DOUBLE_TAG:
tvp2.getValue(doublep2);
break;
case ValueTag.XS_UNTYPED_ATOMIC_TAG:
tid2 = ValueTag.XS_DOUBLE_TAG;
tvp2.getValue(tp2.utf8sp);
abvsArgument2.reset();
castToDouble.convertUntypedAtomic(tp2.utf8sp, dOutArgument2);
doublep2.set(abvsArgument2.getByteArray(), abvsArgument2.getStartOffset() + 1,
DoublePointable.TYPE_TRAITS.getFixedLength());
break;
}
switch (tid1) {