de.fhg.igd.jhsm
Class HSM

java.lang.Object
  extended byde.fhg.igd.jhsm.AbstractComponent
      extended byde.fhg.igd.jhsm.HSMState
          extended byde.fhg.igd.jhsm.HSM
All Implemented Interfaces:
Component, CompositeState, Serializable, State
Direct Known Subclasses:
AgentBehaviour, AgentBehaviour, AgentBehaviour, AgentBehaviour, AgentBehaviour, AgentBehaviour, AgentBehaviour1, AgentBehaviour2, JumpAgentBehavior

public class HSM
extends HSMState
implements CompositeState

A generic hierarchical state machine. This can be either a complete state machine or just some substate (submachine) of an enclosing hsm.

Version:
"$Id: HSM.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Haevecker
See Also:
Serialized Form

Field Summary
private  InitialState initialState_
          The initial state of this state machine.
private  Logger LOG
           
private  Set states_
          The set of states that have been added to this machine.
 
Fields inherited from class de.fhg.igd.jhsm.HSMState
 
Fields inherited from class de.fhg.igd.jhsm.AbstractComponent
 
Constructor Summary
HSM()
          The default constructor.
HSM(InitialState start)
           
 
Method Summary
 void action()
           
 void addState(State state)
          Adds a substate to this state.
 boolean contains(State state)
          Checks (recursively) wether the composite state or one of it's substates does have state as a substate.
 void entry(Context context)
          Executes the entry action of the state.
 void exit(Context context)
          Executes the exit action of the state.
 InitialState getInitialState()
          Returns the initial substate of the composite state.
 Set getStates()
          Returns all substates of the composite state.
 void removeState(State state)
          Removes a substate from this state.
 void setInitialState(InitialState initial)
          Sets the initial substate of the composite state.
 
Methods inherited from class de.fhg.igd.jhsm.HSMState
action, addDeferred, addTransition, defers, getDeferred, getTransitions, removeDeferred, removeTransition, setEntry, setExit
 
Methods inherited from class de.fhg.igd.jhsm.AbstractComponent
getAction, getName, getParent, setAction, setName, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.fhg.igd.jhsm.State
addDeferred, addTransition, defers, getDeferred, getTransitions, removeDeferred, removeTransition, setEntry, setExit
 
Methods inherited from interface de.fhg.igd.jhsm.Component
action, getAction, getName, getParent, setAction, setName, setParent
 

Field Detail

LOG

private final Logger LOG

initialState_

private InitialState initialState_
The initial state of this state machine.


states_

private Set states_
The set of states that have been added to this machine.

Constructor Detail

HSM

public HSM()
The default constructor. The initial state has to be set manually.


HSM

public HSM(InitialState start)
Method Detail

addState

public void addState(State state)
Description copied from interface: CompositeState
Adds a substate to this state.

Specified by:
addState in interface CompositeState
Parameters:
state - The state that should be nested.

removeState

public void removeState(State state)
Description copied from interface: CompositeState
Removes a substate from this state.

Specified by:
removeState in interface CompositeState
Parameters:
state - The state that should be removed.

action

public void action()

entry

public void entry(Context context)
Description copied from interface: State
Executes the entry action of the state.

Specified by:
entry in interface State
Overrides:
entry in class HSMState

exit

public void exit(Context context)
Description copied from interface: State
Executes the exit action of the state.

Specified by:
exit in interface State
Overrides:
exit in class HSMState

getStates

public Set getStates()
Description copied from interface: CompositeState
Returns all substates of the composite state.

Specified by:
getStates in interface CompositeState
Returns:
A set that contains all substates of the composite state.

getInitialState

public InitialState getInitialState()
Description copied from interface: CompositeState
Returns the initial substate of the composite state.

Specified by:
getInitialState in interface CompositeState

setInitialState

public void setInitialState(InitialState initial)
Description copied from interface: CompositeState
Sets the initial substate of the composite state.

Specified by:
setInitialState in interface CompositeState

contains

public boolean contains(State state)
Description copied from interface: CompositeState
Checks (recursively) wether the composite state or one of it's substates does have state as a substate.

Specified by:
contains in interface CompositeState
Parameters:
state - The state that is the substate in question.
Returns:
true if the given state is contained in the composite state, false else.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.