ir.utilities
Class Counter

java.lang.Object
  extended by ir.utilities.Counter

public class Counter
extends java.lang.Object

A simple wrapper data structure for storing an integer count as an Object that can be put into lists, maps, etc. and then incremented and decremented.


Field Summary
protected  int count
          The integer count
 
Constructor Summary
Counter()
           
 
Method Summary
 int decrement()
          Decrement and return the new count
 int decrement(int n)
          Decrement by n and return the new count
 int getValue()
          Get the current count
 int increment()
          Increment and return the new count
 int increment(int n)
          Increment by n and return the new count
 int setValue(int value)
          Set the current count
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

protected int count
The integer count

Constructor Detail

Counter

public Counter()
Method Detail

increment

public int increment()
Increment and return the new count


increment

public int increment(int n)
Increment by n and return the new count


decrement

public int decrement()
Decrement and return the new count


decrement

public int decrement(int n)
Decrement by n and return the new count


getValue

public int getValue()
Get the current count


setValue

public int setValue(int value)
Set the current count