Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 40586 Details for
Bug 80307
Validation Rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
connectorOperations validation rules updated
validationPatch_060508.txt (text/plain), 8.21 KB, created by
James Bruck
on 2006-05-08 10:19:18 EDT
(
hide
)
Description:
connectorOperations validation rules updated
Filename:
MIME Type:
Creator:
James Bruck
Created:
2006-05-08 10:19:18 EDT
Size:
8.21 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.uml2.uml >Index: src/org/eclipse/uml2/uml/internal/operations/ConnectorOperations.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ConnectorOperations.java,v >retrieving revision 1.8 >diff -u -r1.8 ConnectorOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ConnectorOperations.java 2 May 2006 20:18:32 -0000 1.8 >+++ src/org/eclipse/uml2/uml/internal/operations/ConnectorOperations.java 8 May 2006 14:18:22 -0000 >@@ -163,37 +163,24 @@ > */ > public static boolean validateRoles(Connector connector, > DiagnosticChain diagnostics, Map context) { >- EList ends = connector.getEnds(); >- >- if (ends.size() == 2) { >- ConnectorEnd fromEnd = (ConnectorEnd) ends.get(0); >- ConnectableElement fromRole = fromEnd.getRole(); >- Element fromOwner = null; >- >- if (fromRole instanceof Port) { >- fromOwner = fromEnd.getPartWithPort().getOwner(); >- } else { >- fromOwner = fromRole == null >- ? null >- : fromRole.getOwner(); >- } >- >- ConnectorEnd toEnd = (ConnectorEnd) ends.get(1); >- ConnectableElement toRole = toEnd.getRole(); >- Element toOwner = null; > >- if (toRole instanceof Port) { >- toOwner = toEnd.getPartWithPort().getOwner(); >+ Iterator ends = connector.getEnds().iterator(); >+ while (ends.hasNext()) { >+ ConnectorEnd end = (ConnectorEnd) ends.next(); >+ ConnectableElement role = end.getRole(); >+ Element roleOwner = null; >+ if (role instanceof Port) { >+ Property partWithPort = end.getPartWithPort(); >+ if (partWithPort != null) { >+ roleOwner = partWithPort.getOwner(); >+ } else { >+ roleOwner = role.getOwner(); >+ } > } else { >- toOwner = toRole == null >- ? null >- : toRole.getOwner(); >+ roleOwner = role.getOwner(); > } >- > Element connectorOwner = connector.getOwner(); >- >- if (connectorOwner != fromOwner || connectorOwner != toOwner) { >- >+ if (connectorOwner != roleOwner) { > if (diagnostics != null) { > diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING, > UMLValidator.DIAGNOSTIC_SOURCE, >@@ -202,11 +189,9 @@ > getMessageSubstitutions(context, connector)), > new Object[]{connector})); > } >- > return false; > } > } >- > return true; > } > >@@ -226,21 +211,21 @@ > if (connector.getKind() == ConnectorKind.DELEGATION_LITERAL > && ends.size() == 2) { > >- ConnectableElement fromRole = ((ConnectorEnd) ends.get(0)) >+ ConnectableElement role1 = ((ConnectorEnd) ends.get(0)) > .getRole(); >- Collection fromRequired = ConnectableElementOperations >- .getRequiredInterfaces(fromRole); >- Collection fromProvided = ConnectableElementOperations >- .getProvidedInterfaces(fromRole); >- >- ConnectableElement toRole = ((ConnectorEnd) ends.get(1)).getRole(); >- Collection toRequired = ConnectableElementOperations >- .getRequiredInterfaces(toRole); >- Collection toProvided = ConnectableElementOperations >- .getProvidedInterfaces(toRole); >+ Collection required1 = ConnectableElementOperations >+ .getRequiredInterfaces(role1); >+ Collection provided1 = ConnectableElementOperations >+ .getProvidedInterfaces(role1); >+ >+ ConnectableElement role2 = ((ConnectorEnd) ends.get(1)).getRole(); >+ Collection required2 = ConnectableElementOperations >+ .getRequiredInterfaces(role2); >+ Collection provided2 = ConnectableElementOperations >+ .getProvidedInterfaces(role2); > >- if (intersect(toProvided, fromRequired) >- || intersect(fromProvided, toRequired)) { >+ if (intersect(provided2, required1) >+ || intersect(provided1, required2)) { > > if (diagnostics != null) { > diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING, >@@ -275,24 +260,24 @@ > if (connector.getKind() == ConnectorKind.DELEGATION_LITERAL > && ends.size() == 2) { > >- ConnectorEnd fromEnd = (ConnectorEnd) ends.get(0); >- ConnectableElement fromRole = fromEnd.getRole(); >+ ConnectorEnd end1 = (ConnectorEnd) ends.get(0); >+ ConnectableElement role1 = end1.getRole(); > >- ConnectorEnd toEnd = (ConnectorEnd) ends.get(1); >- ConnectableElement toRole = toEnd.getRole(); >+ ConnectorEnd end2 = (ConnectorEnd) ends.get(1); >+ ConnectableElement role2 = end2.getRole(); > >- Collection fromProvided = ConnectableElementOperations >- .getProvidedInterfaces(fromRole); >+ Collection provided1 = ConnectableElementOperations >+ .getProvidedInterfaces(role1); > >- if (!fromProvided.isEmpty() && !(toRole instanceof Port) >- && toRole instanceof Property) { >+ if (!provided1.isEmpty() && !(role2 instanceof Port) >+ && role2 instanceof Property) { > >- Type toType = ((Property) toRole).getType(); >+ Type toType = ((Property) role2).getType(); > > if (toType instanceof BehavioredClassifier > && (!((BehavioredClassifier) toType) > .getAllImplementedInterfaces() >- .containsAll(fromProvided))) { >+ .containsAll(provided1))) { > > if (diagnostics != null) { > diagnostics >@@ -334,25 +319,25 @@ > if (connector.getKind() == ConnectorKind.DELEGATION_LITERAL > && ends.size() == 2) { > >- ConnectableElement fromRole = ((ConnectorEnd) ends.get(0)) >+ ConnectableElement role1 = ((ConnectorEnd) ends.get(0)) > .getRole(); >- Collection fromRequired = ConnectableElementOperations >- .getRequiredInterfaces(fromRole); >- Collection fromProvided = ConnectableElementOperations >- .getProvidedInterfaces(fromRole); >- >- ConnectableElement toRole = ((ConnectorEnd) ends.get(1)).getRole(); >- Collection toRequired = ConnectableElementOperations >- .getRequiredInterfaces(toRole); >- Collection toProvided = ConnectableElementOperations >- .getProvidedInterfaces(toRole); >+ Collection required1 = ConnectableElementOperations >+ .getRequiredInterfaces(role1); >+ Collection provided1 = ConnectableElementOperations >+ .getProvidedInterfaces(role1); >+ >+ ConnectableElement role2 = ((ConnectorEnd) ends.get(1)).getRole(); >+ Collection required2 = ConnectableElementOperations >+ .getRequiredInterfaces(role2); >+ Collection provided2 = ConnectableElementOperations >+ .getProvidedInterfaces(role2); > >- if (!fromProvided.isEmpty() && !toProvided.isEmpty()) { >- result = result && intersect(fromProvided, toProvided); >+ if (!provided1.isEmpty() && !provided2.isEmpty()) { >+ result = result && intersect(provided1, provided2); > } > >- if (!fromRequired.isEmpty() && !toRequired.isEmpty()) { >- result = result && intersect(fromRequired, toRequired); >+ if (!required1.isEmpty() && !required2.isEmpty()) { >+ result = result && intersect(required1, required2); > } > > if (!result && diagnostics != null) { >@@ -420,21 +405,21 @@ > if (connector.getKind() == ConnectorKind.ASSEMBLY_LITERAL > && ends.size() == 2) { > >- ConnectableElement fromRole = ((ConnectorEnd) ends.get(0)) >+ ConnectableElement role1 = ((ConnectorEnd) ends.get(0)) > .getRole(); >- Collection fromRequired = ConnectableElementOperations >- .getRequiredInterfaces(fromRole); >- Collection fromProvided = ConnectableElementOperations >- .getProvidedInterfaces(fromRole); >- >- ConnectableElement toRole = ((ConnectorEnd) ends.get(1)).getRole(); >- Collection toRequired = ConnectableElementOperations >- .getRequiredInterfaces(toRole); >- Collection toProvided = ConnectableElementOperations >- .getProvidedInterfaces(toRole); >+ Collection required1 = ConnectableElementOperations >+ .getRequiredInterfaces(role1); >+ Collection provided1 = ConnectableElementOperations >+ .getProvidedInterfaces(role1); >+ >+ ConnectableElement role2 = ((ConnectorEnd) ends.get(1)).getRole(); >+ Collection required2 = ConnectableElementOperations >+ .getRequiredInterfaces(role2); >+ Collection provided2 = ConnectableElementOperations >+ .getProvidedInterfaces(role2); > >- if (!intersect(fromProvided, toRequired) >- && !intersect(toProvided, fromRequired)) { >+ if (!intersect(provided1, required2) >+ && !intersect(provided2, required1)) { > > if (diagnostics != null) { > diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 80307
:
35921
|
36338
|
36914
|
37131
|
37153
|
37217
|
37236
|
37419
| 40586 |
41343
|
84050
|
85114
|
85115
|
85127
|
228168