if(!argItor.hasNext()) {
return firstItem;
}
final Type firstType = firstItem.getType();
if(firstItem instanceof XNumber) {
XNumber min = (XNumber) firstItem;
// If the converted sequence contains the value NaN, the value NaN is returned.
if(min.isNaN()) {
return min;
}
while(argItor.hasNext()) {
Item it = argItor.next();
if(it instanceof UntypedAtomicValue) {
it = ((UntypedAtomicValue) it).castAs(DoubleType.DOUBLE, dynEnv);
} else if(!(it instanceof XNumber)) {
throw new DynamicError("err:FORG0006", "fs:plus(" + min.getType() + ", "
+ it.getType() + ") is not defined.");
}
XNumber cmp = (XNumber) it;
if(cmp.isNaN()) {
return cmp;
}
if(cmp.compareTo(min) < 0) {
min = cmp;
}
}
return min;
} else if(firstItem instanceof DurationValue) {
// Duration values must either all be xdt:yearMonthDuration values
// or must all be xdt:dayTimeDuration values.
DurationValue min = (DurationValue) firstItem;
assert (firstType != null);
while(argItor.hasNext()) {
Item it = argItor.next();
if(it instanceof DurationValue) {
throw new DynamicError("err:FORG0006", "Duration values must all be `"
+ firstType + "`, but found `" + it.getType() + "`");
}
DurationValue cmp = (DurationValue) it;
if(cmp.compareTo(min) < 0) {
min = cmp;
}
}
return min;
} else if(TypeUtil.subtypeOf(firstType, StringType.STRING)) {