svn commit: r14689 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-05-10 09:24:07-0700
New Revision: 14689

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

Log:
Some extra well-formedness lost during recent refactoring

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java?view=diff&rev=14689&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java&r1=14688&r2=14689
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java	2008-05-10 09:24:07-0700
@@ -973,6 +973,30 @@
 
             if (elem == top) {
                 for (RefObject o : elementsInDeletionOrder) {
+                    if (o instanceof CompositeState) {
+                        // This enforces the following well-formedness rule.
+                        // <p>Well formedness rule 4.12.3.1 CompositeState
+                        // [4] There have to be at least two composite
+                        // substates in a concurrent composite state.<p>
+                        // If this is broken by deletion of substate then we
+                        // change the parent composite substate to be not
+                        // concurrent.
+                        CompositeState deletedCompositeState = 
+                            (CompositeState) o;
+                        try {
+                            CompositeState containingCompositeState =
+                                deletedCompositeState.getContainer();
+                            if (containingCompositeState != null
+                                    && containingCompositeState.
+                                    isConcurrent()
+                                    && containingCompositeState.getSubvertex().
+                                        size() == 1) {
+                                containingCompositeState.setConcurrent(false);
+                            }
+                        } catch (InvalidObjectException e) {
+                            LOG.warn("Object already deleted " + o);
+                        }
+                    }
                     try {
                         o.refDelete();
                     } catch (InvalidObjectException e) {
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.