Type | Parameters | Why is it useful? | |
ref | None | Represents an interaction that is defined elsewhere in the model. Helps you manage a large diagram by splitting, and potentially reusing, a collection of interactions. Similar to the reuse modeled when the <<include>> use case relationship is applied. | 表示在model中的其他地方的交互。通过分割来管理大型的图,便于重用和交互的集合。 |
assert | None | Specifies that the interactions contained within the fragment box must occur exactly as they are indicated; otherwise the fragment is declared invalid and an exception should be raised. Works in a similar fashion to the assert statement in Java. Useful when specifying that every step in an interaction must occur successfully, i.e., when modeling a transaction. | 断言,描述fragments中的交互准确的"出现",否则fragments就是不合法的,并且出现一个异常。类似java的断言。主要用来描述每一步必须严格执行的过程,例如事务。 |
loop | min times, | Loops through the interactions contained within the fragment a specified number of times until the guard condition is evaluated to false. Very similar to the Java and C# for(..) loop. Useful when you are trying execute a set of interactions a specific number of times. | |
max times, | |||
[guard_condition] | |||
break | None | If the interactions contained within the break fragment occur, then any enclosing interaction, most commonly a loop fragment , should be exited. Similar to the break statement in Java and C#. | |
alt | [guard_condition1] ... | Depending on which guard condition evaluates to true first, the corresponding sub-collection of interactions will be executed. Helps you specify that a set of interactions will be executed only under certain conditions. Similar to an if(..) else statement in code. | |
[guard_condition2] ... | |||
[else] | |||
opt | [guard_condition] | The interactions contained within this fragment will execute only if the guard condition evaluates to true. Similar to a simple if(..) statement in code with no corresponding else. Especially useful when showing steps that have been reused from another use case's sequence diagrams, where <<extend>> is the use case relationship. | |
neg | None | Declares that the interactions inside this fragment are not to be executed, ever. Helpful if you are just trying to mark a collection of interactions as not executed until you're sure that those interactions can be removed. Most useful if you happen to be lucky enough to be using an Executable UML tool where your sequence diagrams are actually being run. Also can be helpful to show that something cannot be done, e.g., when you want to show that a participant cannot call read( ) on a socket after close( ).Works in a similar fashion to commenting out some method calls in code. | |
par | None | Specifies that interactions within this fragment can happily execute in parallel. This is similar to saying that there is no need for any thread-safe locking required within a set of interactions. | |
region | None | Interactions within this type of fragment are said to be part of a critical region. A critical region is typically an area where a shared participant is updated. Combined with parallel interactions, specified using the par fragment type, you can model where interactions are not required to be thread- or process-safe (par fragment) and where locks are required to prevent parallel interactions interleaving (region fragment ). Has similarities synchronized blocks and object locks in Java. |