seminar-state-chart1-1227515303459292-8

18
State Chart Diagram By: Bhavsar Jenish Roll No : 08

description

UML State Chart Diagram

Transcript of seminar-state-chart1-1227515303459292-8

  • State Chart DiagramBy: Bhavsar JenishRoll No : 08

  • State Chart Diagram State-transition diagrams describe all of the states that an object can have, the events under which an object changes state (transitions), the conditions that must be fulfilled before the transition will occur (guards), and the activities undertaken during the life of an object (actions). In comparison the other behavioral diagrams which model the interaction between multiple classes, State diagrams typically model the transitions within a single class. It also shows how an entity responds to various events by changing from one state to another. In most OO techniques, state diagrams are drawn for a single class to show the lifetime behavior of a single object.

  • Elements of State Chart DiagramInitial State: This shows the starting point or first activity of the flow. Denoted by a solid circle. This is also called as a "pseudo state," where the state has no variables describing it further and no activities. 2. State: Represents the state of object at an instant of time. In a state diagram, there will be multiple of such symbols, one for each state of the Object we are discussing. Denoted by a rectangle with rounded corners and compartments (such as a class with rounded corners to denote an Object).

    State Name

    State Variables

    Action

    Contd

  • Transition: An arrow indicating the Object to transition from one state to the other. The actual trigger event and action causing the transition are written beside the arrow, separated by a slash. Transitions that occur because the state completed an activity are called "triggerless" transitions. If an event has to occur after the completion of some event or action, the event or action is called the guard condition. The transition takes place after the guard condition occurs. This guard condition/event/action is depicted by square brackets around the description of the event/action (in other words, in the form of a Boolean expression). Event/ActionContd

  • Contd

    4. Signal: When an event causes a message/trigger to be sent to a state, that causes the transition; then, that message sent by the event is called a signal. Represented as a class with the icon above the action/event.

    Event/ActionEvent/Action5. Final State: The end of the state diagram is shown by a bull's eye symbol, also called a final state. A final state is another example of a pseudo state because it does not have any variable or action described.

  • 6. Iterations: Whenever there is repetition of any action which does not make a transition to another state instead the same state reoccurs the transition is shown as given. This transition is known as a self-transition. Here the source and target states are same.

    State

    7. Decision Making: Whenever there is a requirement to check a given condition before any transition occurs then the condition is specified in [ ] brackets.

    State1

    State2

    Event/Action[ condition ]

  • 8. Region: A region is an orthogonal part of either a composite state or a state machine. It contains states and transitions.

    Lab1

    Lab2

    project

    First test

    Failed

    Passed

    FailStudying

  • Different States of State Chart Diagram1. Choice pseudo state: A choice vertices which, when reached, result in the dynamic evaluation of the guards of the triggers of its outgoing transitions. This realizes a dynamic conditional branch. It allows splitting of transitions into multiple outgoing paths such that the decision on which path to take may be a function of the results of prior actions performed in the same run-to-completion step. The boolean conditions specified are known as guards.[ 10]

    State1

    State4

    State3

    State2

    [ a=5]

  • 2. Composite State: A composite state is either a simple composite state (with just one region) or an orthogonal state (with more than one region).

    State1

    State2

    Event/Action[ condition ]3. Submachine State: A submachine state specifies the insertion of the specification of a submachine state machine. The state machine that contains the submachine state is called the containing state machine. The same state machine may be a submachine more than once in the context of a single containing state machine. Contd

  • 4. Junction Pseudostate: A junction vertices are semantic-free vertices that are used to chain together multiple transitions. They are used to construct compound transition paths between states.

    State1

    State1

    State1

    State1

    State1

    [a < 0][a = 5][a >7]E1 [b < 0]E2 [b < 0]Contd

  • 5. History Deep Pseudostate: A deepHistory represents the most recent active configuration of the composite state that directly contains this pseudostate; e.g. the state configuration that was active when the composite state was last exited. A

    A2

    A1

    C

    InterruptH*resumeContd

  • 6. History Shallow Pseudostate: A shallowHistory represents the most recent active substate of its containing state (but not the substates of that substate). A composite state can have at most one shallow history vertex. A

    A1

    A2

    C

    InterruptHresumeContd

  • 7. Entry Point Pseudostate: Sometimes you wont want to enter a sub-machine at the normal initial state. For example, in the following sub-machine it would be normal to begin in the "Initializing" state, but if for some reason it wasnt necessary to perform the initialization, it would be possible to begin in the Intialized" state by transitioning to the named entry point.

    A1A2 A3Skip A1InitializingInitialized Contd

  • 8. Exit Point Pseudostate: An exit point pseudostate is an exit point of a state machine or composite state. Entering an exit point within any region of the composite state or state machine referenced by a submachine state implies the exit of this composite state or submachine state and the triggering of the transition that has this exit point as source in the state machine enclosing the submachine or composite state.

    Reading instructionsWriting Error reportDisplaying ResultsProcessing instructionsProcessingFailed to Read Contd

  • 9. Terminate Pseudostate: Entering a terminate pseudostate implies that the execution of this state machine by means of its context object is terminated. The state machine does not exit any states nor does it perform any exit actions other than those associated with the transition leading to the terminate pseudostate.StateActiveTerminate Lift receiver /get dial tone Caller hangs up /disconnect

  • When to use the State Chart Diagrams Critical to workflow and workgroup applications. Critical to processing any documents. Critical to speeds, feeds and flows, sometimes called Control applications. Modelling a real-time processing application. Shows behaviour of a class over several use-cases.

  • Thanks !!