• 【状态机】行为状体机和协议状态机


     前言:

      The StateMachines package defines a set of concepts that can be used for modeling discrete event-driven Behaviors using a finite state-machine formalism. In addition to expressing the Behavior of parts of a system (e.g., the Behavior of Classifier instances), state machines can also be used to express the valid interaction sequences, called protocols, for parts of a system. These two kinds of StateMachines are referred to as behavior state machines and protocol state machines respectively. The specific form of finite 

    行为状态机:

      行为状态机,就是我平时比较熟悉的,搞的状态机。

    协议状态机:

      A ProtocolStateMachine is always defined in the context of a Classifier. It specifies which BehavioralFeatures of that Classifier can be invoked in a given protocol state and under what conditions, thereby specifying allowed invocation sequences. In this manner, a specification of the lifecycle of an instance of the Classifier is defined from an external perspective.

      协议状态机基本用于定义一个类目的上下文,它规定了在给定的状态和给定的提交下,到底什么样的行为特征会被调用和触发,从而它可以说明一种类目的调用次序。因此,它所体现的一个类目实例的生命周期是基本从外部视觉出发所形成的;

      ProtocolStateMachines help define the order in which BehavioralFeatures of a Classifier are invoked by specifying:

    • the behavioral context (i.e., which states and pre-conditions) in which they can be validly invoked,
    • the valid orderings of invocations
    • the expected outcomes (post-conditions) of invocations.

      ProtocolStateMachine present an external view of the owning Classifier as perceived by its collaborators. This extends beyond what can be captured via pre- and post-conditions on individual BehavioralFeatures, as ProtocolStateMachines also specify the valid orderings of invocations of the different features. This is achieved by a state machine specification in which the transition triggers are feature invocations and the guards of the transitions (ProtocolTransitions) specify the pre-condition that must apply for the invocation to be valid. The states (ProtocolStates) of this state machine, being a consequence of past invocation sequences, capture the state of the protocol and are also a form of pre-condition.

       NOTE. Because ProtocolStateMachines provide a “black box” view of the behavior of a Classifier, their States may not necessarily correspond to the States of internal behavioral StateMachines.

       因为协议状态机提供了一个类目行为的黑盒子的视觉,所以它的状态是不需要和内部行为状态一一对应的

      上图所示,只有在S1状态下的C1条件,才可以出发m1,只要触发了m1,那么就必然会使得类目的状态变成S2,而且条件C2成立。

    参考资料:  

    《OMG Unified Modeling Language TM (OMG UML) Version 2.5》

     URL:http://www.omg.org/spec/UML/2.5

    -------------------------------- 优秀、是一种习惯 、、、、、、、、、、、、、、、
  • 相关阅读:
    CRM更新行数量汇总的一些注意点
    [转]IT人从业方向
    地球撞击
    如何将Dynamic CRM Activities添加到VS工具箱
    linux本地 yum环境建立
    【转】根据条件修改GridView命令按钮显示的文字
    【转】Asp.net 2.0三层架构的构建与理解
    GridView的常用用法总结说明
    IE中的奇怪问题
    解决打不开 RSA 密钥容器 即:加密web.config中的内容
  • 原文地址:https://www.cnblogs.com/iCanhua/p/15034129.html
Copyright © 2020-2023  润新知