if (!matcher.matches()) {
throw new InvalidProgramException("Unrecognized annotation string format.");
}
matcher = PATTERN_DIGIT.matcher(s);
FieldSet fs = FieldSet.EMPTY_SET;
while (matcher.find()) {
int field = Integer.valueOf(matcher.group());
if (!isValidField(outType, field)) {
throw new IndexOutOfBoundsException("Annotation: Field " + field + " not available in the output tuple.");
}
if (!isValidField(inType, field)) {
throw new IndexOutOfBoundsException("Annotation: Field " + field + " not available in the input tuple.");
}
fs = fs.addField(field);
}
return fs;
}