You can set the concurrency, multiplicity, type, and visibility properties of model elements.
The concurrency property of an operation in an active object specifies how a system behaves when another active object calls the operation.
Concurrency value | Description |
---|---|
sequential | This value is the default for an operation’s concurrency property. Conflicts can occur between concurrent processes. Calling objects should coordinate with each other so that only one call to an operation occurs at a time. |
guarded | Multiple calls to an operation can occur simultaneously, only one of which is allowed to proceed. Subsequent calls are blocked until the first call completes. System designers should ensure that applications can simultaneously block calls to operations. |
concurrent | Multiple calls to an operation can occur and proceed simultaneously. |
The multiplicity property applies to several model elements, but particularly to attributes that belong to classifiers, composite structure diagram parts, and to associations between classifiers. An attribute’s multiplicity tells you how many values you can associate with that model element. For example, you can define an attribute called Attribute1 of data type Integer that can have a range of integer vales from 0 to 3 such as, Attribute1 : Integer [0..3]. A multiplicity value, or range of values, on an association end shows the number of objects that can participate in the relationship. A multiplicity specification can be a single positive integer, a range of positive integers (that are specified by lower and upper limits), or a comma-separated list of positive integers. An asterisk indicates an unlimited upper limit. For example, the following table shows several multiplicity specifications:
Example | Description |
---|---|
1 | Exactly one |
0..1 | Zero or one |
* | Any number, including zero |
1.. | One or more |
In a context with parameters such as a template, the upper and lower limits of a multiplicity specification can be expressions that evaluate to integer values.
When multiplicity values are associated with an attribute, they appear in brackets, as in the following example:
When multiplicity values are associated with parts in composite structure diagrams, they appear in brackets, as in the following example:
When multiplicity values are associated with association ends, they are shown beside the association ends to which they apply, as in the following example:
You can specify the type of an attribute, an operation, a parameter, and an association end. The type that you specify can be a class; a UML data type such as integer, string, unlimited natural, or Boolean; or an interface.
Visibility determines whether model elements can gain access to other model elements from within the same class, the same package, an inheritance structure, or from anywhere in an entire system. You can specify visibility for the following model elements:
For example, other classes can see and use the attributes and operations in a class with public visibility. If attributes and operations have private visibility, only the class that contains them can see and use them.
Level | Icons for attributes | Icons for operations | Text symbol | Description |
---|---|---|---|---|
Public | ![]() |
![]() |
+ | Model elements that can see the container can also see and use the public model element. |
Private | ![]() |
![]() |
- | Model elements that are in the same container can see and use a private model element of that container. |
Protected | ![]() |
![]() |
# | Model elements that are in the same container, or in a descendant of the container, can see and use a protected model element of that container. |
Package | ![]() |
![]() |
~ | Model elements that are in the same package as the container can see and use a model element with package visibility. |