Author: bobtarling
Date: 2010-05-19 09:30:45-0700
New Revision: 18402
Modified:
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java
Log:
Remove all code that absolutely enforces WFR UML 1.4 section 2.10.3.4 #3
Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java?view=diff&pathrev=18402&r1=18401&r2=18402
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java (original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java 2010-05-19 09:30:45-0700
@@ -350,13 +350,6 @@
throw new IllegalArgumentException("In addBase: either the role "
+ "or the base is null");
}
-// // TODO: This check probably belongs in a critic instead of here since
-// // the rule can be violated later if the names are cleared
-// if (!isNamedOrUnique(role, base)) {
-// throw new IllegalArgumentException("In addBase: base is "
-// + "already part of " + "another role and "
-// + "role does not have " + "a name");
-// }
role.getBase().add(base);
if (modelImpl.getFacade().getBases(role).size() == 1) {
role.getAvailableContents().clear();
@@ -377,70 +370,6 @@
}
}
- // Collaboration UML 1.4 section WFR 2.10.3.4 #3
- // [3] If a ClassifierRole or an AssociationRole does not have a name,
- // then it should be the only one with a particular base.
-
- // self.allContents->forAll ( p |
- // (p.oclIsKindOf (ClassifierRole) implies
- // p.name = '' implies
- // self.allContents->forAll ( q |
- // q.oclIsKindOf(ClassifierRole) implies
- // (p.oclAsType(ClassifierRole).base =
- // q.oclAsType(ClassifierRole).base implies
- // p = q) ) )
- // and
- // [see below for AssociationRole]
- // )
- private boolean isNamedOrUnique(ClassifierRole role, Classifier base) {
- Collection<ClassifierRole> roles = ((org.omg.uml.UmlPackage) (base)
- .refOutermostPackage()).getCollaborations()
- .getAClassifierRoleBase().getClassifierRole(base);
- if (roles.isEmpty()) {
- return true;
- }
- if (role.getName() == null || role.getName().equals("")) {
- return false;
- }
- for (ClassifierRole cr : roles) {
- if (cr.getName() == null || cr.getName().equals("")) {
- return false;
- }
- }
- return true;
- }
-
- // Collaboration WFR UML 1.4 section 2.10.3.4 #3
- // [3] If a ClassifierRole or an AssociationRole does not have a name,
- // then it should be the only one with a particular base.
- // [...]
- // and
- // (p.oclIsKindOf (AssociationRole) implies
- // p.name = '' implies
- // self.allContents->forAll ( q |
- // q.oclIsKindOf(AssociationRole) implies
- // (p.oclAsType(AssociationRole).base =
- // q.oclAsType(AssociationRole).base implies
- // p = q) ) )
- // )
- private boolean isNamedOrUnique(AssociationRole role, UmlAssociation base) {
- Collection<AssociationRole> roles = ((org.omg.uml.UmlPackage) (base)
- .refOutermostPackage()).getCollaborations()
- .getABaseAssociationRole().getAssociationRole(base);
- if (roles.isEmpty()) {
- return true;
- }
- if (role.getName() == null || role.getName().equals("")) {
- return false;
- }
- for (AssociationRole ar : roles) {
- if (ar.getName() == null || ar.getName().equals("")) {
- return false;
- }
- }
- return true;
- }
-
public void setBases(Object role, Collection bases) {
if (role == null || bases == null) {
throw new IllegalArgumentException("In setBases: either the role "
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2610902
To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.