# ClassicFSM

from direct.fsm.ClassicFSM import ClassicFSM

Finite State Machine class.
This module and class exist only for backward compatibility with existing code. New code should use the FSM class instead.

## Inheritance:

ClassicFSM: DirectObject
DirectObject:

## Methods of ClassicFSM:

__enter
__exitCurrent
__init__
__repr__
__str__
__transition
addState
conditional_request
enterInitialState
forceTransition
getCurrentState
getFinalState
getInitialState
getName
getStateNamed
getStates
request
requestFinalState
setFinalState
setInitialState
setName
setStates
view

## Methods of DirectObject:

__init__
accept
acceptOnce
ignore
ignoreAll
isAccepting
isIgnoring

__enter def __enter(self, aState, argList=[]) Enter a given state, if it exists

__exitCurrent def __exitCurrent(self, argList) Exit the current state

__init__ def __init__(self, name, states=[], initialStateName=None, finalStateName=None, onUndefTransition=DISALLOW_VERBOSE) __init__(self, string, State[], string, string, int) ClassicFSM constructor: takes name, list of states, initial state and final state as: fsm = ClassicFSM.ClassicFSM('stopLight', [State.State('red', enterRed, exitRed, ['green']), State.State('yellow', enterYellow, exitYellow, ['red']), State.State('green', enterGreen, exitGreen, ['yellow'])], 'red', 'red') each state's last argument, a list of allowed state transitions, is optional; if left out (or explicitly specified to be State.State.Any) then any transition from the state is 'defined' and allowed 'onUndefTransition' flag determines behavior when undefined transition is requested; see flag definitions above

__repr__ def __repr__(self) Undocumented function.

__str__ def __str__(self) Print out something useful about the fsm

__transition def __transition(self, aState, enterArgList=[], exitArgList=[]) Exit currentState and enter given one

addState def addState(self, state) Undocumented function.

conditional_request def conditional_request(self, aStateName, enterArgList=[], exitArgList=[]) 'if this transition is defined, do it' Attempt transition from currentState to given one, if it exists. Return true if transition exists to given state, false otherwise. It is NOT an error/warning to attempt a cond_request if the transition doesn't exist. This lets people be sloppy about ClassicFSM transitions, letting the same fn be used for different states that may not have the same out transitions.

enterInitialState def enterInitialState(self, argList=[]) Undocumented function.

forceTransition def forceTransition(self, aStateName, enterArgList=[], exitArgList=[]) force a transition -- for debugging ONLY

getCurrentState def getCurrentState(self) Undocumented function.

getFinalState def getFinalState(self) Undocumented function.

getInitialState def getInitialState(self) Undocumented function.

getName def getName(self) Undocumented function.

getStateNamed def getStateNamed(self, stateName) Return the state with given name if found, issue warning otherwise

getStates def getStates(self) Undocumented function.

request def request(self, aStateName, enterArgList=[], exitArgList=[], force=0) Attempt transition from currentState to given one. Return true is transition exists to given state, false otherwise.

requestFinalState def requestFinalState(self) Undocumented function.

setFinalState def setFinalState(self, finalStateName) Undocumented function.

setInitialState def setInitialState(self, initialStateName) Undocumented function.

setName def setName(self, name) Undocumented function.

setStates def setStates(self, states) setStates(self, State[])

view def view(self) Undocumented function.

__init__ def __init__(self) Undocumented function.

accept def accept(self, event, method, extraArgs=[]) Undocumented function.

acceptOnce def acceptOnce(self, event, method, extraArgs=[]) Undocumented function.

ignore def ignore(self, event) Undocumented function.

ignoreAll def ignoreAll(self) Undocumented function.

isAccepting def isAccepting(self, event) Undocumented function.

isIgnoring def isIgnoring(self, event) Undocumented function.