/*
 * Counter.java
 *
 * Created on 23 October 2002, 09:29
 */

package org.bodington.util;

/** This is a threadsafe counter.  It is suspected that it is
 * not safe for multiple threads to increment and decrement
 * a shared int (as observed in BuildingServlet.doGet()) so
 * this class uses sychronized methods to make a thread
 * safe counter.
 *
 * @author bmb6jrm
 * @version
 */
public class Counter
{
    
    int value;
    
    /** Creates new Counter */
    public Counter()
    {
	value=0;
    }
    
    public synchronized int intValue()
    {
	return value;
    }
    
    public synchronized void increment()
    {
	value++;
    }
    
    public synchronized void decrement()
    {
	value--;
    }
    
}
