Previous Table of Contents Next


9.13.1 MultiplicityElement


   MultiplicityElement is specialized to support the use of value specifications to define each bound of the multiplicity.

   Generalizations

   Attributes

   Associations

   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()

endif

   [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()

endif

   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'