org.eclipse.uml2.uml
Interface MultiplicityElement

All Superinterfaces:
Element, EModelElement, EObject, Notifier
All Known Subinterfaces:
ActionInputPin, ConnectorEnd, ExtensionEnd, InputPin, OutputPin, Parameter, Pin, Port, Property, StructuralFeature, ValuePin, Variable

public interface MultiplicityElement
extends Element

A representation of the model object 'Multiplicity Element'. 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.

The following features are supported:

See Also:
UMLPackage.getMultiplicityElement()

Method Summary
 boolean compatibleWith(MultiplicityElement other)
           The operation compatibleWith takes another multiplicity as input.
 ValueSpecification createLowerValue(String name, Type type, EClass eClass)
          Creates a new ValueSpecification, with the specified 'Name', and 'Type', and sets the 'Lower Value' containment reference
 ValueSpecification createUpperValue(String name, Type type, EClass eClass)
          Creates a new ValueSpecification, with the specified 'Name', and 'Type', and sets the 'Upper Value' containment reference
 int getLower()
          Returns the value of the 'Lower' attribute.
 ValueSpecification getLowerValue()
          Returns the value of the 'Lower Value' containment reference
 int getUpper()
          Returns the value of the 'Upper' attribute.
 ValueSpecification getUpperValue()
          Returns the value of the 'Upper Value' containment reference
 boolean includesCardinality(int C)
           The query includesCardinality() checks whether the specified cardinality is valid for this multiplicity.
 boolean includesMultiplicity(MultiplicityElement M)
           The query includesMultiplicity() checks whether this multiplicity includes all the cardinalities allowed by the specified multiplicity.
 boolean is(int lowerbound, int upperbound)
           The operation is determines if the upper and lower bound of the ranges are the ones given.
 boolean isMultivalued()
           The query isMultivalued() checks whether this multiplicity has an upper bound greater than one.
 boolean isOrdered()
          Returns the value of the 'Is Ordered' attribute.
 boolean isUnique()
          Returns the value of the 'Is Unique' attribute.
 int lowerBound()
           The query lowerBound() returns the lower bound of the multiplicity as an integer.
 void setIsOrdered(boolean value)
          Sets the value of the 'Is Ordered' attribute
 void setIsUnique(boolean value)
          Sets the value of the 'Is Unique' attribute
 void setLower(int value)
          Sets the value of the 'Lower' attribute
 void setLowerValue(ValueSpecification value)
          Sets the value of the 'Lower Value' containment reference
 void setUpper(int value)
          Sets the value of the 'Upper' attribute
 void setUpperValue(ValueSpecification value)
          Sets the value of the 'Upper Value' containment reference
 int upperBound()
           The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an unlimited natural.
 boolean validateLowerGe0(DiagnosticChain diagnostics, Map context)
           The lower bound must be a non-negative integer literal.
 boolean validateUpperGeLower(DiagnosticChain diagnostics, Map context)
           The upper bound must be greater than or equal to the lower bound.
 boolean validateUpperGt0(DiagnosticChain diagnostics, Map context)
           A multiplicity must define at least one valid cardinality that is greater than zero.
 boolean validateValueSpecificationConstant(DiagnosticChain diagnostics, Map context)
           If a non-literal ValueSpecification is used for the lower or upper bound, then that specification must be a constant expression.
 boolean validateValueSpecificationNoSideEffects(DiagnosticChain diagnostics, Map context)
           If a non-literal ValueSpecification is used for the lower or upper bound, then evaluating that specification must not have side effects.
 
Methods inherited from interface org.eclipse.uml2.uml.Element
addKeyword, allOwnedElements, applyStereotype, createEAnnotation, createOwnedComment, destroy, getApplicableStereotype, getApplicableStereotypes, getAppliedStereotype, getAppliedStereotypes, getAppliedSubstereotype, getAppliedSubstereotypes, getKeywords, getModel, getNearestPackage, getOwnedComments, getOwnedElements, getOwner, getRelationships, getRelationships, getRequiredStereotype, getRequiredStereotypes, getSourceDirectedRelationships, getSourceDirectedRelationships, getStereotypeApplication, getStereotypeApplications, getTargetDirectedRelationships, getTargetDirectedRelationships, getValue, hasKeyword, hasValue, isStereotypeApplicable, isStereotypeApplied, isStereotypeRequired, mustBeOwned, removeKeyword, setValue, unapplyStereotype, validateHasOwner, validateNotOwnSelf
 
Methods inherited from interface org.eclipse.emf.ecore.EModelElement
getEAnnotation, getEAnnotations
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 

Method Detail

isOrdered

public boolean isOrdered()
Returns the value of the 'Is Ordered' attribute. The default value is "false". For a multivalued multiplicity, this attribute specifies whether the values in an instantiation of this element are sequentially ordered.

Returns:
the value of the 'Is Ordered' attribute.
See Also:
MultiplicityElement.setIsOrdered(boolean), UMLPackage.getMultiplicityElement_IsOrdered()

setIsOrdered

public void setIsOrdered(boolean value)
Sets the value of the 'Is Ordered' attribute.

Parameters:
value - the new value of the 'Is Ordered' attribute.
See Also:
MultiplicityElement.isOrdered()

isUnique

public boolean isUnique()
Returns the value of the 'Is Unique' attribute. The default value is "true". For a multivalued multiplicity, this attributes specifies whether the values in an instantiation of this element are unique.

Returns:
the value of the 'Is Unique' attribute.
See Also:
MultiplicityElement.setIsUnique(boolean), UMLPackage.getMultiplicityElement_IsUnique()

setIsUnique

public void setIsUnique(boolean value)
Sets the value of the 'Is Unique' attribute.

Parameters:
value - the new value of the 'Is Unique' attribute.
See Also:
MultiplicityElement.isUnique()

getUpper

public int getUpper()
Returns the value of the 'Upper' attribute. The default value is "1". Specifies the upper bound of the multiplicity interval.

Returns:
the value of the 'Upper' attribute.
See Also:
MultiplicityElement.setUpper(int), UMLPackage.getMultiplicityElement_Upper()

setUpper

public void setUpper(int value)
Sets the value of the 'Upper' attribute.

Parameters:
value - the new value of the 'Upper' attribute.
See Also:
MultiplicityElement.getUpper()

getLower

public int getLower()
Returns the value of the 'Lower' attribute. The default value is "1". Specifies the lower bound of the multiplicity interval.

Returns:
the value of the 'Lower' attribute.
See Also:
MultiplicityElement.setLower(int), UMLPackage.getMultiplicityElement_Lower()

setLower

public void setLower(int value)
Sets the value of the 'Lower' attribute.

Parameters:
value - the new value of the 'Lower' attribute.
See Also:
MultiplicityElement.getLower()

getUpperValue

public ValueSpecification getUpperValue()
Returns the value of the 'Upper Value' containment reference. The specification of the upper bound for this multiplicity.

Returns:
the value of the 'Upper Value' containment reference.
See Also:
MultiplicityElement.setUpperValue(ValueSpecification), UMLPackage.getMultiplicityElement_UpperValue()

setUpperValue

public void setUpperValue(ValueSpecification value)
Sets the value of the 'Upper Value' containment reference.

Parameters:
value - the new value of the 'Upper Value' containment reference.
See Also:
MultiplicityElement.getUpperValue()

createUpperValue

public ValueSpecification createUpperValue(String name,
                                           Type type,
                                           EClass eClass)
Creates a new ValueSpecification, with the specified 'Name', and 'Type', and sets the 'Upper Value' containment reference.

Parameters:
name - The 'Name' for the new ValueSpecification, or null.
type - The 'Type' for the new ValueSpecification, or null.
eClass - The Ecore class of the ValueSpecification to create.
Returns:
The new ValueSpecification.
See Also:
MultiplicityElement.getUpperValue()

getLowerValue

public ValueSpecification getLowerValue()
Returns the value of the 'Lower Value' containment reference. The specification of the lower bound for this multiplicity.

Returns:
the value of the 'Lower Value' containment reference.
See Also:
MultiplicityElement.setLowerValue(ValueSpecification), UMLPackage.getMultiplicityElement_LowerValue()

setLowerValue

public void setLowerValue(ValueSpecification value)
Sets the value of the 'Lower Value' containment reference.

Parameters:
value - the new value of the 'Lower Value' containment reference.
See Also:
MultiplicityElement.getLowerValue()

createLowerValue

public ValueSpecification createLowerValue(String name,
                                           Type type,
                                           EClass eClass)
Creates a new ValueSpecification, with the specified 'Name', and 'Type', and sets the 'Lower Value' containment reference.

Parameters:
name - The 'Name' for the new ValueSpecification, or null.
type - The 'Type' for the new ValueSpecification, or null.
eClass - The Ecore class of the ValueSpecification to create.
Returns:
The new ValueSpecification.
See Also:
MultiplicityElement.getLowerValue()

validateUpperGt0

public boolean validateUpperGt0(DiagnosticChain diagnostics,
                                Map context)
A multiplicity must define at least one valid cardinality that is greater than zero. upperBound()->notEmpty() implies upperBound() > 0


validateLowerGe0

public boolean validateLowerGe0(DiagnosticChain diagnostics,
                                Map context)
The lower bound must be a non-negative integer literal. lowerBound()->notEmpty() implies lowerBound() >= 0


validateUpperGeLower

public boolean validateUpperGeLower(DiagnosticChain diagnostics,
                                    Map context)
The upper bound must be greater than or equal to the lower bound. (upperBound()->notEmpty() and lowerBound()->notEmpty()) implies upperBound() >= lowerBound()


validateValueSpecificationNoSideEffects

public boolean validateValueSpecificationNoSideEffects(DiagnosticChain diagnostics,
                                                       Map context)
If a non-literal ValueSpecification is used for the lower or upper bound, then evaluating that specification must not have side effects. true


validateValueSpecificationConstant

public boolean validateValueSpecificationConstant(DiagnosticChain diagnostics,
                                                  Map context)
If a non-literal ValueSpecification is used for the lower or upper bound, then that specification must be a constant expression. true


isMultivalued

public boolean isMultivalued()
The query isMultivalued() checks whether this multiplicity has an upper bound greater than one. upperBound()->notEmpty() result = upperBound() > 1


includesCardinality

public boolean includesCardinality(int C)
The query includesCardinality() checks whether the specified cardinality is valid for this multiplicity. upperBound()->notEmpty() and lowerBound()->notEmpty() result = (lowerBound() <= C) and (upperBound() >= C)


includesMultiplicity

public boolean includesMultiplicity(MultiplicityElement M)
The query includesMultiplicity() checks whether this multiplicity includes all the cardinalities allowed by the specified multiplicity. self.upperBound()->notEmpty() and self.lowerBound()->notEmpty() and M.upperBound()->notEmpty() and M.lowerBound()->notEmpty() result = (self.lowerBound() <= M.lowerBound()) and (self.upperBound() >= M.upperBound())


lowerBound

public int lowerBound()
The query lowerBound() returns the lower bound of the multiplicity as an integer. result = if lowerValue->isEmpty() then 1 else lowerValue.integerValue() endif


upperBound

public int upperBound()
The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an unlimited natural. result = if upperValue->isEmpty() then 1 else upperValue.unlimitedValue() endif


compatibleWith

public boolean compatibleWith(MultiplicityElement other)
The operation compatibleWith takes another multiplicity as input. It checks if one multiplicity is compatible with another. result = Integer.allInstances()->forAll(i : Integer | self.includesCardinality(i) implies other.includesCardinality(i))


is

public boolean is(int lowerbound,
                  int upperbound)
The operation is determines if the upper and lower bound of the ranges are the ones given. result = (lowerbound = self.lowerbound and upperbound = self.upperbound)


Copyright 2003, 2006 IBM Corporation and others.
All Rights Reserved.