1 / 8

CSC 354 – Software Engineering, Spring 2013, Week 8

CSC 354 – Software Engineering, Spring 2013, Week 8. UML Distilled, Chapter 10 State Diagrams. State Diagram.

Download Presentation

CSC 354 – Software Engineering, Spring 2013, Week 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 354 – Software Engineering, Spring 2013, Week 8 UML Distilled, Chapter 10 State Diagrams

  2. State Diagram • A State Diagram is a diagram that shows a sequence of states of a system, where a state shows values of the primary variables that store the history and encode the logic of the system’s processing. • A directional transition from one state to another shows the event triggering the transition, along with additional, optional data – arguments, guard condition & activity are optional. • event(arguments) [guard condition] / activity • event (typical but optional) shows incoming stimulus (method call, message from external system, etc.), arguments are event data, guard condition tests whether to process event, activity is the output of the state machine. You need at least 1 of these fields.

  3. HexAtom.interpret

  4. Interpreting a command

  5. "d\\s*(\\d+)"

  6. HexAtom commands ADD "a\\s*(\\d+)\\s*([nsx][ew]?)\\s*(\\d+)\\s*(@\\s*(-)?\\d+\\s*,\\s*(-)?\\d+)?” DIAM "d\\s*(\\d+)” TEMPO "t\\s*((\\d+)|(\\d*\\.\\d+)|(\\d+\\.\\d*))” PROBABILITY "((pcd)|(pde)|(pdf)|(pfi)|(pft)|(pfu)|(pmt)|(pst)|(pxu)|(paz))" + "\\s*(\\d+)(-\\d+)?\\s*=" + \\s*((\\d+)|(\\d*\\.\\d+)|(\\d+\\.\\d*)) QUERY "q\\s*((d|t|f|(p\\s*\\d*))*)” FAKE "f\\s*((\\d*\\.?\\d+)|(\\d+\\.?\\d*))"

  7. Interpreter helper methods • After using a java.util.regex.Match object to extract parameters from the string, the interpreter invokes one of the following helper methods to do the actual work. • helpAddAtom • helpChangeDiameter • helpChangeTempo • helpProbCommand • helpQueryCommand • Fake sets the probabilityToFake directly.

  8. Other applications of state diagrams • TCP protocol establishment & termination • http://en.wikipedia.org/wiki/Transmission_Control_Protocol • Other protocol handlers, including generation of firmware for hardware devices. • The MIDI music generator in HexAtom is a state machine that accepts changes in game state and translate them to timed changes in musical state. • Typically, software that you can think of as a machine is a candidate for modeling using a state diagram.

More Related