ciagent
Class CIAgentTimer

java.lang.Object
  |
  +--ciagent.CIAgentTimer

public class CIAgentTimer
extends java.lang.Object
implements java.lang.Runnable, java.io.Serializable

The CIAgentTimer allows autonomous behavior of an agent through timed method calls.

See Also:
Serialized Form

Constructor Summary
CIAgentTimer(CIAgent agent)
          Creates a timer, specifying the agent that owns the timer.
 
Method Summary
 int getAsyncTime()
          Retrieves the asynchronous interval time (in milliseconds).
 int getSleepTime()
          Retrieves the sleep time (in milliseconds).
 void quitTimer()
          Indicates that the timer thread should be ended.
 void run()
          Processes the asynchronous events and autonomous timer events periodically, with the interval based on the sleep time and/or the asynchronous event time.
 void setAsyncTime(int asyncTime)
          Sets the time (in milliseconds) that determines how often the agent processes asynchronous events on its event queue.
 void setSleepTime(int sleepTime)
          Sets the time (in milliseconds) that determines how often an agent performs the autonomous behavior that is defined in its processTimerPop method.
 void startTimer()
          Starts the timer thread.
 void stopTimer()
          Indicates that timer events events should not be fired.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CIAgentTimer

public CIAgentTimer(CIAgent agent)
Creates a timer, specifying the agent that owns the timer.
Parameters:
agent - the CIAgent that owns this timer object
Method Detail

setSleepTime

public void setSleepTime(int sleepTime)
Sets the time (in milliseconds) that determines how often an agent performs the autonomous behavior that is defined in its processTimerPop method.
Parameters:
sleepTime - the amount of sleep time in milliseconds

getSleepTime

public int getSleepTime()
Retrieves the sleep time (in milliseconds).
Returns:
the amount of sleep time in milliseconds

setAsyncTime

public void setAsyncTime(int asyncTime)
Sets the time (in milliseconds) that determines how often the agent processes asynchronous events on its event queue.
Parameters:
asyncTime - the interval time in milliseconds

getAsyncTime

public int getAsyncTime()
Retrieves the asynchronous interval time (in milliseconds).
Returns:
the asychronous interval time in milliseconds

startTimer

public void startTimer()
Starts the timer thread.

stopTimer

public void stopTimer()
Indicates that timer events events should not be fired.

quitTimer

public void quitTimer()
Indicates that the timer thread should be ended.

run

public void run()
Processes the asynchronous events and autonomous timer events periodically, with the interval based on the sleep time and/or the asynchronous event time.
Specified by:
run in interface java.lang.Runnable