Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the knowledge points of the protocol state machine

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what are the knowledge points of the protocol state machine". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Summary

The protocol state machine is used to represent the protocol that uses the method. The protocol state machine represents the legitimate sequence of events that must be followed by the behavior of the associated behavior category. State machine notation is a simple way to define the invocation order of the behavior characteristics of a category.

Protocol state machines can be associated with categories, interfaces, and ports.

14.4.2 Abstract Syntax

Semantic meaning

Protocol state machine

The protocol state machine is always defined in the context of the category. It defines the class purpose in a given protocol state, under what conditions, which behavior characteristics can be invoked. Thus, the specification for the life cycle of an instance of the category is defined from an external point of view.

The protocol state machine helps define the order in which the behavior characteristics of the category are invoked, which makes it clear:

The context of the behavior when they can be called correctly (that is, which state and precondition)

Correct invocation order

Expected call output (post condition)

The protocol state machine presents an external view of the category containing the protocol state machine to the collaborator. This extension is based on what can be captured by the pre-conditions and post-conditions of independent behavior characteristics, and the protocol state machine can also define the correct order of calls for different characteristics. This is achieved through the state machine definition, in this definition, in order to ensure the correctness of the call, the trigger condition of the function call and the guardianship condition of the migration definition must be used to ensure the correctness of the call. As a result of past call sequences, the state of the state machine (protocol state) captures the state of the protocol and is also a form of precondition.

Because the protocol state machine provides a "black box" view of the category behavior, the state does not have to correspond to the state of the internal behavior state machine.

Protocol state machines can take different forms:

Declarative protocol state machine, which defines the effective migration of behavior feature invocation. The effect of behavior feature invocation is not defined. The definition of this type only provides a convention to the users of the following categories.

An executable (executable) protocol state machine that defines the occurrence of all events that an object can accept and handle and the migration they trigger. In this case, the proper behavioral characteristics of the invocation migration must exactly match the triggered migration or runtime exception. The result of the call executed by the method is associated with the behavior characteristics of the called.

The definitions of the two interpretations are the same, the only difference is that the latter interpretation provides direct dynamic meaning.

More complex forms encountered in behavioral state machines, such as composite migration, sub-state machines, composite states, concurrent orthogonal regions, etc., can also be used in protocol state machines. For example, a concurrent region can be used to represent a situation where an instance has multiple active states at the same time. Sub-state machines and composite migrations can be used to decompose complex protocol state machines.

A category can have multiple protocol state machines. For example, the following scenario: a category has multiple parents (categories), each has its own protocol state machine, and the protocols are orthogonal. Another way is to have only one protocol state machine, but contain different state machines in its concurrency area.

State in ProtocolStateMachines (state in the protocol state machine)

The state of the protocol state machine is exposed to the user of their context category. A protocol state represents an externally visible stability of its context category: when an instance of a class purpose does not handle any behavior feature calls, the user of that instance always knows its state composition.

The state of the protocol state machine does not allow you to define entry, exit, and doActivity behaviors.

Protocol migration

Protocol migration defines the migration allowed by the behavior characteristics of context categories when called. Protocol migration has the following characteristics:

A pre-condition (preCondition), which specializes the guard attribute of Transition

Define prerequisites for migrated guardianship attributes

A trigger

Trigger condition

A post-condition (postCondition).

Post-condition.

Protocol migration defines the association (reference) characteristics that the instance of the context category can be invoked. If it is in the initial state, has a guardianship condition, and is triggered by the migration completion, then the instance will be in the target state with post-conditions.

Protocol migration has no associated effect behavior. As a result of the behavior characteristic invocation, the protocol migration means the execution of the method associated with the behavior characteristic being called. In the case of other types of trigger conditions, the impact is undefined unless the migration leads to another state that meets the specific precondition, and any behavior associated with the migration is not considered.

Unexpectedly trigger acceptance

An accepted explanation for the occurrence of an event that does not match the current state, state invariant, or precondition is not defined (that is, it can be ignored, rejected, or postponed; raise an exception; or terminate the execution of the application as an error). Semantically, it corresponds to the violation of preconditions, and there is no predefined behavior for it in UML.

Unexpected behavior

As an unexpected result of the migration (incorrect finished state, or finished state invariant, or post-condition), the interpretation of unexpected behavior is also undefined. However, it should be interpreted as an error in the implementation of the protocol state machine.

The equivalence of pre-and post-conditions of operation

Semantically, protocol migration can be explained from two aspects: pre-condition and post-condition of operation. For example, the migration in figure 14.42 can be explained as follows:

1 The operation "M1" can be called on an instance when it is in the ProtocolState "S1" under the condition "C1."

Operation M1 can be called when the instance is in the protocol state "S1" and the condition "C1" is met.

2 When "M1" is called in the ProtocolState "S1" under the condition "C1," then the ProtocolState "S2" must be reached under the condition "C2."

When in the protocol state "S1" s, "M1" is called, then when the condition "C2" is met, the protocol state "S2" must be reached.

Operations referenced by multiple migrations

Figure 14.43 shows an example where multiple migrations can reference the same operation in a protocol state machine. In this case, all the pre-and post-conditions are grouped into the pre-(/ post) conditions of the operation, as follows

Operation M1 ()

Pre: in state S1 and condition C1

Or

In state S3 and condition C3

Post: if the initial condition was "in state S1 and condition C1"

Then in S2 and C2

Else

If the initial condition was "in state S3 and condition C3"

Then in S4 and C4

The protocol state machine defines all protocol migrations for each behavior feature referenced by its migration.

No referenced operation

If the behavior feature is not referenced by any behavior feature, the operation can be invoked by any state of the protocol state machine without changing the current state or pre / post conditions.

Use other types of events in the protocol state machine

In addition to invoking behavior characteristics, you can use other events to represent the behavior of the protocol state machine. Triggers that are not behavioral feature calls can be used to define protocol migration. This definition is a requirement for the external environment of the behavior state machine. That is, it is appropriate to send an event occurrence to the context category only if the conditions defined by the protocol state machine are met. The exact semantic interpretation related to this has not been defined.

The agreement is consistent

A protocol state machine can be defined as a more specific protocol state machine. The protocol unanimously declares the specific protocol state machine and defines a protocol, which is consistent with the protocol defined by the universal protocol state machine.

Protocol state machines fall into the category. The category has a generic state machine and is usually associated with a specific state machine through generalization and implementation.

The agreement represents a declaration that all rules and constraints (state invariants, pre / post conditions for operations referenced by the protocol state machine) will apply to the specific protocol state machine.

Notation

Protocol state machine

The notation of the protocol state machine is very similar to the behavioral state machine. The protocol state machine diagram is graphically distinguished only by the «protocol »keyword near the state machine name.

The literal expression of the invariant associated with the state in the protocol state machine is represented by wrapping it in parentheses and placing it after or below the state name.

Protocol migration

Use the notation in the usual state machine. The difference is that the effect behavior is not defined and there can be post-conditions. The syntax of the post condition is the same as that of the guardianship condition, but the final representation of the transfer syntax.

This is the end of the content of "what are the knowledge points of the protocol state machine". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report