MultiplicityElement (specialized)

Description

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

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 Ele-

ment::ownedElement.

upperValue: ValueSpecification [0..1] The specification of the upper bound for this multiplicity. Subsets Ele-

ment::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() then

    1

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

    1

    elseupperValue.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 71) 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> `}' ]
multiplicity_range ::= [ lower `..' ] upper
lower ::= integer | value_specification
upper ::= unlimited_natural | `*' | value_specification
<order_designator> ::= ordered | unordered
<uniqueness_designator> ::= unique | nonunique