edu.columbia.cs.coms4701.agent.environments.simple
Class SimpleCounter

java.lang.Object
  extended by edu.columbia.cs.coms4701.agent.environments.simple.SimpleEnvironmentObject
      extended by edu.columbia.cs.coms4701.agent.environments.simple.SimpleCounter
All Implemented Interfaces:
Counter, EnvironmentObject

public class SimpleCounter
extends SimpleEnvironmentObject
implements Counter

A simple counter implementation.

Version:
0.1

User: aaron Date: Aug 24, 2006 Time: 2:26:09 PM

Author:
aaron@cs

Field Summary
 
Fields inherited from class edu.columbia.cs.coms4701.agent.environments.simple.SimpleEnvironmentObject
changeSupport
 
Constructor Summary
SimpleCounter()
           
 
Method Summary
 java.lang.Integer getCount()
          Fetches the current count.
 void incrementCount()
          Increments the counter by 1.
protected  void setCount(java.lang.Integer newCount)
          Sets the counter to a new value.
 java.lang.String toString()
           
 
Methods inherited from class edu.columbia.cs.coms4701.agent.environments.simple.SimpleEnvironmentObject
addPropertyChangeListener, isAlive, removePropertyChangeListener, setAlive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.columbia.cs.coms4701.agent.EnvironmentObject
addPropertyChangeListener, isAlive, removePropertyChangeListener, setAlive
 

Constructor Detail

SimpleCounter

public SimpleCounter()
Method Detail

incrementCount

public void incrementCount()
Increments the counter by 1.

Specified by:
incrementCount in interface Counter

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCount

public java.lang.Integer getCount()
Fetches the current count.

Specified by:
getCount in interface Counter
Returns:
the current count. Expected to begin at 0.

setCount

protected void setCount(java.lang.Integer newCount)
Sets the counter to a new value.

Offered as a single point of entry for subclasses, to handle the change notification.

Parameters:
newCount - the new value of the counter