I am not sure that I like the approach in SummaryReport:
public <T> Object getAverage(FieldAccessor fieldAcessor, Iterable<T> objects) {
Double accumulator = 0d;
long count = 0;
boolean evalP = fieldAcessor instanceof EvalDatumFieldAccessor;
for (T object : objects) {
if (evalP) {
Datum datum = ((Datum) object);
if (! datum.isEvaluation())
continue;
}
Perhaps we can enforce a convention for returning empty data as "null", independently of the idea of EvaluationData. This special case of checking for instanceof, and then calling a method specific to Datum looks very brittle.
I am not sure that I like the approach in SummaryReport:
Perhaps we can enforce a convention for returning empty data as "null", independently of the idea of EvaluationData. This special case of checking for instanceof, and then calling a method specific to Datum looks very brittle.