private void checkFormat() throws FileFormatException {
// Check whether the ID was set
if (mId == -1) {
throw new FileFormatException("The program frame's ID was not set");
}
// Check whether there are duplicate fields
for (int i = 0; i < getProgramFieldCount(); i++) {
ProgramField field = getProgramFieldAt(i);
// Check whether there is a field that has the same type ID than this one
for (int j = i + 1; j < getProgramFieldCount(); j++) {
ProgramField cmp = getProgramFieldAt(j);
if (field.getTypeId() == cmp.getTypeId()) {
throw new FileFormatException("Program field #" + i + " and "
+ "program field #" + j + " have the same type: "
+ ProgramFieldType.getTypeForId(field.getTypeId()).getName());
}
}
}