Software Disclaimer

Class UML 2.3::State


The states of protocol state machines are exposed to the users of their context classifiers. A protocol state represents an exposed stable situation of its context classifier: when an instance of the classifier is not processing any operation, users of this instance can always know its state configuration.

Direct Superclasses: Namespace, RedefinableElement, Vertex

Direct Subclasses: FinalState

Class Precedence List: State, Namespace, RedefinableElement, Vertex, NamedElement, Element


connection : ConnectionPointReference (0 *); -- source State
connectionPoint : Pseudostate (0 *); -- source State
deferrableTrigger : Trigger (0 *); -- source State
doActivity : Behavior (0 1); -- source State
entry : Behavior (0 1); -- source State

An optional behavior that is executed whenever this state is entered regardless of the transition taken to reach the state. If defined, entry actions are always executed to completion prior to any internal behavior or transitions performed within the state.
Subsets: Element.ownedElement

exit : Behavior (0 1); -- source State
isComposite : Boolean (1 1); -- source State
isOrthogonal : Boolean (1 1); -- source State
isSimple : Boolean (1 1); -- source State
isSubmachineState : Boolean (1 1); -- source State
redefinedState : State (0 1); -- source State

The state of which this state is a redefinition.
Subsets: RedefinableElement.redefinedElement

redefinitionContext : Classifier (1 1); -- source State
region : Region (0 *); -- source State
stateInvariant : Constraint (0 1); -- source State
submachine : StateMachine (0 1); -- source State
elementImport : ElementImport (0 *); -- source Namespace
importedMember : PackageableElement (0 *); -- source Namespace

References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports.
{readonly, derived}
Subsets: Namespace.member

member : NamedElement (0 *); -- source Namespace
ownedMember : NamedElement (0 *); -- source Namespace
ownedRule : Constraint (0 *); -- source Namespace
packageImport : PackageImport (0 *); -- source Namespace
isLeaf : Boolean (1 1); -- source RedefinableElement

Indicates whether it is possible to further redefine a RedefinableElement. If the value is true, then it is not possible to further redefine the RedefinableElement. Note that this property is preserved through package merge operations; that is, the capability to redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in the resulting RedefinableElement of a package merge operation where a RedefinableElement with isLeaf=false is merged with a matching RedefinableElement with isLeaf=true: the resulting RedefinableElement will have isLeaf=false. Default value is false.
Default value: FALSE

redefinedElement : RedefinableElement (0 *); -- source RedefinableElement
container : Region (0 1); -- source Vertex
incoming : Transition (0 *); -- source Vertex
outgoing : Transition (0 *); -- source Vertex
clientDependency : Dependency (0 *); -- source NamedElement
name : String (0 1); -- source NamedElement
nameExpression : StringExpression (0 1); -- source NamedElement
namespace : Namespace (0 1); -- source NamedElement

Specifies the namespace that owns the NamedElement.
Derived union with sources: (container)
Subsets: Element.owner
Opposite: Namespace.ownedMember

qualifiedName : String (0 1); -- source NamedElement
visibility : VisibilityKind (0 1); -- source NamedElement
ownedComment : Comment (0 *); -- source Element
ownedElement : Element (0 *); -- source Element

The Elements owned by this element.
{composite, readonly}
Derived union with sources: (ownedComment, nameExpression, packageImport, ownedRule, ownedMember, elementImport, stateInvariant, region, exit, entry, doActivity, connectionPoint, connection)
Opposite: Element.owner

owner : Element (0 1); -- source Element


Signature: submachine_states() : Boolean;
Description: Only submachine states can have connection point references.
Expression: isSubmachineState implies connection->notEmpty ( )

Signature: submachine_or_regions() : Boolean;
Description: A state is not allowed to have both a submachine and regions.
Expression: isComposite implies not isSubmachineState

Signature: entry_or_exit() : Boolean;
Description: Only entry or exit pseudostates can serve as connection points.
Expression: connectionPoint->forAll(cp|cp.kind = #entry or cp.kind = #exit)

Signature: destinations_or_sources_of_transitions() : Boolean;
Description: The connection point references used as destinations/sources of transitions associated with a submachine state must be defined as entry/exit points in the submachine state machine.
The OCL used here is not normative.
Editor's notes: stateMachine, not statemachine.
Expression: self.isSubmachineState implies (self.connection->forAll (cp | cp.entry->forAll (p | p.stateMachine = self.submachine) and cp.exit->forAll (p | p.stateMachine = self.submachine)))
Original: self.isSubmachineState implies (self.connection->forAll (cp | cp.entry->forAll (p | p.statemachine = self.submachine) and cp.exit->forAll (p | p.statemachine = self.submachine)))

Signature: composite_states() : Boolean;
Description: Only composite states can have entry or exit pseudostates defined.
Expression: connectionPoint->notEmpty() implies isComposite


Signature: redefinitionContext.1() : Classifier;
Description: The redefinition context of a state is the nearest containing statemachine.
Expression: result = let sm = containingStateMachine() in if sm.context->isEmpty() or sm.general->notEmpty() then sm else sm.context endif

Signature: isSubmachineState.1() : Boolean;
Description: Only submachine states can have a reference statemachine.
Expression: result = submachine.notEmpty()

Signature: isSimple.1() : Boolean;
Description: A simple state is a state without any regions.
Expression: result = region.isEmpty()

Signature: isRedefinitionContextValid(redefined : State; ) : Boolean;
Description: The query isRedefinitionContextValid() specifies whether the redefinition contexts of a state are properly related to the redefinition contexts of the specified state to allow this element to redefine the other. The containing region of a redefining state must redefine the containing region of the redefined state.
Expression: result = true

Signature: isOrthogonal.1() : Boolean;
Description: An orthogonal state is a composite state with at least 2 regions
Expression: result = (region->size () > 1)

Signature: isConsistentWith(redefinee : RedefinableElement; ) : Boolean;
Description: The query isConsistentWith() specifies that a redefining state is consistent with a redefined state provided that the redefining state is an extension of the redefined state: A simple state can be redefined (extended) to become a composite state (by adding a region) and a composite state can be redefined (extended) by adding regions and by adding vertices, states, and transitions to inherited regions. All states may add or replace entry, exit, and 'doActivity' actions.
Expression: result = true

Signature: isComposite.1() : Boolean;
Description: A composite state is a state with at least one region.
Expression: result = region.notEmpty()

Signature: containingStateMachine() : StateMachine;
Description: The query containingStateMachine() returns the state machine that contains the state either directly or transitively.
Expression: result = container.containingStateMachine()

Send questions or comments to