|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--anthill.antsim.Stats
The Stats class enables programmers to collect information about events occurring during a simulation. In particular, this class may be used to count the occurrence of events. Each event is identified by a string name chosen by the programmer and is associated to a counter. The value of the counter may be incremented by one by invoking method increment(); the same value may be read by invoking method get().
Constructor Summary | |
Stats()
Initializes an empty stats object. |
Method Summary | |
void |
add(java.lang.String name,
float addend)
Add the value of addend to the counter
identified by name . |
void |
clear()
Restores the object to its initial state, setting all fields to zero, except for updating the average. |
void |
computeAvg()
Computes the average of all the values stored in the map, and keeps the result in the avgMap. |
float |
get(java.lang.String name)
Return the value of the counter identified by name |
static float |
getAvg(java.lang.String name)
Return the average value of the counter identified by name |
void |
inc(java.lang.String name)
Increment by 1 the value of the counter identified by name . |
java.lang.String |
toString(boolean title)
Returns a semi-colon separated list of values to be printed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Stats()
Method Detail |
public void inc(java.lang.String name)
name
.public void add(java.lang.String name, float addend)
addend
to the counter
identified by name
.public float get(java.lang.String name)
name
public static float getAvg(java.lang.String name)
name
public void computeAvg()
public java.lang.String toString(boolean title)
public void clear()
clear
in interface Clearable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |