net.openai.ai.hybrid.fsmagent
Class SleepState

java.lang.Object
  |
  +--net.openai.util.fsm.State
        |
        +--net.openai.ai.hybrid.fsmagent.AgentState
              |
              +--net.openai.ai.hybrid.fsmagent.InputForwardingState
                    |
                    +--net.openai.ai.hybrid.fsmagent.SleepState
All Implemented Interfaces:
java.io.Serializable

public final class SleepState
extends InputForwardingState

This AgentState sleeps for a given time. This state will forward its input to its output.

See Also:
Serialized Form

Constructor Summary
SleepState()
          Constructs a new SleepState with a sleep time of 0 milliseconds.
SleepState(int sleepTime)
          Constructs a new SleepState with the specified sleep time.
 
Method Summary
protected  java.lang.Object executeState()
          The main body of execution for the SleepState.
 int getSleepTime()
          Returns the sleep time for the SleepState in milliseconds.
 void setSleepTime(int sleepTime)
          Sets the sleep time for the SleepState in milliseconds.
 
Methods inherited from class net.openai.ai.hybrid.fsmagent.InputForwardingState
enter, exit, getInputData
 
Methods inherited from class net.openai.ai.hybrid.fsmagent.AgentState
displayMessage, getAgent
 
Methods inherited from class net.openai.util.fsm.State
addStateListener, addTransition, addTransition, getEndStateFlag, getName, getStartStateFlag, getTransitions, removeStateListener, removeTransition, setEndStateFlag, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SleepState

public SleepState()
Constructs a new SleepState with a sleep time of 0 milliseconds.


SleepState

public SleepState(int sleepTime)
Constructs a new SleepState with the specified sleep time.

Parameters:
sleepTime - The time to sleep in milliseconds.
Method Detail

setSleepTime

public final void setSleepTime(int sleepTime)
Sets the sleep time for the SleepState in milliseconds.

Parameters:
sleepTime - The time to sleep in milliseconds.

getSleepTime

public final int getSleepTime()
Returns the sleep time for the SleepState in milliseconds.

Returns:
The sleep time in milliseconds.

executeState

protected final java.lang.Object executeState()
The main body of execution for the SleepState. This simply calls Thread.sleep(timeInMilliseconds) and returns Boolean.TRUE if the sleep was successful and Boolean.FALSE if the sleep was interrupted.

Specified by:
executeState in class AgentState
Returns:
Boolean.TRUE if the sleep was not interrupted, Boolean.FALSE if it was.


Copyright - 2001 OpenAI Labs. All Rights Reserved.