bcds.tools.stat
Interface Collector

All Known Implementing Classes:
Average, CollectorBase, Series, SimpleAvg

public interface Collector

Defines the interface for statistical collectors. A collector is an object that counts, sums, computes averages and standard deviation, etc., based on user-provided observations.

The sole attribute defined in this class is a (distinctive) name; subclasses provide the specific attributes they need.

Author:
Juan Segovia S.

Method Summary
 void collect(double value)
          Registers a new observation/instance/sample of this variable (this collector).
 java.lang.String getDescription()
          Returns this collector's descrption.
 java.lang.String getName()
          Returns this collector's name.
 double[] getResults()
          Returns a space-separed list of "results".
 java.lang.String[] getResultsLabels()
          Returns a list of the labels for the result, whose length must match exactly the length of the array returned by getResults().
 java.lang.String report()
          Returns this collector's name followed by the a list of desciption=value for the results.
 void setup(java.lang.String name, java.lang.String desc)
          Resets this collector.
 

Method Detail

setup

void setup(java.lang.String name,
           java.lang.String desc)
Resets this collector. The collector's name is used for identification and it should be short (for example, "blocking_ratio" or "conn.blocked", "conn.accepted"). Descriptions should also be short (just a few words). Neither may be null.


getName

java.lang.String getName()
Returns this collector's name.


getDescription

java.lang.String getDescription()
Returns this collector's descrption.


collect

void collect(double value)
Registers a new observation/instance/sample of this variable (this collector). For simplicity, it is understood that all instances are numbers representable through the type "double".


report

java.lang.String report()
Returns this collector's name followed by the a list of desciption=value for the results.


getResults

double[] getResults()
Returns a space-separed list of "results".


getResultsLabels

java.lang.String[] getResultsLabels()
Returns a list of the labels for the result, whose length must match exactly the length of the array returned by getResults(). However, if the result produced is not simple (for example, a histogram), this method must return a zero-length array to indicate that fact.

A label should be a short text, preferably a single word, and must not contain the "pipe" character (|), as that is used by report methods to separate columns when tabular forms are used. Example: {"average", "stddev", "min", "max"}.