SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
BasicObservationCollector.java
1package umontreal.ssj.mcqmctools.anova;
2
11public class BasicObservationCollector<E> implements ObservationCollector<E> {
12
13 protected String label;
14 protected int nObservations;
15
16 public BasicObservationCollector() {
17 this(null);
18 }
19
24 public BasicObservationCollector(String label) {
25 this.label = label;
26 nObservations = 0;
27 }
28
29 public String getLabel() {
30 return label;
31 }
32
33 public int getNumObservations() {
34 return nObservations;
35 }
36
41 public void init() {
42 nObservations = 0;
43 }
44
49 public void observe(E observation) {
50 nObservations++;
51 }
52
57 public Report report() {
58 String collectorLabel = (label == null) ? this.getClass().getSimpleName() : label;
59 Report r = new Report(collectorLabel);
60 r.add("number of observations", getNumObservations());
61 return r;
62 }
63
64 public String toString() {
65 return "Basic Observation Collector";
66 }
67}
void observe(E observation)
Updates the number of observations.
Report report()
Returns a report of measurements on the data collected by the collector.