cz.cuni.amis.pogamut.base.agent.state.impl
Class AgentState

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.state.impl.AgentState
All Implemented Interfaces:
IAgentState, java.io.Serializable
Direct Known Subclasses:
AgentStateDebug, AgentStateFailed, AgentStateFailing, AgentStateInstantiated, AgentStatePaused, AgentStatePausing, AgentStateResumed, AgentStateResuming, AgentStateStarted, AgentStateStartedPaused, AgentStateStarting, AgentStateStartingPaused, AgentStateStopped, AgentStateStopping, BotStateHelloBotReceived, BotStateInited, BotStatePassword, BotStateSendingInit, BotStateSpawned

public abstract class AgentState
extends java.lang.Object
implements IAgentState, java.io.Serializable

Wrapper for the AgentState adding additional String information that provides more details about the agent state.

WARNING: equals() defined according to it'description as well only!

Note that we can not assume which state the agent may find itself in, so we will use a Java object hierarchy to represent it. We provide a set of interfaces that may extend each other to provide the information about the state, e.g. the state may be only but we may create also interface that extends thus allowing other objects to know, that means that agent is healthy because that is what state declares.

See Also:
Serialized Form

Constructor Summary
AgentState(java.lang.String description)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getDescription()
          Additional information about the state - this is inlcuded to hashCode() and equals() methods.
 boolean isNotState(java.lang.Class... states)
          Provides convenient method for testing whether the agent is not in any of 'states'.
 boolean isState(java.lang.Class... states)
          Provides convenient method for testing whether the agent is in one of 'states'.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentState

public AgentState(java.lang.String description)
Method Detail

isState

public boolean isState(java.lang.Class... states)
Description copied from interface: IAgentState
Provides convenient method for testing whether the agent is in one of 'states'.

Returns whether this state is one of the 'states' (using instanceof).

Specified by:
isState in interface IAgentState
Returns:

isNotState

public boolean isNotState(java.lang.Class... states)
Description copied from interface: IAgentState
Provides convenient method for testing whether the agent is not in any of 'states'.

Returns whether this state is not any of the 'states' (using instanceof).

Specified by:
isNotState in interface IAgentState
Returns:

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getDescription

public java.lang.String getDescription()
Description copied from interface: IAgentState
Additional information about the state - this is inlcuded to hashCode() and equals() methods.

Specified by:
getDescription in interface IAgentState
Returns:

toString

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