Revision: 20974
          http://sourceforge.net/p/jmol/code/20974
Author:   hansonr
Date:     2016-03-03 22:54:00 +0000 (Thu, 03 Mar 2016)
Log Message:
-----------
code simplification

Modified Paths:
--------------
    branches/v14_4/Jmol/src/org/jmol/shape/Object2dShape.java

Modified: branches/v14_4/Jmol/src/org/jmol/shape/Object2dShape.java
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/shape/Object2dShape.java   2016-03-03 
22:53:23 UTC (rev 20973)
+++ branches/v14_4/Jmol/src/org/jmol/shape/Object2dShape.java   2016-03-03 
22:54:00 UTC (rev 20974)
@@ -41,21 +41,19 @@
     }
 
     if ("delete" == propertyName) {
-      if (currentObject == null) {
-        if (isAll || thisID != null) {
-          Iterator<Text> e = objects.values().iterator();
-          while (e.hasNext()) {
-            Text text = e.next();
-            if (isAll
-                || PT.isMatch(text.target.toUpperCase(), thisID, true, true)) {
-              e.remove();
-            }
+      if (currentObject != null) {
+        objects.remove(currentObject.target);
+        currentObject = null;
+      } else if (isAll || thisID != null) {
+        Iterator<Text> e = objects.values().iterator();
+        while (e.hasNext()) {
+          Text text = e.next();
+          if (isAll
+              || PT.isMatch(text.target.toUpperCase(), thisID, true, true)) {
+            e.remove();
           }
         }
-        return;
       }
-      objects.remove(currentObject.target);
-      currentObject = null;
       return;
     }
 
@@ -76,26 +74,24 @@
 
     if ("model" == propertyName) {
       int modelIndex = ((Integer) value).intValue();
-      if (currentObject == null) {
-        if (isAll)
-          for (Text t : objects.values())
-            t.modelIndex = modelIndex;
-        return;
+      if (currentObject != null) {
+        currentObject.modelIndex = modelIndex;
+      } else if (isAll) {
+        for (Text t : objects.values())
+          t.modelIndex = modelIndex;
       }
-      currentObject.modelIndex = modelIndex;
       return;
     }
 
     if ("align" == propertyName) {
       String align = (String) value;
-      if (currentObject == null) {
-        if (isAll)
-          for (Object2d obj : objects.values())
-            obj.setAlignmentLCR(align);
-        return;
+      if (currentObject != null) {
+        if (!currentObject.setAlignmentLCR(align))
+          Logger.error("unrecognized align:" + align);
+      } else if (isAll) {
+        for (Object2d obj : objects.values())
+          obj.setAlignmentLCR(align);
       }
-      if (!currentObject.setAlignmentLCR(align))
-        Logger.error("unrecognized align:" + align);
       return;
     }
 
@@ -114,20 +110,18 @@
 
     if ("color" == propertyName) {
       currentColor = value;
-      if (currentObject == null) {
-        if (isAll || thisID != null) {
-          Iterator<Text> e = objects.values().iterator();
-          while (e.hasNext()) {
-            Text text = e.next();
-            if (isAll
-                || PT.isMatch(text.target.toUpperCase(), thisID, true, true)) {
-              text.colix = C.getColixO(value);
-            }
+      if (currentObject != null) {
+        currentObject.colix = C.getColixO(value);
+      } else if (isAll || thisID != null) {
+        Iterator<Text> e = objects.values().iterator();
+        while (e.hasNext()) {
+          Text text = e.next();
+          if (isAll
+              || PT.isMatch(text.target.toUpperCase(), thisID, true, true)) {
+            text.colix = C.getColixO(value);
           }
         }
-        return;
       }
-      currentObject.colix = C.getColixO(value);
       return;
     }
 
@@ -149,16 +143,14 @@
         currentBgTranslucentLevel = (isTranslucent ? translucentLevel : 0);
       else
         currentTranslucentLevel = (isTranslucent ? translucentLevel : 0);
-      if (currentObject == null) {
-        if (isAll) {
-          Iterator<Text> e = objects.values().iterator();
-          while (e.hasNext()) {
-            e.next().setTranslucent(translucentLevel, isBackground);
-          }
+      if (currentObject != null) {
+        currentObject.setTranslucent(translucentLevel, isBackground);
+      } else if (isAll) {
+        Iterator<Text> e = objects.values().iterator();
+        while (e.hasNext()) {
+          e.next().setTranslucent(translucentLevel, isBackground);
         }
-        return;
       }
-      currentObject.setTranslucent(translucentLevel, isBackground);
       return;
     }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to