svn commit: r16539 - trunk/src: argouml-core-model-mdr/src/org/argouml/model/mdr argouml-core-model/src/org/argouml/model

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-01-07 23:31:25-0800
New Revision: 16539

Modified:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java
   trunk/src/argouml-core-model/src/org/argouml/model/CollaborationsHelper.java

Log:
Fix for issue 5602: Notation ignores Association to self when setting base.

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=16539&r1=16538&r2=16539
==============================================================================
--- 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	2009-01-07 23:31:25-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -501,8 +501,8 @@
      * Returns all possible bases for some AssociationRole taking into account
      * the wellformednessrules as defined in section 2.10.3 of the UML 1.3 spec.
      * <p>
-     * TODO: Beware: this function does not return the actual base! 
-     * Is that by design or a bug?
+     * Beware: this function does not return the actual base! 
+     * Which is by design; there are easier ways to retrieve the actual base.
      * 
      * @param aRole
      *            the given associationrole
@@ -520,8 +520,8 @@
         // the bases are formed by all associations in the namespace of the
         // collaboration
         Set<Classifier> bases = new HashSet<Classifier>();
-                for (AssociationEnd end : aRole.getConnection()) {
-                    assert end instanceof AssociationEndRole;
+        for (AssociationEnd end : aRole.getConnection()) {
+            assert end instanceof AssociationEndRole;
             ClassifierRole type = (ClassifierRole) end.getParticipant();
             if (type != null) {
                 bases.addAll(type.getBase());
@@ -541,12 +541,12 @@
              * - Use arrays in stead of a Set for bases
              * - Have the second loop start from the element after base1 
              * ... but I chose not to do this, since the gain is small,
-             * and this is only used for a lazily filled combo.*/
+             * and this is only used for a lazily filled combo.
+             * BTW: This is also used by Notation.*/
             for (Classifier base1 : bases)  {
                 for (Classifier base2 : bases) {
-                    if (base1 != base2) {
-                        ret.addAll(ch.getAssociations(base1, base2));
-                    }
+                    // include associations to self - see issue 5602
+                    ret.addAll(ch.getAssociations(base1, base2));
                 }
             }
         }

Modified: trunk/src/argouml-core-model/src/org/argouml/model/CollaborationsHelper.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/CollaborationsHelper.java?view=diff&pathrev=16539&r1=16538&r2=16539
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/CollaborationsHelper.java	(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/CollaborationsHelper.java	2009-01-07 23:31:25-0800
@@ -168,8 +168,8 @@
     /**
      * Returns all possible bases for the given element
      * (a ClassifierRole or AssociationRole). <p>
-     * TODO: Beware: this function does not return the current base!
-     * Is that by design or a bug?
+     * Beware: this function does not return the current base!
+     * Which is by design; there are easier ways to retrieve the actual base.
      *
      * @param role the given classifierrole or associationrole
      * @return all available bases

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1011170

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.