|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--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(String name,
float addend)
Add the value of addend to the counter
identified by name . |
void |
clear()
Restores the object to its initial state. |
void |
computeAvg()
Computes the average of all the values stored in the map, and keeps the result in the avgMap. |
float |
get(String name)
Return the value of the counter identified by name |
static float |
getAvg(String name)
Return the average value of the counter identified by name |
String |
headingToString()
Returns a semi-colon separated list of headings to be printed |
void |
inc(String name)
Increment by 1 the value of the counter identified by name . |
String |
toString()
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, wait, wait, wait |
Constructor Detail |
public Stats()
Method Detail |
public void inc(String name)
name
.
public void add(String name, float addend)
addend
to the counter
identified by name
.
public float get(String name)
name
public static float getAvg(String name)
name
public void computeAvg()
public String headingToString()
public String toString()
toString
in class Object
public void clear()
clear
in interface Clearable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |