Class Counter

java.lang.Object
  extended by Counter

public class Counter
extends Object

Provide a counter for a participant in the simulation. This includes an identifying string and a count of how many participants of this type currently exist within the simulation.

Version:
2011.07.31
Author:
Michael Kölling and David J. Barnes

Constructor Summary
Counter(String name)
          Provide a name for one of the simulation types.
 
Method Summary
 int getCount()
           
 String getName()
           
 void increment()
          Increment the current count by one.
 void reset()
          Reset the current count to zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter(String name)
Provide a name for one of the simulation types.

Parameters:
name - A name, e.g. "Fox".
Method Detail

getCount

public int getCount()
Returns:
The current count for this type.

getName

public String getName()
Returns:
The short description of this type.

increment

public void increment()
Increment the current count by one.


reset

public void reset()
Reset the current count to zero.