svn commit: r14393 - trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-04-18 22:05:53-0700
New Revision: 14393

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

Log:
Minor typing cleanup

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java?view=diff&rev=14393&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java&r1=14392&r2=14393
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java	2008-04-18 22:05:53-0700
@@ -203,8 +203,10 @@
     public CompositeState buildCompositeStateOnStateMachine(
             Object statemachine) {
         if (statemachine instanceof StateMachine) {
+            StateMachine sm = (StateMachine) statemachine;
             CompositeState state = createCompositeState();
-            state.setStateMachine((StateMachine) statemachine);
+            state.setStateMachine(sm);
+            assert state.equals(sm.getTop());
             state.setName("top");
             return state;
         }
@@ -226,8 +228,8 @@
                 BehavioralFeature feature = (BehavioralFeature) context;
                 machine.setNamespace(feature.getOwner());
             }
-            Object top = buildCompositeStateOnStateMachine(machine);
-            machine.setTop((State) top);
+            State top = buildCompositeStateOnStateMachine(machine);
+            machine.setTop(top);
             return machine;
         }
         throw new IllegalArgumentException("In buildStateMachine: "
@@ -568,16 +570,17 @@
         if (!(elem instanceof StateMachine)) {
             throw new IllegalArgumentException();
         }
-
+        StateMachine stateMachine = (StateMachine) elem;
+        
         // This code is probably unnecessary since the top is
         // associated by composition
-        State top = (State) Model.getFacade().getTop(elem);
+        State top = stateMachine.getTop();
         if (top != null) {
             modelImpl.getUmlFactory().delete(top);
         }
         
         modelImpl.getUmlHelper().deleteCollection(
-                ((StateMachine) elem).getSubmachineState());
+                stateMachine.getSubmachineState());
     }
 
     /**
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.