Module sm :: Class If
[frames] | no frames]

Class If

SM --+
     |
    If

Given a condition (function from inps to boolean) and two state machines, make a new machine. The condition is evaluated at start time, and one machine is selected, permanently, for execution.

Rarely useful.

Instance Methods
 
__init__(self, condition, sm1, sm2, name=None)
 
getFirstRealState(self, inp)
 
getNextValues(self, state, inp)
Default version of this method.
 
done(self, state)
By default, machines don't terminate
 
printDebugInfo(self, depth, state, nextState, inp, out, debugParams)
Default method for printing out all of the debugging information for a primitive machine.

Inherited from SM: check, doTraceTasks, getStartState, guaranteeName, isDone, run, start, step, transduce, transduceF

Class Variables
  startState = ('start', None)
By default, startState is none

Inherited from SM: legalInputs, name

Instance Variables

Inherited from SM: state

Method Details

__init__(self, condition, sm1, sm2, name=None)
(Constructor)

 
Parameters:
  • condition - Procedure mapping inp -> Boolean
  • sm1 - SM
  • sm2 - SM

getNextValues(self, state, inp)

 

Default version of this method. If a subclass only defines getNextState, then we assume that the output of the machine is the same as its next state.

Overrides: SM.getNextValues
(inherited documentation)

done(self, state)

 

By default, machines don't terminate

Overrides: SM.done
(inherited documentation)

printDebugInfo(self, depth, state, nextState, inp, out, debugParams)

 

Default method for printing out all of the debugging information for a primitive machine.

Overrides: SM.printDebugInfo
(inherited documentation)