svn commit: r13324 - trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-08-13 19:35:33-0700
New Revision: 13324

Modified:
   trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java

Log:
Style cleanup and Java 5 loops.

Modified: trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java?view=diff&rev=13324&p1=trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java&r1=13323&r2=13324
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java	(original)
+++ trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java	2007-08-13 19:35:33-0700
@@ -26,7 +26,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.argouml.model.Model;
 import org.argouml.uml.ui.UMLComboBoxModel2;
@@ -52,6 +51,7 @@
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
      */
+    @Override
     protected void buildModelList() {
         removeAllElements();
         Object ar = getTarget();
@@ -60,17 +60,22 @@
             setElements(
                     Model.getCollaborationsHelper().getAllPossibleBases(ar));
         }
-        if (base != null) addElement(base);
+        if (base != null) {
+            addElement(base);
+        }
     }
 
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
      */
+    @Override
     protected Object getSelectedModelElement() {
         Object ar = getTarget();
         if (Model.getFacade().isAAssociationRole(ar)) {
             Object base = Model.getFacade().getBase(ar);
-            if (base != null) return base;
+            if (base != null) {
+                return base;
+            }
         }
         return null;
     }
@@ -78,11 +83,14 @@
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
      */
+    @Override
     protected boolean isValidElement(Object element) {
         Object ar = getTarget();
         if (Model.getFacade().isAAssociationRole(ar)) {
             Object base = Model.getFacade().getBase(ar);
-            if (element == base) return true;
+            if (element == base) {
+                return true;
+            }
             Collection b = 
                 Model.getCollaborationsHelper().getAllPossibleBases(ar);
             return b.contains(element);
@@ -96,23 +104,18 @@
      * 
      * @see org.argouml.uml.ui.UMLComboBoxModel2#addOtherModelEventListeners(java.lang.Object)
      */
+    @Override
     protected void addOtherModelEventListeners(Object newTarget) {
         super.addOtherModelEventListeners(newTarget);
         Collection connections = Model.getFacade().getConnections(newTarget);
         Collection types = new ArrayList();
-        Iterator it = connections.iterator();
-        while (it.hasNext()) {
-            Object conn = it.next();
+        for (Object conn : connections) {
             types.add(Model.getFacade().getType(conn));
         }
-        it = types.iterator();
-        while (it.hasNext()) {
-            Object classifierRole = it.next();
+        for (Object classifierRole : types) {
             others.addAll(Model.getFacade().getBases(classifierRole));
         }
-        it = others.iterator();
-        while (it.hasNext()) {
-            Object classifier = it.next();
+        for (Object classifier : others) {
             Model.getPump().addModelEventListener(this, 
                     classifier, "feature");
         }
@@ -121,11 +124,10 @@
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#removeOtherModelEventListeners(java.lang.Object)
      */
+    @Override
     protected void removeOtherModelEventListeners(Object oldTarget) {
         super.removeOtherModelEventListeners(oldTarget);
-        Iterator i = others.iterator();
-        while (i.hasNext()) {
-            Object classifier = i.next();
+        for (Object classifier : others) {
             Model.getPump().removeModelEventListener(this, 
                     classifier, "feature");
         }
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.