X
- The context type.U
- The type of per-user results. This is a plain Java class that has fields or methods
annotated with ResultColumn
containing the per-user output columns.G
- The type of global results. This is a plain Java class that has fields or methods
annotated with ResultColumn
containing the aggregate output columns.public abstract class AbstractMetric<X,G,U> extends Object implements Metric<X>
Modifier | Constructor and Description |
---|---|
protected |
AbstractMetric(Class<G> aggregate,
Class<U> user) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the metric.
|
protected abstract U |
doMeasureUser(TestUser user,
X context)
Measure a user with typed results.
|
List<String> |
getColumnLabels()
Get labels for the aggregate columns output by this evaluator.
|
protected String |
getPrefix()
A prefix to be applied to column names.
|
List<Object> |
getResults(X context)
Get the aggregate results from an accumulator.
|
protected String |
getSuffix()
A suffix to be applied to column names.
|
protected abstract G |
getTypedResults(X context)
Get the typed results from an accumulator.
|
List<String> |
getUserColumnLabels()
Get labels for the per-user columns output by this evaluator.
|
List<Object> |
measureUser(TestUser user,
X context)
Measure a user in the evaluation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createContext
protected String getPrefix()
null
, this prefix will be applied and
separated with a period.protected String getSuffix()
null
, this suffix will be applied and
separated with a period.public List<String> getColumnLabels()
Metric
getColumnLabels
in interface Metric<X>
public List<String> getUserColumnLabels()
Metric
getUserColumnLabels
in interface Metric<X>
Metric.measureUser(TestUser, Object)
@Nonnull public List<Object> measureUser(TestUser user, X context)
Metric
measureUser
in interface Metric<X>
user
- The user to evaluate.context
- The context for the active experimental condition.protected abstract U doMeasureUser(TestUser user, X context)
user
- The user to measure.context
- The context.null
to emit NAs for the user.@Nonnull public List<Object> getResults(X context)
Metric
getResults
in interface Metric<X>
context
- The context for an experimental condition.protected abstract G getTypedResults(X context)
context
- The context.null
to emit NAs.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if there is an error closing the metric.