abvsSum.reset();
dOutSum.write(ValueTag.XS_INTEGER_TAG);
dOutSum.writeLong(0);
tvpSum.set(abvsSum);
} catch (Exception e) {
throw new AlgebricksException(e);
}
}
@Override
public void finish(IPointable result) throws AlgebricksException {
tvpCount.getValue(longp);
if (longp.getLong() == 0) {
XDMConstants.setEmptySequence(result);
} else {
// Set count as a TaggedValuePointable.
try {
FunctionHelper.arithmeticOperation(aOpDivide, dCtx, tvpSum, tvpCount, tvpSum);
result.set(tvpSum);
} catch (Exception e) {
throw new AlgebricksException(e);
}
}
}
@Override