in java/com/google/gerrit/plugins/checks/api/CombinedCheckState.java [107:144]
public static CheckStateCount create(
ImmutableListMultimap<CheckState, Boolean> statesAndRequired) {
int failedRequiredCount = 0;
int failedOptionalCount = 0;
int inProgressRequiredCount = 0;
int inProgressOptionalCount = 0;
int successfulCount = 0;
for (Map.Entry<CheckState, Boolean> checkStateAndRequiredState :
statesAndRequired.entries()) {
CheckState state = checkStateAndRequiredState.getKey();
if (state.isInProgress()) {
if (checkStateAndRequiredState.getValue()) {
inProgressRequiredCount++;
} else {
inProgressOptionalCount++;
}
} else if (state == CheckState.FAILED) {
if (checkStateAndRequiredState.getValue()) {
failedRequiredCount++;
} else {
failedOptionalCount++;
}
} else if (state == CheckState.SUCCESSFUL) {
successfulCount++;
} else if (state != CheckState.NOT_RELEVANT) {
throw new IllegalStateException("invalid state: " + state);
}
}
return new AutoValue_CombinedCheckState_CheckStateCount.Builder()
.failedRequiredCount(failedRequiredCount)
.failedOptionalCount(failedOptionalCount)
.inProgressRequiredCount(inProgressRequiredCount)
.inProgressOptionalCount(inProgressOptionalCount)
.successfulCount(successfulCount)
.build();
}