svn commit: r13258 - trunk/src/model-mdr/src/org/argouml/model/mdr

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-08-06 15:04:42-0700
New Revision: 13258

Modified:
   trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java
   trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java

Log:
Strengthen type checking.  

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/ActivityGraphsFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -69,7 +69,7 @@
     }
 
 
-    public Object createActionState() {
+    public ActionState createActionState() {
         ActionState myActionState = modelImpl.getUmlPackage()
                 .getActivityGraphs().getActionState().createActionState();
         super.initialize(myActionState);
@@ -77,7 +77,7 @@
     }
 
 
-    public Object createActivityGraph() {
+    public ActivityGraph createActivityGraph() {
         ActivityGraph myActivityGraph = modelImpl.getUmlPackage().
             getActivityGraphs().getActivityGraph().createActivityGraph();
         super.initialize(myActivityGraph);
@@ -85,7 +85,7 @@
     }
 
 
-    public Object createCallState() {
+    public CallState createCallState() {
         CallState myCallState = modelImpl.getUmlPackage().getActivityGraphs().
             getCallState().createCallState();
         super.initialize(myCallState);
@@ -93,7 +93,7 @@
     }
 
 
-    public Object createClassifierInState() {
+    public ClassifierInState createClassifierInState() {
         ClassifierInState myClassifierInState = modelImpl.getUmlPackage().
             getActivityGraphs().getClassifierInState().
                 createClassifierInState();
@@ -102,7 +102,7 @@
     }
 
 
-    public Object createObjectFlowState() {
+    public ObjectFlowState createObjectFlowState() {
         ObjectFlowState myObjectFlowState = modelImpl.getUmlPackage().
             getActivityGraphs().getObjectFlowState().
                 createObjectFlowState();
@@ -111,7 +111,7 @@
     }
 
 
-    public Object createPartition() {
+    public Partition createPartition() {
         Partition myPartition = modelImpl.getUmlPackage().getActivityGraphs().
             getPartition().createPartition();
         super.initialize(myPartition);
@@ -119,7 +119,7 @@
     }
 
 
-    public Object createSubactivityState() {
+    public SubactivityState createSubactivityState() {
         SubactivityState mySubactivityState = modelImpl.getUmlPackage().
             getActivityGraphs().getSubactivityState().
                 createSubactivityState();
@@ -128,10 +128,9 @@
     }
 
 
-    public Object buildActivityGraph(Object theContext) {
+    public ActivityGraph buildActivityGraph(Object theContext) {
         if (theContext instanceof ModelElement) {
-            ActivityGraph myActivityGraph = (ActivityGraph) 
-                createActivityGraph();
+            ActivityGraph myActivityGraph = createActivityGraph();
             myActivityGraph.setContext((ModelElement) theContext);
             if (theContext instanceof Namespace) {
                 myActivityGraph.setNamespace((Namespace) theContext);
@@ -149,18 +148,19 @@
     }
 
 
-    public Object buildObjectFlowState(Object compositeState) {
+    public ObjectFlowState buildObjectFlowState(Object compositeState) {
         if (!(compositeState instanceof CompositeState)) {
             throw new IllegalArgumentException();
         }
 
-        ObjectFlowState state = (ObjectFlowState) createObjectFlowState();
+        ObjectFlowState state = createObjectFlowState();
         state.setContainer((CompositeState) compositeState);
         return state;
     }
 
 
-    public Object buildClassifierInState(Object classifier, Collection state) {
+    public ClassifierInState buildClassifierInState(Object classifier,
+            Collection state) {
         if (!(classifier instanceof Classifier)) {
             throw new IllegalArgumentException();
         }
@@ -169,7 +169,7 @@
                     "Collection of states must have at least one element");
         }
 
-        ClassifierInState c = (ClassifierInState) createClassifierInState();
+        ClassifierInState c = createClassifierInState();
         c.setType((Classifier) classifier);
         c.getInState().addAll(state);
         c.setNamespace(((Classifier) classifier).getNamespace());

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/CollaborationsFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -42,7 +42,6 @@
 import org.omg.uml.behavioralelements.collaborations.InteractionInstanceSet;
 import org.omg.uml.behavioralelements.collaborations.Message;
 import org.omg.uml.behavioralelements.commonbehavior.Link;
-import org.omg.uml.foundation.core.AssociationEnd;
 import org.omg.uml.foundation.core.Classifier;
 import org.omg.uml.foundation.core.Namespace;
 import org.omg.uml.foundation.core.Operation;
@@ -83,50 +82,40 @@
         collabPkg = modelImpl.getUmlPackage().getCollaborations();
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createAssociationEndRole()
-     */
-    public Object createAssociationEndRole() {
+
+    public AssociationEndRole createAssociationEndRole() {
         AssociationEndRole myAssociationEndRole =
             collabPkg.getAssociationEndRole().createAssociationEndRole();
         super.initialize(myAssociationEndRole);
         return myAssociationEndRole;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createAssociationRole()
-     */
-    public Object createAssociationRole() {
+
+    public AssociationRole createAssociationRole() {
         AssociationRole myAssociationRole =
             collabPkg.getAssociationRole().createAssociationRole();
         super.initialize(myAssociationRole);
         return myAssociationRole;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createClassifierRole()
-     */
-    public Object createClassifierRole() {
+
+    public ClassifierRole createClassifierRole() {
         ClassifierRole myClassifierRole =
             collabPkg.getClassifierRole().createClassifierRole();
         super.initialize(myClassifierRole);
         return myClassifierRole;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createCollaboration()
-     */
-    public Object createCollaboration() {
+
+    public Collaboration createCollaboration() {
         Collaboration myCollaboration =
             collabPkg.getCollaboration().createCollaboration();
         super.initialize(myCollaboration);
         return myCollaboration;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createCollaborationInstanceSet()
-     */
-    public Object createCollaborationInstanceSet() {
+
+    public CollaborationInstanceSet createCollaborationInstanceSet() {
         CollaborationInstanceSet obj =
             collabPkg.getCollaborationInstanceSet()
                 .createCollaborationInstanceSet();
@@ -134,64 +123,52 @@
         return obj;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createInteraction()
-     */
-    public Object createInteraction() {
+
+    public Interaction createInteraction() {
         Interaction myInteraction =
             collabPkg.getInteraction().createInteraction();
         super.initialize(myInteraction);
         return myInteraction;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createInteractionInstanceSet()
-     */
-    public Object createInteractionInstanceSet() {
+
+    public InteractionInstanceSet createInteractionInstanceSet() {
         InteractionInstanceSet obj =
             collabPkg.getInteractionInstanceSet()
                 .createInteractionInstanceSet();
         super.initialize(obj);
         return obj;
     }
-    /*
-     * @see org.argouml.model.CollaborationsFactory#createMessage()
-     */
-    public Object createMessage() {
+
+    
+    public Message createMessage() {
         Message myMessage =
             collabPkg.getMessage().createMessage();
         super.initialize(myMessage);
         return myMessage;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#buildClassifierRole(java.lang.Object)
-     */
-    public Object buildClassifierRole(Object collaboration) {
+
+    public ClassifierRole buildClassifierRole(Object collaboration) {
         Collaboration myCollaboration = (Collaboration) collaboration;
-        ClassifierRole classifierRole = (ClassifierRole) createClassifierRole();
+        ClassifierRole classifierRole = createClassifierRole();
         classifierRole.setNamespace(myCollaboration);
         classifierRole.setMultiplicity((Multiplicity) Model
                 .getDataTypesFactory().createMultiplicity("1..1"));
         return classifierRole;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#buildCollaboration(java.lang.Object)
-     */
+
     public Object buildCollaboration(Object handle) {
         Namespace namespace = (Namespace) handle;
-        Collaboration modelelement = (Collaboration) createCollaboration();
+        Collaboration modelelement = createCollaboration();
         modelelement.setNamespace(namespace);
         modelelement.setName("newCollaboration");
         modelelement.setAbstract(false);
         return modelelement;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#buildCollaboration(java.lang.Object,
-     *      java.lang.Object)
-     */
+
     public Object buildCollaboration(Object namespace,
             Object representedElement) {
         if (!(namespace instanceof Namespace)) {
@@ -224,7 +201,7 @@
 
     public Interaction buildInteraction(Object handle) {
         Collaboration collab = (Collaboration) handle;
-        Interaction inter = (Interaction) createInteraction();
+        Interaction inter = createInteraction();
         inter.setContext(collab);
         inter.setName("newInteraction");
         return inter;
@@ -233,8 +210,7 @@
 
     public AssociationEndRole buildAssociationEndRole(Object atype) {
         ClassifierRole type = (ClassifierRole) atype;
-        AssociationEndRole end =
-            (AssociationEndRole) createAssociationEndRole();
+        AssociationEndRole end = createAssociationEndRole();
         end.setParticipant(type);
         return end;
     }
@@ -256,7 +232,7 @@
             throw new IllegalArgumentException("ClassifierRoles must be in"
                     + " same non-null namespace");
         }
-        AssociationRole role = (AssociationRole) createAssociationRole();
+        AssociationRole role = createAssociationRole();
         role.setNamespace(collaboration);
         // The 4-arg version of this method depends on this ordering.
         // Don't change it!
@@ -301,10 +277,8 @@
         return (AggregationKind) aggregationKind;
     }
 
-    /*
-     * @see org.argouml.model.CollaborationsFactory#buildAssociationRole(java.lang.Object)
-     */
-    public Object buildAssociationRole(Object link) {
+
+    public AssociationRole buildAssociationRole(Object link) {
         if (!(link instanceof Link)) {
             throw new IllegalArgumentException("Argument is not a link");
         }
@@ -326,7 +300,7 @@
             throw new IllegalStateException("Collaboration may not be "
                     + "null");
         }
-        Object associationRole = createAssociationRole();
+        AssociationRole associationRole = createAssociationRole();
         modelImpl.getCoreHelper().setNamespace(associationRole, collaboration);
         modelImpl.getCoreHelper().addLink(associationRole, link);
         return associationRole;
@@ -350,7 +324,7 @@
         assert inter != null : "An interaction must be provided";
         assert role != null : "An association role must be provided";
 
-        Message message = (Message) createMessage();
+        Message message = createMessage();
 
         inter.getMessage().add(message);
 
@@ -467,7 +441,7 @@
             throw new IllegalArgumentException();
         }
 
-        Message activator = (Message) createMessage();
+        Message activator = createMessage();
         activator.setInteraction(theInteraction);
         theOwner.setActivator(activator);
         return activator;
@@ -490,9 +464,8 @@
      */
     void deleteAssociationRole(Object elem) {
         AssociationRole role = (AssociationRole) elem;
-        Iterator it = role.getMessage().iterator();
-        while (it.hasNext()) {
-            modelImpl.getUmlFactory().delete(it.next());
+        for (Message message : role.getMessage()) {
+            modelImpl.getUmlFactory().delete(message);
         }
     }
 

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/CommonBehaviorFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -32,6 +32,7 @@
 import org.omg.uml.behavioralelements.activitygraphs.ActionState;
 import org.omg.uml.behavioralelements.collaborations.CollaborationInstanceSet;
 import org.omg.uml.behavioralelements.collaborations.InteractionInstanceSet;
+import org.omg.uml.behavioralelements.collaborations.Message;
 import org.omg.uml.behavioralelements.commonbehavior.Action;
 import org.omg.uml.behavioralelements.commonbehavior.ActionSequence;
 import org.omg.uml.behavioralelements.commonbehavior.Argument;
@@ -98,59 +99,47 @@
         cbPackage = modelImpl.getUmlPackage().getCommonBehavior();
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createActionSequence()
-     */
-    public Object createActionSequence() {
+
+    public ActionSequence createActionSequence() {
         ActionSequence myActionSequence = cbPackage.getActionSequence()
                 .createActionSequence();
         super.initialize(myActionSequence);
         return myActionSequence;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createArgument()
-     */
-    public Object createArgument() {
+
+    public Argument createArgument() {
         Argument myArgument = cbPackage
                 .getArgument().createArgument();
         super.initialize(myArgument);
         return myArgument;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createAttributeLink()
-     */
-    public Object createAttributeLink() {
+
+    public AttributeLink createAttributeLink() {
         AttributeLink myAttributeLink = cbPackage.getAttributeLink()
                 .createAttributeLink();
         super.initialize(myAttributeLink);
         return myAttributeLink;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createCallAction()
-     */
-    public Object createCallAction() {
+
+    public CallAction createCallAction() {
         CallAction myCallAction = cbPackage.getCallAction().createCallAction();
         super.initialize(myCallAction);
         return myCallAction;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createComponentInstance()
-     */
-    public Object createComponentInstance() {
+
+    public ComponentInstance createComponentInstance() {
         ComponentInstance myComponentInstance = cbPackage
                 .getComponentInstance().createComponentInstance();
         super.initialize(myComponentInstance);
         return myComponentInstance;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createCreateAction()
-     */
-    public Object createCreateAction() {
+
+    public CreateAction createCreateAction() {
         CreateAction myCreateAction = cbPackage.getCreateAction()
                 .createCreateAction();
         super.initialize(myCreateAction);
@@ -158,208 +147,163 @@
     }
 
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createDataValue()
-     */
-    public Object createDataValue() {
+    public DataValue createDataValue() {
         DataValue myDataValue = cbPackage.getDataValue().createDataValue();
         super.initialize(myDataValue);
         return myDataValue;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createDestroyAction()
-     */
-    public Object createDestroyAction() {
+
+    public DestroyAction createDestroyAction() {
         DestroyAction myDestroyAction = cbPackage.getDestroyAction()
                 .createDestroyAction();
         super.initialize(myDestroyAction);
         return myDestroyAction;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createException()
-     */
-    public Object createException() {
+
+    public UmlException createException() {
         UmlException myUmlException = cbPackage.getUmlException()
                 .createUmlException();
         super.initialize(myUmlException);
         return myUmlException;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createLink()
-     */
-    public Object createLink() {
+
+    public Link createLink() {
         Link myLink = cbPackage.getLink().createLink();
         super.initialize(myLink);
         return myLink;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createLinkEnd()
-     */
-    public Object createLinkEnd() {
+
+    public LinkEnd createLinkEnd() {
         LinkEnd myLinkEnd = cbPackage.getLinkEnd().createLinkEnd();
         super.initialize(myLinkEnd);
         return myLinkEnd;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createLinkObject()
-     */
-    public Object createLinkObject() {
+
+    public LinkObject createLinkObject() {
         LinkObject myLinkObject = cbPackage.getLinkObject().createLinkObject();
         super.initialize(myLinkObject);
         return myLinkObject;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createNodeInstance()
-     */
-    public Object createNodeInstance() {
+
+    public NodeInstance createNodeInstance() {
         NodeInstance myNodeInstance = cbPackage.getNodeInstance()
                 .createNodeInstance();
         super.initialize(myNodeInstance);
         return myNodeInstance;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createObject()
-     */
-    public Object createObject() {
+
+    public org.omg.uml.behavioralelements.commonbehavior.Object createObject() {
         org.omg.uml.behavioralelements.commonbehavior.Object myObject = 
                 cbPackage.getObject().createObject();
         super.initialize(myObject);
         return myObject;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createReception()
-     */
-    public Object createReception() {
+
+    public Reception createReception() {
         Reception myReception = cbPackage.getReception().createReception();
         super.initialize(myReception);
         return myReception;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createReturnAction()
-     */
-    public Object createReturnAction() {
+
+    public ReturnAction createReturnAction() {
         ReturnAction myReturnAction = cbPackage.getReturnAction()
                 .createReturnAction();
         super.initialize(myReturnAction);
         return myReturnAction;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createSendAction()
-     */
-    public Object createSendAction() {
+
+    public SendAction createSendAction() {
         SendAction mySendAction = cbPackage.getSendAction().createSendAction();
         super.initialize(mySendAction);
         return mySendAction;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createSignal()
-     */
-    public Object createSignal() {
+
+    public Signal createSignal() {
         Signal mySignal = cbPackage.getSignal().createSignal();
         super.initialize(mySignal);
         return mySignal;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createStimulus()
-     */
-    public Object createStimulus() {
+
+    public Stimulus createStimulus() {
         Stimulus myStimulus = cbPackage.getStimulus().createStimulus();
         super.initialize(myStimulus);
         return myStimulus;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createSubsystemInstance()
-     */
-    public Object createSubsystemInstance() {
+
+    public SubsystemInstance createSubsystemInstance() {
         SubsystemInstance obj = cbPackage.getSubsystemInstance()
                 .createSubsystemInstance();
         super.initialize(obj);
         return obj;
     }
     
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createTerminateAction()
-     */
-    public Object createTerminateAction() {
+
+    public TerminateAction createTerminateAction() {
         TerminateAction myTerminateAction = cbPackage.getTerminateAction()
                 .createTerminateAction();
         super.initialize(myTerminateAction);
         return myTerminateAction;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#createUninterpretedAction()
-     */
-    public Object createUninterpretedAction() {
+
+    public UninterpretedAction createUninterpretedAction() {
         UninterpretedAction myUninterpretedAction = cbPackage
                 .getUninterpretedAction().createUninterpretedAction();
         super.initialize(myUninterpretedAction);
         return myUninterpretedAction;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildCallAction(java.lang.Object,
-     *      java.lang.String)
-     */
-    public Object buildCallAction(Object oper, String name) {
+
+    public CallAction buildCallAction(Object oper, String name) {
         if (!(oper instanceof Operation)) {
             throw new IllegalArgumentException("There should be an operation"
                     + " with a callaction.");
         }
-        Object action = createCallAction();
-        modelImpl.getCoreHelper().setName(action, name);
-        modelImpl.getCommonBehaviorHelper().setOperation(action, oper);
+        CallAction action = createCallAction();
+        action.setName(name);
+        action.setOperation((Operation) oper);
         return action;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildUninterpretedAction(java.lang.Object)
-     */
-    public Object buildUninterpretedAction(Object actionState) {
-        Object action = createUninterpretedAction();
+
+    public UninterpretedAction buildUninterpretedAction(Object actionState) {
+        UninterpretedAction action = createUninterpretedAction();
         if (actionState instanceof ActionState) {
-            modelImpl.getStateMachinesHelper().setEntry(actionState, action);
+            ((ActionState) actionState).setEntry(action);
         }
         return action;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildLink(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public Object buildLink(Object fromInstance, Object toInstance) {
-        Object link = modelImpl.getCommonBehaviorFactory().createLink();
-        Object /* MLinkEnd */le0 = modelImpl.getCommonBehaviorFactory().
-            createLinkEnd();
-        modelImpl.getCommonBehaviorHelper().setInstance(le0, fromInstance);
-        Object /* MLinkEnd */le1 = modelImpl.getCommonBehaviorFactory().
-            createLinkEnd();
-        modelImpl.getCommonBehaviorHelper().setInstance(le1, toInstance);
-        modelImpl.getCoreHelper().addConnection(link, le0);
-        modelImpl.getCoreHelper().addConnection(link, le1);
+
+    public Link buildLink(Object fromInstance, Object toInstance) {
+        Link link = createLink();
+        LinkEnd le0 =  createLinkEnd();
+        le0.setInstance((Instance) fromInstance);
+        LinkEnd le1 = createLinkEnd();
+        le1.setInstance((Instance) toInstance);
+        link.getConnection().add(le0);
+        link.getConnection().add(le1);
         return link;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildAction(java.lang.Object)
-     */
-    public Object buildAction(Object message) {
-        Object action = createCallAction();
-        modelImpl.getCoreHelper().setName(action, "action");
-        modelImpl.getCollaborationsHelper().setAction(message, action);
+
+    public Action buildAction(Object message) {
+        Action action = createCallAction();
+        action.setName("action");
+        ((Message) message).setAction(action);
         Object interaction = modelImpl.getFacade().getInteraction(message);
         if (interaction != null
             && modelImpl.getFacade().getContext(interaction) != null) {
@@ -373,10 +317,8 @@
         return action;
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildSignal(java.lang.Object)
-     */
-    public Object buildSignal(Object element) {
+
+    public Signal buildSignal(Object element) {
         if ((element instanceof BehavioralFeature)) {
             Signal signal = buildSignalInt(element);
             cbPackage.getAContextRaisedSignal().add(
@@ -410,15 +352,13 @@
         return signal;
     }
     
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildStimulus(java.lang.Object)
-     */
-    public Object buildStimulus(Object link) {
+
+    public Stimulus buildStimulus(Object link) {
         if (link instanceof Link
             && modelImpl.getCoreHelper().getSource(link) != null
             && modelImpl.getCoreHelper().getDestination(link) != null) {
 
-            Object stimulus = createStimulus();
+            Stimulus stimulus = createStimulus();
             Object sender = modelImpl.getCoreHelper().getSource(link);
             Object receiver = modelImpl.getCoreHelper().getDestination(link);
             modelImpl.getCommonBehaviorHelper().setReceiver(stimulus, receiver);
@@ -432,11 +372,9 @@
 
     }
 
-    /*
-     * @see org.argouml.model.CommonBehaviorFactory#buildReception(java.lang.Object)
-     */
-    public Object buildReception(Object aClassifier) {
-        Object reception = createReception();
+
+    public Reception buildReception(Object aClassifier) {
+        Reception reception = createReception();
         if (aClassifier instanceof Classifier) {
             modelImpl.getCoreHelper().setOwner(reception, aClassifier);
         }

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -176,7 +176,7 @@
     }
 
 
-    public Object createAssociationClass() {
+    public AssociationClass createAssociationClass() {
         AssociationClass assoc = corePackage.getAssociationClass()
                 .createAssociationClass();
         super.initialize(assoc);
@@ -184,7 +184,7 @@
     }
 
 
-    public Object createAssociationEnd() {
+    public AssociationEnd createAssociationEnd() {
         AssociationEnd assocEnd = corePackage.getAssociationEnd()
                 .createAssociationEnd();
         super.initialize(assocEnd);
@@ -192,42 +192,42 @@
     }
 
 
-    public Object createAttribute() {
+    public Attribute createAttribute() {
         Attribute myAttribute = corePackage.getAttribute().createAttribute();
         super.initialize(myAttribute);
         return myAttribute;
     }
 
 
-    public Object createBinding() {
+    public Binding createBinding() {
         Binding myBinding = corePackage.getBinding().createBinding();
         super.initialize(myBinding);
         return myBinding;
     }
 
 
-    public Object createClass() {
+    public UmlClass createClass() {
         UmlClass myClass = corePackage.getUmlClass().createUmlClass();
         super.initialize(myClass);
         return myClass;
     }
 
 
-    public Object createComment() {
+    public Comment createComment() {
         Comment myComment = corePackage.getComment().createComment();
         super.initialize(myComment);
         return myComment;
     }
 
 
-    public Object createComponent() {
+    public Component createComponent() {
         Component myComponent = corePackage.getComponent().createComponent();
         super.initialize(myComponent);
         return myComponent;
     }
 
 
-    public Object createConstraint() {
+    public Constraint createConstraint() {
         Constraint myConstraint = corePackage.getConstraint()
                 .createConstraint();
         super.initialize(myConstraint);
@@ -235,14 +235,14 @@
     }
 
 
-    public Object createDataType() {
+    public DataType createDataType() {
         DataType dataType = corePackage.getDataType().createDataType();
         super.initialize(dataType);
         return dataType;
     }
 
 
-    public Object createDependency() {
+    public Dependency createDependency() {
         Dependency myDependency = corePackage.getDependency()
                 .createDependency();
         super.initialize(myDependency);
@@ -250,7 +250,7 @@
     }
 
 
-    public Object createElementResidence() {
+    public ElementResidence createElementResidence() {
         ElementResidence myElementResidence = corePackage.
                 getElementResidence().createElementResidence();
         super.initialize(myElementResidence);
@@ -258,7 +258,7 @@
     }
 
 
-    public Object buildElementResidence(Object me, Object component) {
+    public ElementResidence buildElementResidence(Object me, Object component) {
         ElementResidence myElementResidence = corePackage.
         getElementResidence().createElementResidence();
         super.initialize(myElementResidence);
@@ -268,7 +268,7 @@
     }
 
     
-    public Object createEnumeration() {
+    public Enumeration createEnumeration() {
         Enumeration myEnumeration = corePackage.getEnumeration()
                 .createEnumeration();
         super.initialize(myEnumeration);
@@ -276,7 +276,7 @@
     }
     
 
-    public Object createEnumerationLiteral() {
+    public EnumerationLiteral createEnumerationLiteral() {
         EnumerationLiteral myEnumerationLiteral = corePackage
                 .getEnumerationLiteral().createEnumerationLiteral();
         super.initialize(myEnumerationLiteral);
@@ -284,23 +284,22 @@
     }
 
 
-    public Object buildEnumerationLiteral(String name, Object enumeration) {
-        EnumerationLiteral el = 
-            (EnumerationLiteral) createEnumerationLiteral();
+    public EnumerationLiteral buildEnumerationLiteral(String name, Object enumeration) {
+        EnumerationLiteral el = createEnumerationLiteral();
         el.setName(name);
         el.setEnumeration((Enumeration) enumeration);
         return el;
     }
 
     
-    public Object createFlow() {
+    public Flow createFlow() {
         Flow myFlow = corePackage.getFlow().createFlow();
         super.initialize(myFlow);
         return myFlow;
     }
 
 
-    public Object createGeneralization() {
+    public Generalization createGeneralization() {
         Generalization myGeneralization = corePackage.getGeneralization()
                 .createGeneralization();
         super.initialize(myGeneralization);
@@ -308,7 +307,7 @@
     }
 
 
-    public Object createInterface() {
+    public Interface createInterface() {
         Interface myInterface = corePackage
                 .getInterface().createInterface();
         super.initialize(myInterface);
@@ -316,7 +315,7 @@
     }
 
 
-    public Object createMethod() {
+    public Method createMethod() {
         Method myMethod = corePackage.getMethod()
                 .createMethod();
         super.initialize(myMethod);
@@ -324,14 +323,14 @@
     }
 
 
-    public Object createNode() {
+    public Node createNode() {
         Node myNode = corePackage.getNode().createNode();
         super.initialize(myNode);
         return myNode;
     }
 
 
-    public Object createOperation() {
+    public Operation createOperation() {
         Operation myOperation = corePackage
                 .getOperation().createOperation();
         super.initialize(myOperation);
@@ -339,7 +338,7 @@
     }
 
 
-    public Object createParameter() {
+    public Parameter createParameter() {
         Parameter myParameter = corePackage
                 .getParameter().createParameter();
         super.initialize(myParameter);
@@ -356,12 +355,12 @@
 
 
     @SuppressWarnings("deprecation")
-    public Object createPrimitive() {
+    public Primitive createPrimitive() {
         return createPrimitiveType();
     }
 
 
-    public Object createPrimitiveType() {
+    public Primitive createPrimitiveType() {
         Primitive obj = corePackage.getPrimitive().createPrimitive();
         super.initialize(obj);
         return obj;
@@ -369,7 +368,7 @@
     
 
     @SuppressWarnings("deprecation")
-    public Object createProgrammingLanguageDataType() {
+    public ProgrammingLanguageDataType createProgrammingLanguageDataType() {
         ProgrammingLanguageDataType obj = corePackage
                 .getProgrammingLanguageDataType()
                 .createProgrammingLanguageDataType();
@@ -378,7 +377,7 @@
     }
 
 
-    public Object createTemplateArgument() {
+    public TemplateArgument createTemplateArgument() {
         TemplateArgument obj = corePackage.getTemplateArgument()
                 .createTemplateArgument();
         super.initialize(obj);
@@ -386,7 +385,7 @@
     }
         
 
-    public Object createTemplateParameter() {
+    public TemplateParameter createTemplateParameter() {
         TemplateParameter myTemplateParameter = corePackage
                 .getTemplateParameter().createTemplateParameter();
         super.initialize(myTemplateParameter);
@@ -394,7 +393,7 @@
     }
 
 
-    public Object createUsage() {
+    public Usage createUsage() {
         Usage myUsage = corePackage.getUsage().createUsage();
         super.initialize(myUsage);
         return myUsage;
@@ -443,12 +442,8 @@
         return assoc;
     }
 
-    /*
-     * @see org.argouml.model.CoreFactory#buildAssociation(java.lang.Object,
-     *      java.lang.Object, java.lang.Object, java.lang.Object,
-     *      java.lang.Boolean)
-     */
-    public Object buildAssociation(Object fromClassifier,
+
+    public UmlAssociation buildAssociation(Object fromClassifier,
             Object aggregationKind1, Object toClassifier,
             Object aggregationKind2, Boolean unidirectional) {
         if (fromClassifier == null || toClassifier == null) {
@@ -492,22 +487,16 @@
         return assoc;
     }
 
-    /*
-     * @see org.argouml.model.CoreFactory#buildAssociation(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public Object buildAssociation(Object classifier1, Object classifier2) {
+
+    public UmlAssociation buildAssociation(Object classifier1, Object classifier2) {
         Classifier c1 = (Classifier) classifier1;
         Classifier c2 = (Classifier) classifier2;
         return buildAssociation(c1, true, AggregationKindEnum.AK_NONE, c2,
                 true, AggregationKindEnum.AK_NONE);
     }
 
-    /*
-     * @see org.argouml.model.CoreFactory#buildAssociation(java.lang.Object,
-     *      boolean, java.lang.Object, boolean, java.lang.String)
-     */
-    public Object buildAssociation(Object c1, boolean nav1, Object c2,
+
+    public UmlAssociation buildAssociation(Object c1, boolean nav1, Object c2,
             boolean nav2, String name) {
         UmlAssociation assoc = buildAssociation((Classifier) c1, nav1,
                 AggregationKindEnum.AK_NONE, (Classifier) c2, nav2,
@@ -518,18 +507,15 @@
         return assoc;
     }
 
-    /*
-     * @see org.argouml.model.CoreFactory#buildAssociationClass(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public Object buildAssociationClass(Object end1, Object end2) {
+
+    public AssociationClass buildAssociationClass(Object end1, Object end2) {
         if (end1 == null || end2 == null || !(end1 instanceof Classifier)
                 || !(end2 instanceof Classifier)) {
             throw new IllegalArgumentException(
                     "either one of the arguments was null");
         }
         return buildAssociationClass(
-                (UmlClass) buildClass(),
+                buildClass(),
                 (Classifier) end1,
                 (Classifier) end2);
     }
@@ -593,7 +579,7 @@
                     + "and multiplicity > 1");
         }
 
-        AssociationEnd end = (AssociationEnd) createAssociationEnd();
+        AssociationEnd end = createAssociationEnd();
         end.setAssociation((UmlAssociation) assoc);
         end.setParticipant((Classifier) type);
         end.setName(name);
@@ -661,11 +647,8 @@
                 .createMultiplicity(1, 1);
     }
 
-    /*
-     * @see org.argouml.model.CoreFactory#buildAssociationEnd(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public Object buildAssociationEnd(Object type, Object assoc) {
+
+    public AssociationEnd buildAssociationEnd(Object type, Object assoc) {
         if (type == null || !(type instanceof Classifier) || assoc == null
                 || !(assoc instanceof UmlAssociation)) {
             throw new IllegalArgumentException("one of the arguments is null");
@@ -693,7 +676,7 @@
             throw new IllegalArgumentException(
                     "one of the arguments was null");
         }
-        AssociationClass assoc = (AssociationClass) createAssociationClass();
+        AssociationClass assoc = createAssociationClass();
         
         // Copy attributes from our template class
         assoc.setNamespace(cl.getNamespace());
@@ -750,11 +733,8 @@
         return assoc;
     }
 
-    /*
-     * @see org.argouml.model.CoreFactory#buildAttribute(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public Object buildAttribute(Object model, Object theType) {
+
+    public Attribute buildAttribute(Object model, Object theType) {
         Classifier clsType = (Classifier) theType;
         // Force type element into given namespace if not already there
         // side effect!
@@ -766,11 +746,8 @@
         return buildAttribute2(theType);
     }
     
-    /*
-     * @see org.argouml.model.CoreFactory#buildAttribute(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public Object buildAttribute2(Object theType) {
+
+    public Attribute buildAttribute2(Object theType) {
         Attribute attr = buildAttribute();
         attr.setType((Classifier) theType);
         return attr;
@@ -781,7 +758,7 @@
      * @return the new attribute
      */
     Attribute buildAttribute() {
-        Attribute attr = (Attribute) createAttribute();
+        Attribute attr = createAttribute();
         attr.setName("newAttr");
         attr.setMultiplicity(getMultiplicity11());
         attr.setVisibility(VisibilityKindEnum.VK_PUBLIC);
@@ -793,8 +770,8 @@
     
 
     @SuppressWarnings("deprecation")
-    public Object buildAttribute(Object handle, Object model, Object type) {
-        Attribute attr = (Attribute) buildAttribute(model, type);
+    public Attribute buildAttribute(Object handle, Object model, Object type) {
+        Attribute attr = buildAttribute(model, type);
         if (handle instanceof Classifier) {
             Classifier cls = (Classifier) handle;
             cls.getFeature().add(attr);
@@ -808,8 +785,8 @@
     }
     
 
-    public Object buildAttribute2(Object handle, Object type) {
-        Attribute attr = (Attribute) buildAttribute2(type);
+    public Attribute buildAttribute2(Object handle, Object type) {
+        Attribute attr = buildAttribute2(type);
         if (handle instanceof Classifier) {
             Classifier cls = (Classifier) handle;
             cls.getFeature().add(attr);
@@ -823,8 +800,8 @@
     }
     
 
-    public Object buildClass() {
-        UmlClass cl = (UmlClass) createClass();
+    public UmlClass buildClass() {
+        UmlClass cl = createClass();
         cl.setName("");
         cl.setAbstract(false);
         cl.setActive(false);
@@ -836,8 +813,8 @@
     }
 
 
-    public Object buildClass(Object owner) {
-        Object clazz = buildClass();
+    public UmlClass buildClass(Object owner) {
+        UmlClass clazz = buildClass();
         if (owner instanceof Namespace) {
             modelImpl.getCoreHelper().setNamespace(clazz, owner);
         }
@@ -845,16 +822,16 @@
     }
 
 
-    public Object buildClass(String name) {
-        Object clazz = buildClass();
-        modelImpl.getCoreHelper().setName(clazz, name);
+    public UmlClass buildClass(String name) {
+        UmlClass clazz = buildClass();
+        clazz.setName(name);
         return clazz;
     }
 
 
-    public Object buildClass(String name, Object owner) {
-        Object clazz = buildClass();
-        modelImpl.getCoreHelper().setName(clazz, name);
+    public UmlClass buildClass(String name, Object owner) {
+        UmlClass clazz = buildClass();
+        clazz.setName(name);
         if (owner instanceof Namespace) {
             modelImpl.getCoreHelper().setNamespace(clazz, owner);
         }
@@ -862,8 +839,8 @@
     }
 
 
-    public Object buildInterface() {
-        Interface cl = (Interface) createInterface();
+    public Interface buildInterface() {
+        Interface cl = createInterface();
         cl.setName("");
         cl.setAbstract(false);
         cl.setRoot(false);
@@ -874,8 +851,8 @@
     }
 
 
-    public Object buildInterface(Object owner) {
-        Interface cl = (Interface) buildInterface();
+    public Interface buildInterface(Object owner) {
+        Interface cl = buildInterface();
         if (owner instanceof Namespace) {
             cl.setNamespace((Namespace) owner);
         }
@@ -883,15 +860,15 @@
     }
 
 
-    public Object buildInterface(String name) {
-        Interface cl = (Interface) buildInterface();
+    public Interface buildInterface(String name) {
+        Interface cl = buildInterface();
         cl.setName(name);
         return cl;
     }
 
 
-    public Object buildInterface(String name, Object owner) {
-        Interface cl = (Interface) buildInterface();
+    public Interface buildInterface(String name, Object owner) {
+        Interface cl = buildInterface();
         cl.setName(name);
         if (owner instanceof Namespace) {
             cl.setNamespace((Namespace) owner);
@@ -900,8 +877,8 @@
     }
 
 
-    public Object buildDataType(String name, Object owner) {
-        DataType dt = (DataType) createDataType();
+    public DataType buildDataType(String name, Object owner) {
+        DataType dt = createDataType();
         dt.setName(name);
         if (owner instanceof Namespace) {
             dt.setNamespace((Namespace) owner);
@@ -910,8 +887,8 @@
     }
 
 
-    public Object buildEnumeration(String name, Object owner) {
-        Enumeration e = (Enumeration) createEnumeration();
+    public Enumeration buildEnumeration(String name, Object owner) {
+        Enumeration e = createEnumeration();
         e.setName(name);
         if (owner instanceof Namespace) {
             e.setNamespace((Namespace) owner);
@@ -920,7 +897,7 @@
     }
 
 
-    public Object buildDependency(Object clientObj, Object supplierObj) {
+    public Dependency buildDependency(Object clientObj, Object supplierObj) {
 
         ModelElement client = (ModelElement) clientObj;
         ModelElement supplier = (ModelElement) supplierObj;
@@ -928,7 +905,7 @@
             throw new IllegalArgumentException("client or supplier is null "
                     + "client = " + client + " supplier = " + supplier);
         }
-        Dependency dep = (Dependency) createDependency();
+        Dependency dep = createDependency();
         dep.getSupplier().add(supplier);
         dep.getClient().add(client);
         if (client instanceof Namespace) {
@@ -1072,7 +1049,7 @@
             throw new IllegalArgumentException("child is root");
         }
 
-        Generalization gen = (Generalization) createGeneralization();
+        Generalization gen = createGeneralization();
         gen.setParent(parent);
         gen.setChild(child);
         gen.setNamespace(parent.getNamespace());
@@ -1081,7 +1058,7 @@
 
 
     public Method buildMethod(String name) {
-        Method method = (Method) createMethod();
+        Method method = createMethod();
         if (method != null) {
             method.setName(name);
         }
@@ -1101,7 +1078,7 @@
             throw new IllegalArgumentException("Handle is not a classifier");
         }
         Classifier cls = (Classifier) classifier;
-        Operation oper = (Operation) createOperation();
+        Operation oper = createOperation();
         oper.setName("newOperation");
         oper.setOwner(cls);
         oper.setVisibility(VisibilityKindEnum.VK_PUBLIC);
@@ -1197,8 +1174,8 @@
     }
 
 
-    public Object buildTemplateArgument(Object element) {
-        TemplateArgument ta = (TemplateArgument) createTemplateArgument();
+    public TemplateArgument buildTemplateArgument(Object element) {
+        TemplateArgument ta = createTemplateArgument();
         ta.setModelElement((ModelElement) element);
         return ta;
     }
@@ -1216,7 +1193,7 @@
         }
         // TODO: UML 1.4 spec requires both client and supplier to be
         // in the same model - tfm
-        Usage usage = (Usage) createUsage();
+        Usage usage = createUsage();
         usage.getSupplier().add((ModelElement) supplier);
         usage.getClient().add((ModelElement) client);
         if (((ModelElement) supplier).getNamespace() != null) {
@@ -1235,7 +1212,7 @@
             throw new IllegalArgumentException("A namespace must be supplied.");
         }
         ModelElement elementToAnnotate = (ModelElement) element;
-        Comment comment = (Comment) createComment();
+        Comment comment = createComment();
 
         Namespace commentsModel = null;
         if (elementToAnnotate != null) {
@@ -1256,7 +1233,7 @@
             throw new IllegalArgumentException("the constrained element is "
                     + "mandatory and may not be " + "null.");
         }
-        Constraint con = (Constraint) createConstraint();
+        Constraint con = createConstraint();
         con.getConstrainedElement().add(constrainedElement);
         con.setNamespace(constrainedElement.getNamespace());
         return con;
@@ -1267,7 +1244,7 @@
         if (bexpr == null || !(bexpr instanceof BooleanExpression)) {
             throw new IllegalArgumentException("invalid boolean expression.");
         }
-        Constraint con = (Constraint) createConstraint();
+        Constraint con = createConstraint();
         if (name != null) {
             con.setName(name);
         }
@@ -1289,7 +1266,7 @@
         // Check arguments against parameters for type and number
         // TODO: Perhaps move this to a critic instead? - tfm - 20070326
         if (arguments != null) {
-            Collection<TemplateParameter> params = 
+            List<TemplateParameter> params = 
                 ((ModelElement) supplier).getTemplateParameter();
             if (params.size() != arguments.size()) {
                 throw new IllegalArgumentException(
@@ -1311,7 +1288,7 @@
             }
         }
         
-        Binding binding = (Binding) createBinding();
+        Binding binding = createBinding();
         binding.getClient().add((ModelElement) client);
         binding.getSupplier().add((ModelElement) supplier);
         if (arguments != null) {
@@ -1880,13 +1857,13 @@
      *            is the namespace to put the copy in.
      * @return a newly created class.
      */
-    public Object copyClass(Object source, Object ns) {
+    public UmlClass copyClass(Object source, Object ns) {
         if (!(source instanceof UmlClass && ns instanceof Namespace)) {
             throw new IllegalArgumentException("source: " + source + ",ns: "
                     + ns);
         }
 
-        UmlClass c = (UmlClass) createClass();
+        UmlClass c = createClass();
         ((Namespace) ns).getOwnedElement().add(c);
         doCopyClass(source, c);
         return c;
@@ -1899,7 +1876,7 @@
      * @param classifier is the classifier to put the copy in.
      * @return a newly created feature.
      */
-    public Object copyFeature(Object source, Object classifier) {
+    public Feature copyFeature(Object source, Object classifier) {
         if (!(source instanceof Feature && classifier instanceof Classifier)) {
             throw new IllegalArgumentException("source: " + source 
                     + ",classifier: " + classifier);
@@ -1907,16 +1884,16 @@
 
         Feature f = null;
         if (source instanceof Attribute) {
-            Attribute attr = (Attribute) createAttribute();
+            Attribute attr = createAttribute();
             doCopyAttribute((Attribute) source, attr);
             f = attr;
         } else if (source instanceof Operation) {
-            Operation oper = (Operation) createOperation();
+            Operation oper = createOperation();
             doCopyOperation((Operation) source, oper);
             // TODO: build a return parameter
             f = oper;
         } else if (source instanceof Method) {
-            Method method = (Method) createMethod();
+            Method method = createMethod();
             doCopyMethod((Method) source, method);
             f = method;
         } else if (source instanceof Reception) {
@@ -1943,7 +1920,7 @@
      *            is the namespace to put the copy in.
      * @return a newly created data type.
      */
-    public Object copyDataType(Object source, Object ns) {
+    public DataType copyDataType(Object source, Object ns) {
         if (!(source instanceof DataType)) {
             throw new IllegalArgumentException();
         }
@@ -1952,7 +1929,7 @@
             throw new IllegalArgumentException();
         }
 
-        DataType i = (DataType) createDataType();
+        DataType i = createDataType();
         ((Namespace) ns).getOwnedElement().add(i);
         doCopyDataType(source, i);
         return i;
@@ -1968,7 +1945,7 @@
      *            is the namespace to put the copy in.
      * @return a newly created interface.
      */
-    public Object copyInterface(Object source, Object ns) {
+    public Interface copyInterface(Object source, Object ns) {
         if (!(source instanceof Interface)) {
             throw new IllegalArgumentException();
         }
@@ -1977,7 +1954,7 @@
             throw new IllegalArgumentException();
         }
 
-        Interface i = (Interface) createInterface();
+        Interface i = createInterface();
         ((Namespace) ns).getOwnedElement().add(i);
         doCopyInterface(source, i);
         return i;
@@ -2068,10 +2045,7 @@
         doCopyGeneralizableElement(source, target);
 
         // Copy all the Features
-        List features = ((Classifier) source).getFeature();
-        Iterator i = features.iterator();
-        while (i.hasNext()) {
-            Feature f = (Feature) i.next();
+        for (Feature f : ((Classifier) source).getFeature()) {
             copyFeature(f, target);
         }
     }
@@ -2180,11 +2154,10 @@
             // objects.
             Model targetModel = (Model) org.argouml.model.Model.getFacade()
                     .getModel(targetME);
-            Iterator it = sourceME.getStereotype().iterator();
-            while (it.hasNext()) {
+            for (Stereotype s : sourceME.getStereotype()) {
                 Stereotype st = (Stereotype) modelImpl
                         .getModelManagementHelper().getCorrespondingElement(
-                                it.next(), targetModel, true);
+                                s, targetModel, true);
                 targetME.getStereotype().add(st);
             }
         }
@@ -2289,12 +2262,12 @@
             BehavioralFeature target) {
         target.setQuery(source.isQuery());
         // copy raised signals:
-        Collection c = modelImpl.getUmlPackage().getCommonBehavior()
-            .getAContextRaisedSignal().getRaisedSignal(source);
-        Iterator i = c.iterator();
-        while (i.hasNext()) {
+        Collection<Signal> raisedSignals = modelImpl.getUmlPackage()
+                .getCommonBehavior().getAContextRaisedSignal().getRaisedSignal(
+                        source);
+        for (Signal signal : raisedSignals) {
             modelImpl.getUmlPackage().getCommonBehavior()
-                .getAContextRaisedSignal().add(target, (Signal) i.next());
+                    .getAContextRaisedSignal().add(target, signal);
         }
 
         doCopyFeature(source, target);

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java	2007-08-06 15:04:42-0700
@@ -32,7 +32,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
-import java.util.Vector;
 
 import javax.jmi.reflect.InvalidObjectException;
 
@@ -194,7 +193,7 @@
         return ((Class) type).isAssignableFrom((Class) subType);
     }
 
-    public Collection getAllSupertypes(Object cls1) {
+    public Collection<GeneralizableElement> getAllSupertypes(Object cls1) {
 
         if (!(cls1 instanceof Classifier)) {
             throw new IllegalArgumentException();
@@ -202,23 +201,22 @@
 
         Classifier cls = (Classifier) cls1;
 
-        Collection result = new HashSet();
+        Collection<GeneralizableElement> result = 
+            new HashSet<GeneralizableElement>();
         try {
-            Collection add = getSupertypes(cls);
+            Collection<GeneralizableElement> toBeAdded = getSupertypes(cls);
             do {
-                Collection newAdd = new HashSet();
-                Iterator addIter = add.iterator();
-                while (addIter.hasNext()) {
-                    GeneralizableElement next =
-                        (GeneralizableElement) addIter.next();
-                    if (next instanceof Classifier) {
-                        newAdd.addAll(getSupertypes(next));
+                Collection<GeneralizableElement> newlyAdded = 
+                    new HashSet<GeneralizableElement>();
+                for (GeneralizableElement element : toBeAdded) {
+                    if (element instanceof Classifier) {
+                        newlyAdded.addAll(getSupertypes(element));
                     }
                 }
-                result.addAll(add);
-                add = newAdd;
-                add.removeAll(result);
-            } while (!add.isEmpty());
+                result.addAll(toBeAdded);
+                toBeAdded = newlyAdded;
+                toBeAdded.removeAll(result);
+            } while (!toBeAdded.isEmpty());
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
         }
@@ -422,7 +420,7 @@
     }
 
     @SuppressWarnings("deprecation")
-    public Collection getSpecifications(Object classifier) {
+    public Collection<Interface> getSpecifications(Object classifier) {
         try {
             return getRealizedInterfaces(classifier);
         } catch (InvalidObjectException e) {
@@ -666,18 +664,16 @@
     }
 
 
-    public Collection getExtendingElements(Object clazz) {
+    public Collection<GeneralizableElement> getExtendingElements(Object clazz) {
         if (clazz == null) {
             return Collections.EMPTY_SET;
         }
-        List list = new ArrayList();
+        List<GeneralizableElement> list = 
+            new ArrayList<GeneralizableElement>();
         try {
-            Iterator it =
-                modelImpl.getFacade().getSpecializations(clazz).iterator();
-            while (it.hasNext()) {
-                Generalization gen = (Generalization) it.next();
-                GeneralizableElement client =
-                    (GeneralizableElement) modelImpl.getFacade().getChild(gen);
+            for (Generalization gen : (Collection<Generalization>) modelImpl
+                    .getFacade().getSpecializations(clazz)) {
+                GeneralizableElement client = gen.getChild();
                 if (client != null) {
                     list.add(client);
                 }
@@ -786,21 +782,17 @@
     }
 
 
-    public Collection getAssociatedClassifiers(Object aclassifier) {
+    public Collection<Classifier> getAssociatedClassifiers(Object aclassifier) {
         Classifier classifier = (Classifier) aclassifier;
         if (classifier == null) {
             return Collections.EMPTY_SET;
         }
-        List list = new ArrayList();
+        List<Classifier> list = new ArrayList<Classifier>();
         try {
-            Iterator it =
-                Model.getFacade().getAssociationEnds(classifier).iterator();
-            while (it.hasNext()) {
-                AssociationEnd end = (AssociationEnd) it.next();
+            for (AssociationEnd end : (Collection<AssociationEnd>) Model
+                    .getFacade().getAssociationEnds(classifier)) {
                 UmlAssociation assoc = end.getAssociation();
-                Iterator it2 = assoc.getConnection().iterator();
-                while (it2.hasNext()) {
-                    AssociationEnd end2 = (AssociationEnd) it2.next();
+                for (AssociationEnd end2 : assoc.getConnection()) {
                     if (end2 != end) {
                         list.add(end2.getParticipant());
                     }
@@ -813,20 +805,16 @@
     }
 
 
-    public Collection getAssociations(Object from, Object to) {
+    public Collection<UmlAssociation> getAssociations(Object from, Object to) {
         if (!(from instanceof Classifier) || !(to instanceof Classifier)) {
             throw new IllegalArgumentException();
         }
-        Set ret = new HashSet();
+        Set<UmlAssociation> ret = new HashSet<UmlAssociation>();
         try {
-            Iterator it = 
-                modelImpl.getFacade().getAssociationEnds(from).iterator();
-            while (it.hasNext()) {
-                AssociationEnd end = (AssociationEnd) it.next();
+            for (AssociationEnd end : (Collection<AssociationEnd>) Model
+                    .getFacade().getAssociationEnds(from)) {
                 UmlAssociation assoc = end.getAssociation();
-                Iterator it2 = assoc.getConnection().iterator();
-                while (it2.hasNext()) {
-                    AssociationEnd end2 = (AssociationEnd) it2.next();
+                for (AssociationEnd end2 : assoc.getConnection()) {
                     if (end2.getParticipant() == to) {
                         ret.add(assoc);
                     }
@@ -876,7 +864,7 @@
     }
 
 
-    public Object getAssociationEnd(Object type, Object assoc) {
+    public AssociationEnd getAssociationEnd(Object type, Object assoc) {
         if (!(type instanceof Classifier)) {
             throw new IllegalArgumentException();
         }
@@ -884,10 +872,8 @@
             throw new IllegalArgumentException();
         }
         try {
-            Iterator it = 
-                Model.getFacade().getAssociationEnds(type).iterator();
-            while (it.hasNext()) {
-                AssociationEnd end = (AssociationEnd) it.next();
+            for (AssociationEnd end : (Collection<AssociationEnd>) Model
+                    .getFacade().getAssociationEnds(type)) {
                 if (((UmlAssociation) assoc).getConnection().contains(end)) {
                     return end;
                 }
@@ -1507,7 +1493,7 @@
     }
 
 
-    public Object getFirstSharedNamespace(Object ns1, Object ns2) {
+    public Namespace getFirstSharedNamespace(Object ns1, Object ns2) {
         if (ns1 == null || ns2 == null) {
             throw new IllegalArgumentException("null argument");
         }
@@ -1522,18 +1508,18 @@
                             + ns2.getClass().getName());
         }
         if (ns1 == ns2) {
-            return ns1;
+            return (Namespace) ns1;
         }
 
         try {
             // Get the namespace hierarchy for each element
-            Iterator path1 = getPath((ModelElement) ns1).iterator();
-            Iterator path2 = getPath((ModelElement) ns2).iterator();
+            Iterator<Namespace> path1 = getPath((Namespace) ns1).iterator();
+            Iterator<Namespace> path2 = getPath((Namespace) ns2).iterator();
 
             // Traverse the lists looking for the last (innermost) match
-            Object lastMatch = null;
+            Namespace lastMatch = null;
             while (path1.hasNext() && path2.hasNext()) {
-                Object element = path1.next();
+                Namespace element = path1.next();
                 if (element != path2.next()) {
                     return lastMatch;
                 }
@@ -1550,8 +1536,8 @@
      * Return a list of namespaces enclosing this element.
      * The list is ordered outer to inner. i.e. it starts at the root model.
      */
-    private List<ModelElement> getPath(ModelElement element) {
-        LinkedList<ModelElement> path = new LinkedList<ModelElement>();
+    private List<Namespace> getPath(Namespace element) {
+        LinkedList<Namespace> path = new LinkedList<Namespace>();
         path.add(element);
         Namespace ns = element.getNamespace();
         while (ns != null) {
@@ -1562,23 +1548,22 @@
     }
 
 
-    public Collection getAllPossibleNamespaces(Object modelElement,
+    public Collection<Namespace> getAllPossibleNamespaces(Object modelElement,
             Object model) {
         ModelElement m = (ModelElement) modelElement;
-        Collection ret = new HashSet();
+        Collection<Namespace>  ret = new HashSet<Namespace> ();
         if (m == null) {
             return ret;
         }
         
         try {
             if (isValidNamespace(m, model)) {
-                ret.add(model);
+                ret.add((Namespace) model);
             }
-            Iterator it = modelImpl.getModelManagementHelper()
-                    .getAllModelElementsOfKind(model, Namespace.class)
-                    .iterator();
-            while (it.hasNext()) {
-                Namespace ns = (Namespace) it.next();
+            Collection<Namespace> namespaces = modelImpl
+                    .getModelManagementHelper().getAllModelElementsOfKind(
+                            model, Namespace.class);
+            for (Namespace ns : namespaces) {
                 if (isValidNamespace(m, ns)) {
                     ret.add(ns);
                 }
@@ -1591,17 +1576,17 @@
     }
 
 
-    public Collection getChildren(Object o) {
+    public Collection<GeneralizableElement> getChildren(Object o) {
         if (o instanceof GeneralizableElement) {
-            Collection col = new ArrayList();
-            Collection generalizations = new ArrayList();
+            Collection<GeneralizableElement> col = 
+                new ArrayList<GeneralizableElement>();
+            Collection<Generalization> generalizations = new ArrayList<Generalization>();
             try {
                 if (o instanceof GeneralizableElement) {
-                    Iterator it =
-                        Model.getFacade().getSpecializations(o).iterator();
-                    while (it.hasNext()) {
-                        getChildren(col, (Generalization) it.next(),
-                                generalizations);
+                    Collection<Generalization> specializations =
+                        Model.getFacade().getSpecializations(o);
+                    for (Generalization specialization : specializations) {
+                        getChildren(col, specialization, generalizations);
                     }
                 }
             } catch (InvalidObjectException e) {
@@ -1626,8 +1611,8 @@
      * @throws IllegalStateException
      *             if there is a circular reference.
      */
-    private void getChildren(Collection currentChildren, Generalization gen,
-            Collection generalizations) {
+    private void getChildren(Collection<GeneralizableElement> currentChildren,
+            Generalization gen, Collection<Generalization> generalizations) {
         GeneralizableElement child = gen.getChild();
         if (currentChildren.contains(child) && generalizations.contains(gen)) {
             throw new IllegalStateException("Circular inheritance occured.");
@@ -1635,10 +1620,10 @@
             currentChildren.add(child);
             generalizations.add(gen);
         }
-        Iterator it = Model.getFacade().getSpecializations(child).iterator();
-        while (it.hasNext()) {
-            getChildren(currentChildren, (Generalization) it.next(),
-                    generalizations);
+        Collection<Generalization> specializations =
+            Model.getFacade().getSpecializations(child);
+        for (Generalization specialization : specializations) {
+            getChildren(currentChildren, specialization, generalizations);
         }
     }
 
@@ -1666,10 +1651,7 @@
         if (o != null) {
             if (o instanceof UmlClass) {
                 UmlClass clazz = (UmlClass) o;
-                Collection supDependencies = clazz.getClientDependency();
-                Iterator it = supDependencies.iterator();
-                while (it.hasNext()) {
-                    Dependency dependency = (Dependency) it.next();
+                for (Dependency dependency : clazz.getClientDependency()) {
                     Stereotype stereo =
                         (Stereotype) getFirstItemOrNull(
                                 dependency.getStereotype());
@@ -1679,15 +1661,11 @@
                             && "Abstraction".equals(stereo.getBaseClass())) {
 
                         col.addAll(dependency.getSupplier());
-
                     }
                 }
-                Collection superTypes = getSupertypes(o);
-                it = superTypes.iterator();
-                while (it.hasNext()) {
-                    Object obj = it.next();
-                    if (!visited.contains(obj)) {
-                        internalGetAllRealizedInterfaces(obj, col, visited);
+                for (Object supertype : getSupertypes(o)) {
+                    if (!visited.contains(supertype)) {
+                        internalGetAllRealizedInterfaces(supertype, col, visited);
                     }
                 }
             }
@@ -1703,9 +1681,7 @@
 
         UmlAssociation association1 = (UmlAssociation) association;
         try {
-            List ends = association1.getConnection();
-            for (Iterator iter = ends.iterator(); iter.hasNext();) {
-                AssociationEnd end = (AssociationEnd) iter.next();
+            for (AssociationEnd end : association1.getConnection()) {
                 if (end.getAggregation() == AggregationKindEnum.AK_COMPOSITE) {
                     return true;
                 }
@@ -2076,7 +2052,7 @@
      * @param handle A modelElement
      * @return Collection The ElementResidence for this model element
      */
-    public Collection getElementResidence(Object handle) {
+    public Collection<ElementResidence> getElementResidence(Object handle) {
         try {
             if (handle instanceof ModelElement) {
                 return modelImpl.getUmlPackage().getCore()
@@ -2834,18 +2810,13 @@
                 || handle instanceof BehavioralFeature) {
             Collection params = Model.getFacade().getParameters(handle);
             if (!params.isEmpty()) {
-                Vector actualParams = new Vector();
-                actualParams.addAll(params);
-                Iterator toRemove = actualParams.iterator();
-                while (toRemove.hasNext()) {
-                    removeParameter(handle, toRemove.next());
+                Collection actualParams = new ArrayList(params);
+                for (Object param : actualParams) {
+                    removeParameter(handle, param);
                 }
             }
-            if (!parameters.isEmpty()) {
-                Iterator toAdd = parameters.iterator();
-                while (toAdd.hasNext()) {
-                    addParameter(handle, toAdd.next());
-                }
+            for (Object param : parameters) {
+                addParameter(handle, param);
             }
             return;
         }
@@ -3161,8 +3132,8 @@
     }
 
 
-    public Collection getAllMetatypeNames() {
-        List names = new ArrayList();
+    public Collection<String> getAllMetatypeNames() {
+        Set<String> names = new HashSet<String>();
         for (Iterator iter =
                 modelImpl.getModelPackage().getMofClass().refAllOfClass()
                     .iterator();

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/DataTypesFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -71,7 +71,7 @@
     }
 
 
-    public Object createActionExpression(String language, String body) {
+    public ActionExpression createActionExpression(String language, String body) {
         ActionExpression myActionExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getActionExpression()
                 .createActionExpression(language, body);
@@ -80,7 +80,7 @@
     }
 
 
-    public Object createArgListsExpression(String language, String body) {
+    public ArgListsExpression createArgListsExpression(String language, String body) {
         ArgListsExpression myArgListsExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getArgListsExpression()
                 .createArgListsExpression(language, body);
@@ -89,7 +89,7 @@
     }
 
 
-    public Object createBooleanExpression(String language, String body) {
+    public BooleanExpression createBooleanExpression(String language, String body) {
         BooleanExpression myBooleanExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getBooleanExpression()
                 .createBooleanExpression(language, body);
@@ -98,7 +98,7 @@
     }
 
 
-    public Object createExpression(String language, String body) {
+    public Expression createExpression(String language, String body) {
         Expression myExpression = modelImpl.getUmlPackage().getDataTypes()
                 .getExpression().createExpression(language, body);
         super.initialize(myExpression);
@@ -106,7 +106,7 @@
     }
 
 
-    public Object createIterationExpression(String language, String body) {
+    public IterationExpression createIterationExpression(String language, String body) {
         IterationExpression myIterationExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getIterationExpression()
                 .createIterationExpression(language, body);
@@ -115,7 +115,7 @@
     }
 
 
-    public Object createMappingExpression(String language, String body) {
+    public MappingExpression createMappingExpression(String language, String body) {
         MappingExpression myMappingExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getMappingExpression().createMappingExpression(
                         language, body);
@@ -124,7 +124,7 @@
     }
 
 
-    public Object createObjectSetExpression(String language, String body) {
+    public ObjectSetExpression createObjectSetExpression(String language, String body) {
         ObjectSetExpression myObjectSetExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getObjectSetExpression()
                 .createObjectSetExpression(language, body);
@@ -133,7 +133,7 @@
     }
 
 
-    public Object createProcedureExpression(String language, String body) {
+    public ProcedureExpression createProcedureExpression(String language, String body) {
         ProcedureExpression myProcedureExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getProcedureExpression()
                 .createProcedureExpression(language, body);
@@ -142,7 +142,7 @@
     }
 
 
-    public Object createTimeExpression(String language, String body) {
+    public TimeExpression createTimeExpression(String language, String body) {
         TimeExpression myTimeExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getTimeExpression()
                 .createTimeExpression(language, body);
@@ -151,7 +151,7 @@
     }
 
 
-    public Object createTypeExpression(String language, String body) {
+    public TypeExpression createTypeExpression(String language, String body) {
         TypeExpression myTypeExpression = modelImpl.getUmlPackage()
                 .getDataTypes().getTypeExpression()
                 .createTypeExpression(language, body);
@@ -185,12 +185,13 @@
 
 
     public Multiplicity createMultiplicity(String str) {
-        List ranges = Collections.unmodifiableList(parseRanges(str));
+        List<MultiplicityRange> ranges = 
+            Collections.unmodifiableList(parseRanges(str));
         return createMultiplicity(ranges);
     }
 
-    private List parseRanges(String str) {
-        List rc = new ArrayList();
+    private List<MultiplicityRange> parseRanges(String str) {
+        List<MultiplicityRange> rc = new ArrayList<MultiplicityRange>();
         // Return 1..1 multiplicity for empty string
         if ("".equals(str)) {
             rc.add(createMultiplicityRange("1..1"));

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -75,7 +75,7 @@
     /*
      * @see org.argouml.model.ExtensionMechanismsFactory#createTaggedValue()
      */
-    public Object createTaggedValue() {
+    public TaggedValue createTaggedValue() {
         TaggedValue tv = modelImpl.getUmlPackage().getCore().getTaggedValue().
                 createTaggedValue();
         super.initialize(tv);
@@ -88,7 +88,7 @@
      * @param tagName The name of the TagDefinition to create/retrieve
      * @return an initialized UML TaggedValue instance.
      */
-    Object getTagDefinition(String tagName) {
+    TagDefinition getTagDefinition(String tagName) {
         if (tagName == null) {
             throw new IllegalArgumentException("Argument may not be null");
         }
@@ -120,7 +120,7 @@
      * 
      * @see org.argouml.model.ExtensionMechanismsFactory#buildStereotype(java.lang.Object, java.lang.Object, java.lang.Object)
      */
-    public Object buildStereotype(
+    public Stereotype buildStereotype(
             Object theModelElementObject,
             Object theName,
             Object theNamespaceObject) {
@@ -154,7 +154,7 @@
     }
 
 
-    public Object buildStereotype(
+    public Stereotype buildStereotype(
             Object theModelElementObject,
             String theName,
             Object model,
@@ -197,7 +197,7 @@
     }
 
 
-    public Object buildStereotype(String text, Object ns) {
+    public Stereotype buildStereotype(String text, Object ns) {
         if (!(ns instanceof Namespace)) {
             throw new IllegalArgumentException(
                     "Namespace is wrong type - text:" + text + ",ns:"
@@ -209,9 +209,9 @@
     }
 
 
-    public Object buildTaggedValue(String tag, String value) {
-        TaggedValue tv = (TaggedValue) createTaggedValue();
-        TagDefinition td = (TagDefinition) getTagDefinition(tag);
+    public TaggedValue buildTaggedValue(String tag, String value) {
+        TaggedValue tv = createTaggedValue();
+        TagDefinition td = getTagDefinition(tag);
         td = 
             (TagDefinition) 
             modelImpl.getModelManagementHelper().getCorrespondingElement(
@@ -248,7 +248,7 @@
      * @return the newly cloned copy
      */
     private Object copyTaggedValue(TaggedValue source) {
-        TaggedValue tv = (TaggedValue) createTaggedValue();
+        TaggedValue tv = createTaggedValue();
         tv.setType(source.getType());
         tv.getDataValue().addAll(source.getDataValue());
         tv.getReferenceValue().addAll(source.getReferenceValue());
@@ -328,7 +328,8 @@
     }
 
 
-    public Object buildTagDefinition(String text, Object owner, Object ns) {
+    public TagDefinition buildTagDefinition(String text, Object owner, 
+            Object ns) {
         if (owner != null) {
             if (!(owner instanceof Stereotype)) {
                 throw new IllegalArgumentException("owner: " + owner);

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/ExtensionMechanismsHelperMDRImpl.java	2007-08-06 15:04:42-0700
@@ -31,7 +31,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Vector;
 
 import javax.jmi.model.MofClass;
 import javax.jmi.reflect.InvalidObjectException;
@@ -72,7 +71,8 @@
      */
     private MDRModelImplementation modelImpl;
 
-    private static Map packageMap = new HashMap(16);
+    private static Map<String, String> packageMap = 
+        new HashMap<String, String>(16);
 
     /**
      * Don't allow instantiation.
@@ -93,19 +93,17 @@
     }
 
     
-    public Collection getStereotypes(Object ns) {
+    public Collection<Stereotype> getStereotypes(Object ns) {
         if (!(ns instanceof Namespace)) {
             throw new IllegalArgumentException();
         }
         
-        List l = new ArrayList();
+        List<Stereotype> l = new ArrayList<Stereotype>();
         // TODO: this could be a huge collection - find a more efficient way
         try {
-            Iterator it = ((Namespace) ns).getOwnedElement().iterator();
-            while (it.hasNext()) {
-                Object o = it.next();
+            for (Object o : ((Namespace) ns).getOwnedElement()) {
                 if (o instanceof Stereotype) {
-                    l.add(o);
+                    l.add((Stereotype) o);
                 } else if (o instanceof UmlPackage) {
                     l.addAll(getStereotypes(o));
                 }
@@ -128,19 +126,16 @@
 
         try {
             String name = ((ModelElement) stereo).getName();
-            Collection baseClasses = ((Stereotype) stereo).getBaseClass();
+            Collection<String> baseClasses = 
+                ((Stereotype) stereo).getBaseClass();
             if (name == null || baseClasses.size() != 1) {
                 return null;
             }
-            String baseClass = (String) baseClasses.iterator().next();
+            String baseClass = baseClasses.iterator().next();
             
-            Iterator it = getStereotypes(ns).iterator();
-            while (it.hasNext()) {
-                Object o = it.next();
-                if (o instanceof Stereotype
-                        && name.equals(((Stereotype) o).getName())
-                        && ((Stereotype) o).getBaseClass()
-                            .contains(baseClass)) {
+            for (Stereotype o : getStereotypes(ns)) {
+                if (name.equals(o.getName())
+                        && o.getBaseClass().contains(baseClass)) {
                     return o;
                 }
             }
@@ -151,7 +146,7 @@
     }
 
 
-    public Object getStereotype(Collection models, Object stereo) {
+    public Stereotype getStereotype(Collection models, Object stereo) {
         if (stereo == null) {
             throw new IllegalArgumentException("null argument");
         }
@@ -161,24 +156,19 @@
 
         try {
             String name = ((Stereotype) stereo).getName();
-            Collection baseClasses = ((Stereotype) stereo).getBaseClass();
+            Collection<String> baseClasses = 
+                ((Stereotype) stereo).getBaseClass();
             if (name == null || baseClasses.size() != 1) {
                 return null;
             }
-            String baseClass = (String) baseClasses.iterator().next();
+            String baseClass = baseClasses.iterator().next();
             
-            Iterator it2 = models.iterator();
-            while (it2.hasNext()) {
+            for (Model model : ((Collection<Model>) models)) {
                 // TODO: this should call the single namespace form
                 // getStereotype(it2.next(); stereo);
-                Model model = (Model) it2.next();
-                Iterator it = getStereotypes(model).iterator();
-                while (it.hasNext()) {
-                    Object o = it.next();
-                    if (o instanceof Stereotype
-                            && name.equals(((Stereotype) o).getName())
-                            && ((Stereotype) o).getBaseClass().contains(
-                                    baseClass)) {
+                for (Stereotype o : getStereotypes(model)) {
+                    if (name.equals(o.getName())
+                            && o.getBaseClass().contains(baseClass)) {
                         return o;
                     }
                 }
@@ -546,22 +536,16 @@
             Collection tv =
                 modelImpl.getFacade().getTaggedValuesCollection(handle);
             if (!tv.isEmpty()) {
-                Vector tvs = new Vector(tv);
-                Iterator toRemove = tvs.iterator();
-                while (toRemove.hasNext()) {
-                    Object value = toRemove.next();
+                Collection tvs = new ArrayList(tv);
+                for (Object value : tvs) {
                     if (!taggedValues.contains(value)) {
                         tv.remove(value);
                     }
                 }
             }
-            if (!taggedValues.isEmpty()) {
-                Iterator toAdd = taggedValues.iterator();
-                while (toAdd.hasNext()) {
-                    Object value = toAdd.next();
-                    if (!tv.contains(value)) {
-                        tv.add(value);
-                    }
+            for (Object value : taggedValues) {
+                if (!tv.contains(value)) {
+                    tv.add(value);
                 }
             }
             return;

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/ModelManagementFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -79,18 +79,14 @@
         modelImpl = mi;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#createModel()
-     */
-    public Object createModel() {
+
+    public Model createModel() {
         Model myModel = modelManagementPackage.getModel().createModel();
         super.initialize(myModel);
         return myModel;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#setRootModel(java.lang.Object)
-     */
+
     public void setRootModel(Object rootModel) {
         if (rootModel != null && !(rootModel instanceof Model)) {
             throw new IllegalArgumentException(
@@ -100,30 +96,23 @@
         theRootModel = rootModel;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#getRootModel()
-     */
+
     public Object getRootModel() {
         return theRootModel;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#createElementImport()
-     */
-    public Object createElementImport() {
+
+    public ElementImport createElementImport() {
         ElementImport myElementImport =
             modelManagementPackage.getElementImport().createElementImport();
         super.initialize(myElementImport);
         return myElementImport;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#buildElementImport(
-     * java.lang.Object, java.lang.Object)
-     */
-    public Object buildElementImport(Object pack, Object me) {
+
+    public ElementImport buildElementImport(Object pack, Object me) {
         if (pack instanceof UmlPackage && me instanceof ModelElement) {
-            ElementImport ei = (ElementImport) createElementImport();
+            ElementImport ei = createElementImport();
             ei.setImportedElement((ModelElement) me);
             ei.setUmlPackage((UmlPackage) pack);
             return ei;
@@ -133,31 +122,24 @@
                 + "Package and a ModelElement.");
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#createPackage()
-     */
-    public Object createPackage() {
+
+    public UmlPackage createPackage() {
         UmlPackage myUmlPackage =
             modelManagementPackage.getUmlPackage().createUmlPackage();
         super.initialize(myUmlPackage);
         return myUmlPackage;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#buildPackage(
-     *      java.lang.String, java.lang.String)
-     */
+
     public Object buildPackage(String name, String uuid) {
-        UmlPackage pkg = (UmlPackage) createPackage();
+        UmlPackage pkg = createPackage();
         pkg.setName(name);
         // TODO: not sure who added below message.  Needs resolution. - tfm
         LOG.warn("UUID [" + uuid + "] ignored - what to do with it?");
         return pkg;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#createSubsystem()
-     */
+
     public Object createSubsystem() {
         Subsystem mySubsystem =
             modelManagementPackage.getSubsystem().createSubsystem();
@@ -165,10 +147,7 @@
         return mySubsystem;
     }
 
-    /*
-     * @see org.argouml.model.ModelManagementFactory#copyPackage(
-     *      java.lang.Object, java.lang.Object)
-     */
+
     public Object copyPackage(Object source, Object ns) {
         if (!(source instanceof UmlPackage)) {
             throw new IllegalArgumentException("source");
@@ -177,7 +156,7 @@
             throw new IllegalArgumentException("namespace");
         }
 
-        UmlPackage p = (UmlPackage) createPackage();
+        UmlPackage p = createPackage();
         ((Namespace) ns).getOwnedElement().add(p);
         doCopyPackage((UmlPackage) source, p);
         return p;

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=13258&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=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -24,9 +24,6 @@
 
 package org.argouml.model.mdr;
 
-import java.util.Collection;
-import java.util.Iterator;
-
 import org.apache.log4j.Logger;
 import org.argouml.model.Model;
 import org.argouml.model.StateMachinesFactory;
@@ -98,14 +95,14 @@
     }
 
 
-    public Object createCallEvent() {
+    public CallEvent createCallEvent() {
         CallEvent myCallEvent = smPackage.getCallEvent().createCallEvent();
         super.initialize(myCallEvent);
         return myCallEvent;
     }
 
 
-    public Object createChangeEvent() {
+    public ChangeEvent createChangeEvent() {
         ChangeEvent myChangeEvent = smPackage.getChangeEvent()
                 .createChangeEvent();
         super.initialize(myChangeEvent);
@@ -113,7 +110,7 @@
     }
 
 
-    public Object createCompositeState() {
+    public CompositeState createCompositeState() {
         CompositeState myCompositeState = smPackage.getCompositeState()
                 .createCompositeState();
         super.initialize(myCompositeState);
@@ -121,21 +118,21 @@
     }
 
 
-    public Object createFinalState() {
+    public FinalState createFinalState() {
         FinalState myFinalState = smPackage.getFinalState().createFinalState();
         super.initialize(myFinalState);
         return myFinalState;
     }
 
 
-    public Object createGuard() {
+    public Guard createGuard() {
         Guard myGuard = smPackage.getGuard().createGuard();
         super.initialize(myGuard);
         return myGuard;
     }
 
 
-    public Object createPseudostate() {
+    public Pseudostate createPseudostate() {
         Pseudostate myPseudostate = smPackage.getPseudostate()
                 .createPseudostate();
         super.initialize(myPseudostate);
@@ -143,7 +140,7 @@
     }
 
 
-    public Object createSignalEvent() {
+    public SignalEvent createSignalEvent() {
         SignalEvent mySignalEvent = smPackage.getSignalEvent()
                 .createSignalEvent();
         super.initialize(mySignalEvent);
@@ -151,7 +148,7 @@
     }
 
 
-    public Object createSimpleState() {
+    public SimpleState createSimpleState() {
         SimpleState mySimpleState = smPackage.getSimpleState()
                 .createSimpleState();
         super.initialize(mySimpleState);
@@ -159,7 +156,7 @@
     }
 
 
-    public Object createStateMachine() {
+    public StateMachine createStateMachine() {
         StateMachine myStateMachine = smPackage.getStateMachine()
                 .createStateMachine();
         super.initialize(myStateMachine);
@@ -167,14 +164,14 @@
     }
 
 
-    public Object createStubState() {
+    public StubState createStubState() {
         StubState myStubState = smPackage.getStubState().createStubState();
         super.initialize(myStubState);
         return myStubState;
     }
 
 
-    public Object createSubmachineState() {
+    public SubmachineState createSubmachineState() {
         SubmachineState mySubmachineState = smPackage.getSubmachineState()
                 .createSubmachineState();
         super.initialize(mySubmachineState);
@@ -182,30 +179,31 @@
     }
 
 
-    public Object createSynchState() {
+    public SynchState createSynchState() {
         SynchState mySynchState = smPackage.getSynchState().createSynchState();
         super.initialize(mySynchState);
         return mySynchState;
     }
 
 
-    public Object createTimeEvent() {
+    public TimeEvent createTimeEvent() {
         TimeEvent myTimeEvent = smPackage.getTimeEvent().createTimeEvent();
         super.initialize(myTimeEvent);
         return myTimeEvent;
     }
 
 
-    public Object createTransition() {
+    public Transition createTransition() {
         Transition myTransition = smPackage.getTransition().createTransition();
         super.initialize(myTransition);
         return myTransition;
     }
 
 
-    public Object buildCompositeStateOnStateMachine(Object statemachine) {
+    public CompositeState buildCompositeStateOnStateMachine(
+            Object statemachine) {
         if (statemachine instanceof StateMachine) {
-            CompositeState state = (CompositeState) createCompositeState();
+            CompositeState state = createCompositeState();
             state.setStateMachine((StateMachine) statemachine);
             state.setName("top");
             return state;
@@ -214,12 +212,12 @@
     }
 
 
-    public Object buildStateMachine(Object oContext) {
+    public StateMachine buildStateMachine(Object oContext) {
         if (oContext != null
                 && (modelImpl.getStateMachinesHelper().
                         isAddingStatemachineAllowed(oContext))) {
             
-            StateMachine machine = (StateMachine) createStateMachine();
+            StateMachine machine = createStateMachine();
             ModelElement context = (ModelElement) oContext;
             machine.setContext(context);
             if (context instanceof Classifier) {
@@ -237,7 +235,7 @@
     }
 
 
-    public Object buildTransition(Object owningState, Object source, 
+    public Transition buildTransition(Object owningState, Object source, 
             Object dest) {
         if (!(owningState instanceof CompositeState)) {
             throw new IllegalArgumentException("owningState");
@@ -252,7 +250,7 @@
         CompositeState compositeState = (CompositeState) owningState;
         if (compositeState.getSubvertex().contains(source)
                 && compositeState.getSubvertex().contains(dest)) {
-    	    Transition trans = (Transition) createTransition();
+    	    Transition trans = createTransition();
     	    compositeState.getInternalTransition().add(trans);
     	    trans.setSource((StateVertex) source);
     	    trans.setTarget((StateVertex) dest);
@@ -264,9 +262,9 @@
     }
 
 
-    public Object buildPseudoState(Object compositeState) {
+    public Pseudostate buildPseudoState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            Pseudostate state = (Pseudostate) createPseudostate();
+            Pseudostate state = createPseudostate();
             state.setKind(PseudostateKindEnum.PK_CHOICE);
             state.setContainer((CompositeState) compositeState);
             ((CompositeState) compositeState).getSubvertex().add(state);
@@ -277,9 +275,9 @@
     }
 
 
-    public Object buildSynchState(Object compositeState) {
+    public SynchState buildSynchState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            SynchState state = (SynchState) createSynchState();
+            SynchState state = createSynchState();
             state.setBound(0);
             state.setContainer((CompositeState) compositeState);
             return state;
@@ -289,9 +287,9 @@
     }
 
 
-    public Object buildStubState(Object compositeState) {
+    public StubState buildStubState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            StubState state = (StubState) createStubState();
+            StubState state = createStubState();
             state.setReferenceState("");
             state.setContainer((CompositeState) compositeState);
             return state;
@@ -301,9 +299,9 @@
     }
 
 
-    public Object buildCompositeState(Object compositeState) {
+    public CompositeState buildCompositeState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            CompositeState state = (CompositeState) createCompositeState();
+            CompositeState state = createCompositeState();
             state.setConcurrent(false);
             state.setContainer((CompositeState) compositeState);
             return state;
@@ -313,9 +311,9 @@
     }
 
 
-    public Object buildSimpleState(Object compositeState) {
+    public SimpleState buildSimpleState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            SimpleState state = (SimpleState) createSimpleState();
+            SimpleState state = createSimpleState();
             state.setContainer((CompositeState) compositeState);
             return state;
         }
@@ -324,9 +322,9 @@
     }
 
 
-    public Object buildFinalState(Object compositeState) {
+    public FinalState buildFinalState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            FinalState state = (FinalState) createFinalState();
+            FinalState state = createFinalState();
             state.setContainer((CompositeState) compositeState);
             return state;
         }
@@ -335,9 +333,9 @@
     }
 
 
-    public Object buildSubmachineState(Object compositeState) {
+    public SubmachineState buildSubmachineState(Object compositeState) {
         if (compositeState instanceof CompositeState) {
-            SubmachineState state = (SubmachineState) createSubmachineState();
+            SubmachineState state = createSubmachineState();
             state.setContainer((CompositeState) compositeState);
             return state;
         }
@@ -346,9 +344,9 @@
     }
 
 
-    public Object buildInternalTransition(Object state) {
+    public Transition buildInternalTransition(Object state) {
         if (state instanceof State) {
-            Transition trans = (Transition) createTransition();
+            Transition trans = createTransition();
             ((State) state).getInternalTransition().add(trans);
             trans.setSource((State) state);
             trans.setTarget((State) state);
@@ -358,9 +356,9 @@
     }
 
 
-    public Object buildTransition(Object source, Object target) {
+    public Transition buildTransition(Object source, Object target) {
         if (source instanceof StateVertex && target instanceof StateVertex) {
-            Transition trans = (Transition) createTransition();
+            Transition trans = createTransition();
             trans.setSource((StateVertex) source);
             trans.setTarget((StateVertex) target);
             trans.setStateMachine((StateMachine) modelImpl.
@@ -371,19 +369,19 @@
     }
 
 
-    public Object buildCallEvent(Object ns) {
-        CallEvent event = (CallEvent) createCallEvent();
+    public CallEvent buildCallEvent(Object ns) {
+        CallEvent event = createCallEvent();
         event.setNamespace((Namespace) ns);
         event.setName("");
         return event;
     }
 
 
-    public Object buildCallEvent(Object trans, String name, Object ns) {
+    public CallEvent buildCallEvent(Object trans, String name, Object ns) {
         if (!(trans instanceof Transition)) {
             throw new IllegalArgumentException();
         }
-        CallEvent evt = (CallEvent) createCallEvent();
+        CallEvent evt = createCallEvent();
         evt.setNamespace((Namespace) ns);
 
         String operationName = (name.indexOf("(") > 0) ? name.substring(0,
@@ -398,32 +396,32 @@
     }
 
 
-    public Object buildSignalEvent(Object ns) {
-        SignalEvent event = (SignalEvent) createSignalEvent();
+    public SignalEvent buildSignalEvent(Object ns) {
+        SignalEvent event = createSignalEvent();
         event.setNamespace((Namespace) ns);
         event.setName("");
         return event;
     }
 
 
-    public Object buildSignalEvent(String name, Object ns) {
-        SignalEvent event = (SignalEvent) createSignalEvent();
+    public SignalEvent buildSignalEvent(String name, Object ns) {
+        SignalEvent event = createSignalEvent();
         event.setNamespace((Namespace) ns);
         event.setName(name);
         return event;
     }
 
 
-    public Object buildTimeEvent(Object ns) {
-        TimeEvent event = (TimeEvent) createTimeEvent();
+    public TimeEvent buildTimeEvent(Object ns) {
+        TimeEvent event = createTimeEvent();
         event.setNamespace((Namespace) ns);
         event.setName("");
         return event;
     }
 
 
-    public Object buildTimeEvent(String s, Object ns) {
-        TimeEvent event = (TimeEvent) createTimeEvent();
+    public TimeEvent buildTimeEvent(String s, Object ns) {
+        TimeEvent event = createTimeEvent();
         event.setNamespace((Namespace) ns);
         event.setName("");
         Object te = modelImpl.getDataTypesFactory().createTimeExpression("", s);
@@ -432,33 +430,31 @@
     }
 
 
-    public Object buildChangeEvent(Object ns) {
-        ChangeEvent event = (ChangeEvent) createChangeEvent();
+    public ChangeEvent buildChangeEvent(Object ns) {
+        ChangeEvent event =  createChangeEvent();
         event.setNamespace((Namespace) ns);
         event.setName("");
         return event;
     }
 
 
-    public Object buildChangeEvent(String s, Object ns) {
-        ChangeEvent event = (ChangeEvent) createChangeEvent();
-        event.setNamespace((Namespace) ns);
-        event.setName("");
+    public ChangeEvent buildChangeEvent(String expression, Object ns) {
+        ChangeEvent event = buildChangeEvent(ns);
         Object ce = modelImpl.getDataTypesFactory()
-                .createBooleanExpression("", s);
+                .createBooleanExpression("", expression);
         event.setChangeExpression((BooleanExpression) ce);
         return event;
     }
 
 
-    public Object buildGuard(Object transition) {
+    public Guard buildGuard(Object transition) {
         if (transition instanceof Transition) {
             Transition t = (Transition) transition;
             if (t.getGuard() != null) {
                 LOG.warn("Replacing Guard " + t.getGuard().getName() 
                         + " on Transition " + t.getName());
             }
-            Guard guard = (Guard) createGuard();
+            Guard guard = createGuard();
             guard.setTransition((Transition) transition);
             return guard;
         }
@@ -496,10 +492,7 @@
             throw new IllegalArgumentException();
         }
 
-        Collection vertices = ((CompositeState) elem).getSubvertex();
-        Iterator it = vertices.iterator();
-        while (it.hasNext()) {
-            StateVertex vertex = (StateVertex) it.next();
+        for (StateVertex vertex : ((CompositeState) elem).getSubvertex()) {
             modelImpl.getUmlFactory().delete(vertex);
         }
     }

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/StateMachinesHelperMDRImpl.java	2007-08-06 15:04:42-0700
@@ -27,8 +27,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
 
 import javax.jmi.reflect.InvalidObjectException;
 
@@ -52,6 +50,7 @@
 import org.omg.uml.foundation.core.BehavioralFeature;
 import org.omg.uml.foundation.core.Classifier;
 import org.omg.uml.foundation.core.ModelElement;
+import org.omg.uml.foundation.core.Operation;
 import org.omg.uml.foundation.datatypes.BooleanExpression;
 import org.omg.uml.foundation.datatypes.Expression;
 import org.omg.uml.foundation.datatypes.TimeExpression;
@@ -163,11 +162,11 @@
     }
 
 
-    public Collection getAllPossibleStatemachines(Object model,
+    public Collection<StateMachine> getAllPossibleStatemachines(Object model,
             Object oSubmachineState) {
         try {
             if (oSubmachineState instanceof SubmachineState) {
-                Collection statemachines =
+                Collection<StateMachine> statemachines =
                     Model.getModelManagementHelper()
                         .getAllModelElementsOfKind(model, StateMachine.class);
                 statemachines.remove(getStateMachine(oSubmachineState));
@@ -181,22 +180,21 @@
     }
 
 
-    public Collection getAllPossibleSubvertices(Object oState) {
-        ArrayList v = new ArrayList();
-        List v2 = new ArrayList();
+    // TODO: getAllPossibleSubvertices and getAllSubStates are duplicates - tfm
+    public Collection<StateVertex> getAllPossibleSubvertices(Object oState) {
+        Collection<StateVertex> result = new ArrayList<StateVertex>();
         try {
             if (oState instanceof CompositeState) {
-                v.addAll(((CompositeState) oState).getSubvertex());
-                v2 = (ArrayList) v.clone();
-                Iterator it = v2.iterator();
-                while (it.hasNext()) {
-                    v.addAll(getAllPossibleSubvertices(it.next()));
+                for (StateVertex vertex 
+                        : ((CompositeState) oState).getSubvertex()) {
+                    result.add(vertex);
+                    result.addAll(getAllPossibleSubvertices(vertex));
                 }
             }
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
         }
-        return v;
+        return result;
     }
 
 
@@ -226,16 +224,15 @@
     }
 
 
-    public Collection getOutgoingStates(Object ostatevertex) {
+    public Collection<StateVertex> getOutgoingStates(Object ostatevertex) {
         try {
             if (ostatevertex instanceof StateVertex) {
                 StateVertex statevertex = (StateVertex) ostatevertex;
-                Collection col = new ArrayList();
-                Iterator it = statevertex.getOutgoing().iterator();
-                while (it.hasNext()) {
-                    col.add(((Transition) it.next()).getTarget());
+                Collection<StateVertex> result = new ArrayList<StateVertex>();
+                for (Transition transition : statevertex.getOutgoing()) {
+                    result.add(transition.getTarget());
                 }
-                return col;
+                return result;
             }
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
@@ -253,10 +250,9 @@
             Object sm = getStateMachine(trans);
             Object ns = Model.getFacade().getNamespace(sm);
             if (ns instanceof Classifier) {
-                Collection c = Model.getFacade().getOperations(ns);
-                Iterator i = c.iterator();
-                while (i.hasNext()) {
-                    Object op = i.next();
+                Collection<Operation> operations = 
+                    Model.getFacade().getOperations(ns);
+                for (Operation op : operations) {
                     String on = ((ModelElement) op).getName();
                     if (on.equals(opname)) {
                         return op;
@@ -270,20 +266,19 @@
     }
 
 
-    public Collection getAllSubStates(Object compState) {
+    // TODO: getAllPossibleSubvertices and getAllSubStates are duplicates - tfm
+    public Collection<StateVertex> getAllSubStates(Object compState) {
         try {
             if (compState instanceof CompositeState) {
-                List retList = new ArrayList();
-                Iterator it =
-                    Model.getFacade().getSubvertices(compState).iterator();
-                while (it.hasNext()) {
-                    Object subState = it.next();
+                Collection<StateVertex> result = new ArrayList<StateVertex>();
+                for (Object subState : Model.getFacade().getSubvertices(
+                        compState)) {
                     if (subState instanceof CompositeState) {
-                        retList.addAll(getAllSubStates(subState));
+                        result.addAll(getAllSubStates(subState));
                     }
-                    retList.add(subState);
+                    result.add((StateVertex) subState);
                 }
-                return retList;
+                return result;
             }
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
@@ -436,18 +431,13 @@
             Collection internalTransitions =
                 Model.getFacade().getInternalTransitions(handle);
             if (!internalTransitions.isEmpty()) {
-                Vector verts = new Vector();
-                verts.addAll(internalTransitions);
-                Iterator toRemove = verts.iterator();
-                while (toRemove.hasNext()) {
-                    removeTransition(handle, toRemove.next());
+                Collection trans = new ArrayList(internalTransitions);
+                for (Object transition : trans) {
+                    removeTransition(handle, transition);
                 }
             }
-            if (!intTrans.isEmpty()) {
-                Iterator toAdd = intTrans.iterator();
-                while (toAdd.hasNext()) {
-                    addTransition(handle, toAdd.next());
-                }
+            for (Object transition : intTrans) {
+                addTransition(handle, transition);
             }
             return;
         }
@@ -528,18 +518,13 @@
         if (handle instanceof CompositeState) {
             Collection vertices = Model.getFacade().getSubvertices(handle);
             if (!vertices.isEmpty()) {
-                Vector verts = new Vector();
-                verts.addAll(vertices);
-                Iterator toRemove = verts.iterator();
-                while (toRemove.hasNext()) {
-                    removeSubvertex(handle, toRemove.next());
+                Collection verts = new ArrayList(vertices);
+                for (Object vertex : verts) {
+                    removeSubvertex(handle, vertex);
                 }
             }
-            if (!subvertices.isEmpty()) {
-                Iterator toAdd = subvertices.iterator();
-                while (toAdd.hasNext()) {
-                    addSubvertex(handle, toAdd.next());
-                }
+            for (Object vertex : subvertices) {
+                addSubvertex(handle, vertex);
             }
             return;
         }

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesFactoryMDRImpl.java	2007-08-06 15:04:42-0700
@@ -63,20 +63,16 @@
         modelImpl = implementation;
     }
 
-    /*
-     * @see org.argouml.model.UseCasesFactory#createExtend()
-     */
-    public Object createExtend() {
+
+    public Extend createExtend() {
         Extend myExtend = modelImpl.getUmlPackage().getUseCases().getExtend().
             createExtend();
         super.initialize(myExtend);
         return myExtend;
     }
 
-    /*
-     * @see org.argouml.model.UseCasesFactory#createExtensionPoint()
-     */
-    public Object createExtensionPoint() {
+
+    public ExtensionPoint createExtensionPoint() {
         ExtensionPoint myExtensionPoint = modelImpl.getUmlPackage().
             getUseCases().getExtensionPoint().createExtensionPoint();
         super.initialize(myExtensionPoint);
@@ -84,7 +80,7 @@
     }
 
 
-    public Object createActor() {
+    public Actor createActor() {
         Actor myActor = modelImpl.getUmlPackage().getUseCases().getActor().
             createActor();
         super.initialize(myActor);
@@ -92,7 +88,7 @@
     }
 
 
-    public Object createInclude() {
+    public Include createInclude() {
         Include myInclude = modelImpl.getUmlPackage().getUseCases()
                 .getInclude().createInclude();
         super.initialize(myInclude);
@@ -100,7 +96,7 @@
     }
 
 
-    public Object createUseCase() {
+    public UseCase createUseCase() {
         UseCase myUseCase = modelImpl.getUmlPackage().getUseCases()
                 .getUseCase().createUseCase();
         super.initialize(myUseCase);
@@ -110,7 +106,7 @@
 
 
     @SuppressWarnings("deprecation")
-    public Object createUseCaseInstance() {
+    public UseCaseInstance createUseCaseInstance() {
         UseCaseInstance myUseCaseInstance = modelImpl.getUmlPackage().
             getUseCases().getUseCaseInstance().createUseCaseInstance();
         super.initialize(myUseCaseInstance);
@@ -118,12 +114,12 @@
     }
 
 
-    public Object buildExtend(Object abase, Object anextension) {
+    public Extend buildExtend(Object abase, Object anextension) {
         return buildExtend(abase, anextension, null);
     }
 
 
-    public Object buildExtend(Object abase, Object anextension, Object apoint) {
+    public Extend buildExtend(Object abase, Object anextension, Object apoint) {
         UseCase base = (UseCase) abase;
         UseCase extension = (UseCase) anextension;
         ExtensionPoint point = (ExtensionPoint) apoint;
@@ -143,7 +139,7 @@
         } else {
             point = (ExtensionPoint) buildExtensionPoint(base);
         }
-        Extend extend = (Extend) createExtend();
+        Extend extend = createExtend();
         extend.setBase(base);
         extend.setExtension(extension);
         extend.getExtensionPoint().add(point);
@@ -151,16 +147,14 @@
     }
 
 
-    public Object buildExtensionPoint(Object modelElement) {
+    public ExtensionPoint buildExtensionPoint(Object modelElement) {
         if (!(modelElement instanceof UseCase)) {
             throw new IllegalArgumentException("An extension point can only "
                     + "be built on a use case");
         }
 
         UseCase useCase = (UseCase) modelElement;
-        ExtensionPoint extensionPoint = 
-            (ExtensionPoint) createExtensionPoint();
-
+        ExtensionPoint extensionPoint = createExtensionPoint();
         extensionPoint.setUseCase(useCase);
 
         // For consistency with attribute and operation, give it a default
@@ -171,11 +165,10 @@
     }
 
 
-    public Object buildInclude(Object/* MUseCase */abase,
-            Object/* MUseCase */anaddition) {
+    public Include buildInclude(Object abase, Object anaddition) {
         UseCase base = (UseCase) abase;
         UseCase addition = (UseCase) anaddition;
-        Include include = (Include) createInclude();
+        Include include = createInclude();
 
         include.setAddition(addition);
         include.setBase(base);
@@ -204,7 +197,7 @@
         if (ns == null) {
             ns = (Namespace) model;
         }
-        Actor actor = (Actor) createActor();
+        Actor actor = createActor();
         actor.setNamespace(ns);
         actor.setLeaf(false);
         actor.setRoot(false);
@@ -212,7 +205,7 @@
     }
 
 
-    public Object buildActor(Object actor, Object model) {
+    public Actor buildActor(Object actor, Object model) {
         if (actor instanceof Actor) {
             return buildActor(((Actor) actor).getNamespace(), model);
         }

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java?view=diff&rev=13258&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java&r1=13257&r2=13258
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/UseCasesHelperMDRImpl.java	2007-08-06 15:04:42-0700
@@ -27,10 +27,8 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-import java.util.Vector;
 
 import javax.jmi.reflect.InvalidObjectException;
 
@@ -124,11 +122,8 @@
         List<UseCase> list = new ArrayList<UseCase>();
         UseCase usecase = (UseCase) ausecase;
         try {
-            Iterator it = usecase.getExtend().iterator();
-            while (it.hasNext()) {
-                Extend extend = (Extend) it.next();
-                UseCase base = extend.getBase();
-                list.add(base);
+            for (Extend extend : usecase.getExtend()) {
+                list.add(extend.getBase());
             }
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
@@ -143,9 +138,8 @@
         }
         List<UseCase> list = new ArrayList<UseCase>();
         try {
-            Iterator it = Model.getFacade().getExtenders(usecase).iterator();
-            while (it.hasNext()) {
-                Extend ext = (Extend) it.next();
+            for (Extend ext : (Collection<Extend>) Model.getFacade()
+                    .getExtenders(usecase)) {
                 UseCase extension = ext.getExtension();
                 list.add(extension);
             }
@@ -156,7 +150,7 @@
     }
 
 
-    public Object getExtends(Object abase, Object anextension) {
+    public Extend getExtends(Object abase, Object anextension) {
         if (!(abase instanceof UseCase)
                 || !(anextension instanceof UseCase)) {
             throw new IllegalArgumentException();
@@ -164,9 +158,7 @@
         UseCase base = (UseCase) abase;
         UseCase extension = (UseCase) anextension;
         try {
-            Iterator it = extension.getExtend().iterator();
-            while (it.hasNext()) {
-                Extend extend = (Extend) it.next();
+            for (Extend extend : extension.getExtend()) {
                 if (extend.getBase() == base) {
                     return extend;
                 }
@@ -182,23 +174,21 @@
         if (!(ausecase instanceof UseCase)) {
             throw new IllegalArgumentException();
         }
-        List<UseCase> list = new ArrayList<UseCase>();
+        List<UseCase> result = new ArrayList<UseCase>();
         UseCase usecase = (UseCase) ausecase;
         try {
-            Iterator it = usecase.getInclude().iterator();
-            while (it.hasNext()) {
-                Include include = (Include) it.next();
+            for (Include include : usecase.getInclude()) {
                 UseCase addition = include.getBase();
-                list.add(addition);
+                result.add(addition);
             }
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
         }
-        return list;
+        return result;
     }
 
 
-    public Object getIncludes(Object abase, Object aninclusion) {
+    public Include getIncludes(Object abase, Object aninclusion) {
         if (!(abase instanceof UseCase)
                 || !(aninclusion instanceof UseCase)) {
             throw new IllegalArgumentException();
@@ -206,9 +196,7 @@
         UseCase base = (UseCase) abase;
         UseCase inclusion = (UseCase) aninclusion;
         try {
-            Iterator it = inclusion.getInclude().iterator();
-            while (it.hasNext()) {
-                Include include = (Include) it.next();
+            for (Include include : inclusion.getInclude()) {
                 if (include.getBase() == base) {
                     return include;
                 }
@@ -227,9 +215,7 @@
             set.addAll(modelImpl.getModelManagementHelper().
                     getAllSurroundingNamespaces(uc));
             Set set2 = new HashSet();
-            Iterator it = set.iterator();
-            while (it.hasNext()) {
-                Object o = it.next();
+            for (Object o : set) {
                 if (o instanceof Subsystem || o instanceof UmlClass) {
                     set2.add(o);
                 }
@@ -261,9 +247,7 @@
             if (base == theExtend.getBase()) {
                 return;
             }
-            Iterator it = theExtend.getExtensionPoint().iterator();
-            while (it.hasNext()) {
-                ExtensionPoint point = (ExtensionPoint) it.next();
+            for (ExtensionPoint point : theExtend.getExtensionPoint()) {
                 removeExtend(point, theExtend);
             }
             ExtensionPoint point =
@@ -448,20 +432,19 @@
 
     public void setExtensionPoints(Object handle, Collection extensionPoints) {
         if (handle instanceof UseCase || handle instanceof Extend) {
-            Collection eps = Model.getFacade().getExtensionPoints(handle);
+            // TODO: This should use a minimal update strategy instead of
+            // removing all and then adding all - tfm - 20070806
+            Collection<ExtensionPoint> eps = 
+                Model.getFacade().getExtensionPoints(handle);
             if (!eps.isEmpty()) {
-                Vector extPts = new Vector();
-                extPts.addAll(eps);
-                Iterator toRemove = extPts.iterator();
-                while (toRemove.hasNext()) {
-                    removeExtensionPoint(handle, toRemove.next());
+                Collection<ExtensionPoint> extPts = 
+                    new ArrayList<ExtensionPoint>(eps);
+                for (ExtensionPoint ep : extPts) {
+                    removeExtensionPoint(handle, ep);
                 }
             }
-            if (!extensionPoints.isEmpty()) {
-                Iterator toAdd = extensionPoints.iterator();
-                while (toAdd.hasNext()) {
-                    addExtensionPoint(handle, toAdd.next());
-                }
+            for (Object ep : extensionPoints) {
+                addExtensionPoint(handle, ep);
             }
             return;
         }
@@ -474,8 +457,7 @@
         if (handle instanceof UseCase) {
             Collection<Include> inc = Model.getFacade().getIncludes(handle);
             if (!inc.isEmpty()) {
-                List<Include> in = new ArrayList<Include>();
-                in.addAll(inc);
+                Collection<Include> in = new ArrayList<Include>(inc);
                 for (Include i : in) {
                     removeInclude(handle, i);
                 }
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.