ajanta.pattern
Class Counter

java.lang.Object
  |
  +--ajanta.pattern.Counter
All Implemented Interfaces:
java.io.Serializable

public class Counter
extends java.lang.Object
implements java.io.Serializable

It is a Synchronizer for SplitJoinAll and SpliJoinAny object. It is a simple counter implementing a barrier.

See Also:
SplitJoinAll, SplitJoinAny, Serialized Form

Constructor Summary
Counter()
           
 
Method Summary
 void decrement()
          It decrements the value of the counter and if the value of the counter is not zero then it makes caller to execute wait() call else it notifyAll().
 void setValue(int v)
          Sets the value of the counter to the value passed as argument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter()
Method Detail

setValue

public void setValue(int v)
Sets the value of the counter to the value passed as argument

Parameters:
v - initial value of the counter

decrement

public void decrement()
It decrements the value of the counter and if the value of the counter is not zero then it makes caller to execute wait() call else it notifyAll().