Class Counter
java.lang.Object
uk.ac.manchester.spinnaker.utils.Counter
Thin wrapper around an
int for counting.
This allows the object to be final and therefore passed into inner classes.
This is not thread safe.
- Author:
- Christian-B
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Counter
public Counter()Create a counter starting at zero.
-
-
Method Details
-
increment
public void increment()Add one to the count. -
add
public void add(int other) Add any amount to the counter.Could also be used to add a negative number.
- Parameters:
other- int values by which to change the counter.
-
get
public int get()Retrieve the current value.- Returns:
- The current counter value.
-