UML Tutorial -- Statechart Diagram

Statechart Diagram is a state machine that describes the behaviour to an object or the implementation of an operation.The diagram show:1,the states of an object(or interaction);2,an object's response to stimuli(events)in terms of actions and responses.
State:
A state is a condition during the life of an object which:satisfies some condition;performs some action or wait for some event.
An object waits in a state for a finite (non-instantaneous) amout of time.
A state can be decomposed into either concurrent substates or mutually exclusive disjoint substates but not both.
A state is shown as a rectangle with rounded corners.The state has one name compartment that may be empty.It may also have a compartment for internal actions.This compartment may be omitted.
Action:
Internal actions or activities are performed in response to events received while the object is in a state,without changing state.Actions are atomic and non-interruptible,and take an "insignificant" amount of time.
event-name(argument-list)[guard]/action-expression
Action expressions may use attributes and links of the owning object and parameters of incoming transitions.
The three following special actions represent reserved words that cannot be used for event names:
entry-an atomic action performed on entry to the state.
      entry/action-expression
exit-an atomic action performed on exit from the state.
      exit/action-expression
do-an invocation of nested state machine.
      do/state-machine-name(argument-list)
Event:
An event is a "noteworthy occurrence" that might trigger a transition.An event has scope within the package it appears in ,and may be used in any state diagrams for classes that have visibility inside the package.This means that an event is not local to a single class.
There are four event types:
1,SignalEvent-explicit signal from an object.
2,CallEvent-operation called by an object:event-name(parameter-list).
3,ChangeEvent-condition becomes true:when(boolean-expression);
4,TimeEvent-passage of time after some event(entering a state):
      after(time-expression);
Transition:
A transition means that an object would leave one state and enter a new state when a event occurs if specified conditions are satisfied.During the transition actions can be performed and messages may be sent.
Transitions can be complex,that is they may have multiple source states and target states.
A transition is shown as a solid arrow between two states.Actions during the transition is specified in transition string with the following format:
      event-name(argument-list)[guard]/action-list^send-clause
The send-clause has the following format:
      destination-expression.message-name(argument-list)
      The destination-expression can identify several objects,and thus the message can be sent to a set of objects.

posted on 2009-09-16 09:25  Joshua Leung  阅读(295)  评论(0编辑  收藏  举报

导航