anthill.antsim.impl
Class StatsImpl
java.lang.Object
|
+--anthill.antsim.impl.StatsImpl
- All Implemented Interfaces:
- Clearable, Stats
- public class StatsImpl
- extends java.lang.Object
- implements Stats, Clearable
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 |
StatsImpl()
Initializes an empty stats object. |
Method Summary |
void |
add(java.lang.String name,
float addend)
Increment by 1 the value of the counter identified by name . |
void |
clear()
Restores the object to its initial state, setting all fields
to zero. |
float |
get(java.lang.String name)
Return the value of the counter identified by name |
void |
inc(java.lang.String name)
Increment by 1 the value of the counter identified by name . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatsImpl
public StatsImpl()
- Initializes an empty stats object.
inc
public void inc(java.lang.String name)
- Increment by 1 the value of the counter identified by
name
.
- Specified by:
inc
in interface Stats
add
public void add(java.lang.String name,
float addend)
- Increment by 1 the value of the counter identified by
name
.
- Specified by:
add
in interface Stats
get
public float get(java.lang.String name)
- Return the value of the counter identified by
name
- Specified by:
get
in interface Stats
clear
public void clear()
- Restores the object to its initial state, setting all fields
to zero.
- Specified by:
clear
in interface Clearable