only:reducing confusion

This commit is contained in:
rusefillc 2023-07-03 15:14:25 -04:00
parent b985d28df2
commit 75f457ad53
2 changed files with 7 additions and 1 deletions

View File

@ -16,4 +16,10 @@ public class EnumPair {
public String getArrayForm() {
return arrayForm;
}
public boolean isEmpty() {
if (arrayForm.isEmpty() ^ keyValueForm.isEmpty())
throw new IllegalStateException("Expecting either both empty or both not empty [" + arrayForm + "][" + keyValueForm + "]");
return arrayForm.isEmpty();
}
}

View File

@ -81,7 +81,7 @@ public class PinoutLogic {
String nothingName = namePinType.getNothingName();
EnumsReader.EnumState enumList = enumsReader.getEnums().get(pinType);
EnumPair pair = enumToOptionsList(nothingName, enumList, kv.getValue());
if (pair.getArrayForm().length() > 0) {
if (!pair.isEmpty()) {
// we seem to be here if specific pin category like switch_inputs has no pins
parseState.addDefinition(registry, outputEnumName + KEY_VALUE_FORMAT_ENUM, pair.getKeyValueForm(), Definition.OverwritePolicy.IgnoreNew);
}