cppncss.measure
Class Average

java.lang.Object
  extended by cppncss.measure.Average

public final class Average
extends java.lang.Object

Computes the average of a series of values.

Author:
Mathieu Champlon

Constructor Summary
Average(java.lang.String label, int value)
          Create an average.
 
Method Summary
 void accept(AverageObserver observer)
          Accept a visitor.
 boolean update(java.lang.String label, int value)
          Add a value to the average and recompute it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Average

public Average(java.lang.String label,
               int value)
Create an average.

Parameters:
label - the label of the measurement
value - the first value of the measurement
Method Detail

update

public boolean update(java.lang.String label,
                      int value)
Add a value to the average and recompute it.

If the label does not match the label given at creation the measurement is ignored.

Parameters:
label - the label of the measurement
value - the value of the measurement
Returns:
whether the measurement has been accepted or not

accept

public void accept(AverageObserver observer)
Accept a visitor.

Parameters:
observer - an average observer


Copyright © 2006-2007 null. All Rights Reserved.