final DataOutput dOutInner2 = abvsInner2.getDataOutput();
final FunctionHelper.TypedPointables tp1 = new FunctionHelper.TypedPointables();
final FunctionHelper.TypedPointables tp2 = new FunctionHelper.TypedPointables();
final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
final SequencePointable seqp1 = (SequencePointable) SequencePointable.FACTORY.createPointable();
final SequencePointable seqp2 = (SequencePointable) SequencePointable.FACTORY.createPointable();
final VoidPointable p1 = (VoidPointable) VoidPointable.FACTORY.createPointable();
final VoidPointable p2 = (VoidPointable) VoidPointable.FACTORY.createPointable();
final TaggedValuePointable tvpSeq1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
final TaggedValuePointable tvpSeq2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
return new AbstractTaggedValueArgumentScalarEvaluator(args) {
AbstractCastToOperation aCastToOp = new CastToStringOperation();
@Override
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
boolean booleanResult = false;
TaggedValuePointable tvpArg1 = args[0];
TaggedValuePointable tvpArg2 = args[1];
try {
if (tvpArg1.getTag() == ValueTag.SEQUENCE_TAG) {
tvpArg1.getValue(seqp1);
int seqLen = seqp1.getEntryCount();
for (int j = 0; j < seqLen; ++j) {
seqp1.getEntry(j, p1);
tvpSeq1.set(p1.getByteArray(), p1.getStartOffset(), p1.getLength());
if (evaluateTaggedValueArgument2(aOp, tvpSeq1, tvpArg2, dCtx)) {
booleanResult = true;
break;
}
}
} else {
booleanResult = evaluateTaggedValueArgument2(aOp, tvpArg1, tvpArg2, dCtx);
}
byte[] byteResult = new byte[2];
byteResult[0] = ValueTag.XS_BOOLEAN_TAG;
byteResult[1] = (byte) (booleanResult ? 1 : 0);
result.set(byteResult, 0, 2);
} catch (SystemException se) {
throw se;
} catch (Exception e) {
throw new SystemException(ErrorCode.SYSE0001, e);
}
}
/**
* Check the second argument for a sequence and loop if required.
*
* @param aOp
* @param tvpArg1
* @param tvpArg2
* @param dCtx
* @return
* @throws SystemException
*/
protected boolean evaluateTaggedValueArgument2(AbstractValueComparisonOperation aOp,
TaggedValuePointable tvpArg1, TaggedValuePointable tvpArg2, DynamicContext dCtx)
throws SystemException {
try {
if (tvpArg2.getTag() == ValueTag.SEQUENCE_TAG) {
tvpArg2.getValue(seqp2);
int seqLen = seqp2.getEntryCount();
for (int j = 0; j < seqLen; ++j) {
seqp2.getEntry(j, p2);
tvpSeq2.set(p2.getByteArray(), p2.getStartOffset(), p2.getLength());
if (transformThenCompareTaggedValues(aOp, tvpArg1, tvpSeq2, dCtx)) {
return true;
}
}