Software Disclaimer

Abstract Class UML 2.3::MultiplicityElement

Description:

A multiplicity is a definition of an inclusive interval of non-negative integers beginning with a lower bound and ending with a (possibly infinite) upper bound. A multiplicity element embeds this information to specify the allowable cardinalities for an instantiation of this element.

Direct Superclasses: Element

Direct Subclasses: Variable, StructuralFeature, Pin, Parameter, ConnectorEnd

Class Precedence List: MultiplicityElement, Element

Properties:

isOrdered : Boolean (1 1); -- source MultiplicityElement
isUnique : Boolean (1 1); -- source MultiplicityElement
lower : Integer (0 1); -- source MultiplicityElement
lowerValue : ValueSpecification (0 1); -- source MultiplicityElement
upper : UnlimitedNatural (0 1); -- source MultiplicityElement
upperValue : ValueSpecification (0 1); -- source MultiplicityElement
ownedComment : Comment (0 *); -- source Element
ownedElement : Element (0 *); -- source Element
owner : Element (0 1); -- source Element

Constraints:

Signature: CMOF_14_3_13() : Boolean;
Description: 14.3 [13] The values of MultiplicityElement::lowerValue and upperValue must be of kind LiteralInteger and LiteralUnlimitedNatural respectively see also: https://sites.google.com/site/metamodelingantipatterns/catalog/mof/multiplicity-element-has-non-integer-lower-value see also: https://sites.google.com/site/metamodelingantipatterns/catalog/mof/multiplicity-element-has-non-unlimited-natural-upper-value
Expression: lowerValue.oclIsKindOf(LiteralInteger) and upperValue.oclIsKindOf(LiteralUnlimitedNatural)

Signature: value_specification_no_side_effects() : Boolean;
Description: If a non-literal ValueSpecification is used for the lower or upper bound, then evaluating that specification must not have side effects.
Expression: true

Signature: value_specification_constant() : Boolean;
Description: If a non-literal ValueSpecification is used for the lower or upper bound, then that specification must be a constant expression.
Expression: true

Signature: upper_ge_lower() : Boolean;
Description: The upper bound must be greater than or equal to the lower bound.
Expression: (upperBound()->notEmpty() and lowerBound()->notEmpty()) implies upperBound() >= lowerBound()

Signature: lower_ge_0() : Boolean;
Description: The lower bound must be a non-negative integer literal.
The OCL used here is not normative.
Editor's notes: Rewrite was probably pointless. Needs examination.
Expression: not lowerBound().oclIsUndefined() implies lowerBound() >= 0
Original: lowerBound()->notEmpty() implies lowerBound() >= 0

Operations:

Signature: upperBound() : UnlimitedNatural;
Description: The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an unlimited natural.
The OCL used here is not normative.
Editor's notes: Rewrite was probably pointless. Needs examination.
Expression: result = if upperValue.oclIsUndefined() then 1 else upperValue.unlimitedValue() endif
Original: result = if upperValue->isEmpty() then 1 else upperValue.unlimitedValue() endif

Signature: upper.1() : UnlimitedNatural;
Description: The derived upper attribute must equal the upperBound.
Expression: result = upperBound()

Signature: lowerBound() : Integer;
Description: The query lowerBound() returns the lower bound of the multiplicity as an integer.
Expression: result = if lowerValue->isEmpty() then 1 else lowerValue.integerValue() endif

Signature: lower.1() : Integer;
Description: The derived lower attribute must equal the lowerBound.
Expression: result = lowerBound()

Signature: isMultivalued() : Boolean;
Description: The query isMultivalued() checks whether this multiplicity has an upper bound greater than one.
Expression: result = upperBound() > 1

Signature: is(lowerbound : Integer; upperbound : Integer; ) : Boolean;
Description: The operation is determines if the upper and lower bound of the ranges are the ones given.
The OCL used here is not normative.
Editor's notes: The names of the attributes are upper and lower, not upperbound and lowerbound.
Expression: result = (lowerbound = self.lower and upperbound = self.upper)
Original: result = (lowerbound = self.lowerbound and upperbound = self.upperbound)

Signature: includesMultiplicity(M : MultiplicityElement; ) : Boolean;
Description: The query includesMultiplicity() checks whether this multiplicity includes all the cardinalities allowed by the specified multiplicity.
Expression: result = (self.lowerBound() <= M.lowerBound()) and (self.upperBound() >= M.upperBound())

Signature: includesCardinality(C : Integer; ) : Boolean;
Description: The query includesCardinality() checks whether the specified cardinality is valid for this multiplicity.
Expression: result = (lowerBound() <= C) and (upperBound() >= C)

Signature: compatibleWith(other : MultiplicityElement; ) : Boolean;
Description: The operation compatibleWith takes another multiplicity as input. It checks if one multiplicity is compatible with another.
The OCL used here is not normative.
Editor's notes: This is supposed to look at the population of Intergers in the model? They aren't boxed in my implementation.
Expression: Set{}
Original: result = Integer.allInstances()->forAll(i : Integer | self.includesCardinality(i) implies other.includesCardinality(i))



Send questions or comments to xmi-interop@omg.org.