Finite State Machines


State


Extended States


Guards


Events


Actions and Transitions


State Transition Specification


FSM Example: Nagging Keyboard


Nagging Keyboard State Transition Table (FSM Model)


Hierarchical State Machines

FSM, plus:


Hierarchical States


Orthogonal Regions


Entry and Exit Actions


Transition Execution Sequence


Internal and Self Transitions


Pseudostates - graphical notations


Event Base Types

Discuss HSM again in context of OMG UML Specification


HSM Example: Keyboard


Nagging Keyborad Statechart


Nagging Keyboard State Transition Table


HSM Example: Toaster Oven


HSM Example: C Comment Parser

    As FSM:
    As HSM:
    Fig 3.1
    Fig 4.4b

HSM Example: Quantum Calculator

Primary Use Case

  1. Begin in state operand1
  2. Consumes and stores numerical entries (events)
  3. Event OP triggers transition to state opEntered
  4. Numerical event triggers transition to operand2
  5. EQUALS triggers transition to original "ready" state operand1
    Fig 2.6a

Oops: Need to display result


Add State result

  1. EQUALS triggers transition to state result
    (Entry action displays result on screen)
  2. CLEAR triggers transition to operand1
  3. (Entry action resets all pseudostate.)
  4. 0..9,POINT triggers transition to operand1
    (use event paremeter to initialize operand1 pseudostate)
  5. OPER triggers transition to opEntered
    (use result as operand1 pseudostate)
    Fig 2.6b

Add CANCEL transition to other states


Internal submachines for operand1,2


Handling negation (unary MINUS)
Only two cases where MINUS represents negation:


Putting it Together

  • As FSM, much more complex
  • As extended states only (a la VBCalc) - complexity is unmanageble
    Fig 2.9