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

Package class diagram package AgentState
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.state.impl.AgentState
All Implemented Interfaces:
IAgentState, Serializable
Direct Known Subclasses:
AgentStateDebug, AgentStateFailed, AgentStateFailing, AgentStateInstantiated, AgentStatePaused, AgentStatePausing, AgentStateResumed, AgentStateResuming, AgentStateStarted, AgentStateStartedPaused, AgentStateStarting, AgentStateStartingPaused, AgentStateStopped, AgentStateStopping

public abstract class AgentState
extends Object
implements IAgentState, 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.

Author:
Jimmy
See Also:
Serialized Form

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

Constructor Detail

AgentState

public AgentState(String description)
Method Detail

isState

public boolean isState(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(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(Object o)
Overrides:
equals in class Object

getDescription

public 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 String toString()
Overrides:
toString in class Object


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.