tvp1.getValue(seqp);
if (seqp.getEntryCount() == 0) {
XDMConstants.setEmptyString(tvp);
tvp.getValue(stringp1);
} else {
throw new SystemException(ErrorCode.FORG0006);
}
} else {
if (!FunctionHelper.isDerivedFromString(tvp1.getTag())) {
throw new SystemException(ErrorCode.FORG0006);
}
tvp1.getValue(stringp1);
}
if (tvp2.getTag() == ValueTag.SEQUENCE_TAG) {
tvp2.getValue(seqp);
if (seqp.getEntryCount() == 0) {
XDMConstants.setEmptyString(tvp);
tvp.getValue(stringp2);
} else {
throw new SystemException(ErrorCode.FORG0006);
}
} else {
if (!FunctionHelper.isDerivedFromString(tvp2.getTag())) {
throw new SystemException(ErrorCode.FORG0006);
}
tvp2.getValue(stringp2);
}
int stringLength1 = stringp1.getStringLength();
int stringLength2 = stringp2.getStringLength();
charIterator1.reset();
charIterator2.reset();
// Third parameter is optional.
if (args.length > 2) {
TaggedValuePointable tvp3 = args[2];
if (!FunctionHelper.isDerivedFromString(tvp3.getTag())) {
throw new SystemException(ErrorCode.FORG0006);
}
tvp3.getValue(stringp3);
}
// TODO use the third value as collation