Previous | Table of Contents | Next |
MultiplicityElement is specialized to support the use of value specifications to define each bound of the multiplicity.
Generalizations
• “MultiplicityElement? on page 64
• “Element (as specialized)? on page 74
Attributes
• / lower : Integer [0..1] Specifies the lower bound of the multiplicity interval, if it is expressed as an integer. This is a redefinition of the corresponding property from Multiplicities.
• / upper : UnlimitedNatural [0..1] Specifies the upper bound of the multiplicity interval, if it is expressed as an unlimited natural. This is a redefinition of the corresponding property from Multiplicities.
Associations
• lowerValue: ValueSpecification [0..1] The specification of the lower bound for this multiplicity. Subsets Element::ownedElement.
• upperValue: ValueSpecification [0..1] The specification of the upper bound for this multiplicity. Subsets Element::ownedElement.
Constraints
[1] If a ValueSpecification is used for the lower or upper bound, then evaluating that specification must not have side effects.
Cannot be expressed in OCL.
[2] If a ValueSpecification is used for the lower or upper bound, then that specification must be a constant expression.
Cannot be expressed in OCL.
[3] The derived lower attribute must equal the lowerBound.
lower = lowerBound()
[4] The derived upper attribute must equal the upperBound.
upper = upperBound()
Additional Operations
[1] The query lowerBound() returns the lower bound of the multiplicity as an integer.
MultiplicityElement::lowerBound() : [Integer];lowerBound =if lowerValue->isEmpty() then1
else
lowerValue.integerValue()
[2] The query upperBound() returns the upper bound of the multiplicity as an unlimited natural.
MultiplicityElement::upperBound() : [UnlimitedNatural];upperBound =if upperValue->isEmpty() then1
else
upperValue.unlimitedValue()
Semantics
The lower and upper bounds for the multiplicity of a MultiplicityElement may be specified by value specifications, such as
(side-effect free, constant) expressions.
Notation
The notation for Multiplicities::MultiplicityElement (see
page 64) is extended to support value specifications for the
bounds.
The following BNF defines the syntax for a multiplicity string, including support for the presentation options.
multiplicity ::= <multiplicity_range> [ ‘{‘ <order_designator> [',' <uniqueness-designator>] '}']<multiplicity-range> ::= [<lower> '..'] <upper><lower> ::= <integer> | <value-specification><upper> ::= '*' | <value-specification><order-designator> :: = 'ordered' | 'unordered' <uniqueness-designator> ::= 'unique' | 'nonunique'