Package com.nomagic.magicdraw.uml2
Class Links
java.lang.Object
com.nomagic.magicdraw.uml2.Links
Convenient static methods to work with Link (InstanceSpecification) elements.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Association
findRelatedAssociation
(Slot slot) Association property of Slot defining featurestatic Association
If owning slot defining feature is association member end - returns that associationstatic Collection<InstanceSpecification>
findRelatedLinks
(InstanceValue instanceValue) If Instance value corresponds to connected instance, returns link which connects two instances.static Collection<InstanceSpecification>
findRelatedLinks
(Slot slot) If slot value corresponds to connected instance, returns link which connects two instances.static Collection<Association>
getAssociationsOfLink
(InstanceSpecification instance) Gets Association classifier from InstanceSpecification, if exists.static Element
Return client element from InstanceSpecification (link) Custom way to get relationship info from Linkstatic Element
Returns supplier element from InstanceSpecification (Link)static Collection<Classifier>
Checks if link is connected to instances according to its association; Check is done by checking if instance values has classifiers same as association member end typesstatic boolean
isLink
(InstanceSpecification instance) Checks if InstanceSpecification is Link.static void
moveSlotReference
(Property stableEnd, Property movedEnd, InstanceSpecification source, InstanceSpecification destination, InstanceSpecification stableInstance) Updates slots when link ends were changedstatic void
setConnectedInstance
(InstanceSpecification link, Element value, Property memberEnd) static void
setLinkClientElement
(InstanceSpecification link, Element value) Sets client element from InstanceSpecification (link)static void
setLinkSupplierElement
(InstanceSpecification link, Element value) Sets supplier element for InstanceSpecification (link) Custom way to make Link behavior as relationship - add client and supplier info to the slotsstatic void
During link end change, sometimes opposite side instance values are defined, and they need to be switched
-
Constructor Details
-
Links
public Links()
-
-
Method Details
-
getClientElement
Return client element from InstanceSpecification (link) Custom way to get relationship info from Link- Parameters:
link
- link- Returns:
- Client element
-
getSupplierElement
Returns supplier element from InstanceSpecification (Link)- Parameters:
link
- link- Returns:
- supplier element
-
setConnectedInstance
public static void setConnectedInstance(InstanceSpecification link, Element value, Property memberEnd) -
synchronizeLinkSlotValuesByType
During link end change, sometimes opposite side instance values are defined, and they need to be switched- Parameters:
link
- synchronized link
-
hasCorrectClassifier
Checks if link is connected to instances according to its association; Check is done by checking if instance values has classifiers same as association member end types- Parameters:
link
- link (only links are analyzed)- Returns:
- empty list if OK, wrong classifiers if not
-
moveSlotReference
public static void moveSlotReference(Property stableEnd, Property movedEnd, InstanceSpecification source, InstanceSpecification destination, InstanceSpecification stableInstance) Updates slots when link ends were changed- Parameters:
stableEnd
- association member end, which is representing link end does not movemovedEnd
- association member end, which is representing link end movessource
- disconnected instancedestination
- connected instancestableInstance
- stable instance (which end was not changed)
-
setLinkClientElement
Sets client element from InstanceSpecification (link)- Parameters:
link
- linkvalue
- new client value
-
setLinkSupplierElement
Sets supplier element for InstanceSpecification (link) Custom way to make Link behavior as relationship - add client and supplier info to the slots- Parameters:
link
- linkvalue
- new supplier value
-
isLink
Checks if InstanceSpecification is Link.- Parameters:
instance
- instance to check- Returns:
- true if it is Link element - it has Association as classifier or has a Link symbol in diagram
-
getAssociationsOfLink
Gets Association classifier from InstanceSpecification, if exists.- Parameters:
instance
- Link instance- Returns:
- Associations or empty collection
-
findRelatedLinks
If slot value corresponds to connected instance, returns link which connects two instances.- Parameters:
slot
- instance slot- Returns:
- connecting links
-
findRelatedLinks
public static Collection<InstanceSpecification> findRelatedLinks(@CheckForNull InstanceValue instanceValue) If Instance value corresponds to connected instance, returns link which connects two instances.- Parameters:
instanceValue
- instance value- Returns:
- connecting links
-
findRelatedAssociation
@CheckForNull public static Association findRelatedAssociation(@CheckForNull ValueSpecification value) If owning slot defining feature is association member end - returns that association- Parameters:
value
- slot instance value- Returns:
- association which property is defining feature for instance value owning slot or
null
-
findRelatedAssociation
Association property of Slot defining feature- Parameters:
slot
- slot- Returns:
- Association of defining feature or
null
-