Author: jm
Date: 2012-01-11 12:01:48 -0800 (Wed, 11 Jan 2012)
New Revision: 27982

Modified:
   
core3/impl/trunk/layout-cytoscape-impl/src/main/java/csapps/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
Log:
References #367: Fixed usage of Map.containsKey().  Fixed 
ArrayOutOfBoundsException.

Modified: 
core3/impl/trunk/layout-cytoscape-impl/src/main/java/csapps/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
===================================================================
--- 
core3/impl/trunk/layout-cytoscape-impl/src/main/java/csapps/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
       2012-01-11 19:56:45 UTC (rev 27981)
+++ 
core3/impl/trunk/layout-cytoscape-impl/src/main/java/csapps/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
       2012-01-11 20:01:48 UTC (rev 27982)
@@ -122,12 +122,7 @@
                for (int i = 0; i < bc.length; i++)
                        if (bc[i].length > 3) {
                                for (int j = 0; j < bc[i].length; j++) {
-                                       if (!node2BiComp.containsKey(bc[i][j]))
-                                               
node2BiComp.put(Integer.valueOf(bc[i][j]), Integer.valueOf(i));
-                                       else if (bc[i].length > 
bc[node2BiComp.get(bc[i][j]).intValue()].length) {
-                                               
node2BiComp.remove(Integer.valueOf(bc[i][j])); // check this
-                                               
node2BiComp.put(Integer.valueOf(bc[i][j]), Integer.valueOf(i));
-                                       }
+                                       node2BiComp.put(bc[i][j], i);
                                }
                        }
 
@@ -240,8 +235,9 @@
                innerDeltaAngle = (2 * Math.PI) / bc[compIndex].length;
 
                if (firstTouched != -1) {
-                       pointX = 
nodeViews.get(firstTouched).getVisualProperty(MinimalVisualLexicon.NODE_X_LOCATION);
-                       pointY = 
nodeViews.get(firstTouched).getVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION);
+                       View<CyNode> view = nodeViews.get(firstTouched);
+                       pointX = 
view.getVisualProperty(MinimalVisualLexicon.NODE_X_LOCATION);
+                       pointY = 
view.getVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION);
                        theAngle = Math.asin((startY - pointY) / 
Math.sqrt(((pointX - startX) * (pointX
                                                                                
                - startX))
                                                                           + 
((pointY - startY) * (pointY
@@ -382,8 +378,9 @@
                                        continue;
                                }
 
-                               pointX = 
nodeViews.get(currentNeighbour).getVisualProperty(MinimalVisualLexicon.NODE_X_LOCATION);
-                               pointY = 
nodeViews.get(currentNeighbour).getVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION);
+                               View<CyNode> view = 
nodeViews.get(currentNeighbour);
+                               pointX = 
view.getVisualProperty(MinimalVisualLexicon.NODE_X_LOCATION);
+                               pointY = 
view.getVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION);
 
                                theAngle = Math.asin((startY - pointY) / 
Math.sqrt(((pointX - startX) * (pointX
                                                                                
                        - startX))
@@ -846,9 +843,10 @@
                        int count = 0;
                        //System.out.print(j + " ");
 
-                       if (((outerPositionsTaken[i % 
outerPositionsTaken.length] > innerCirclePos)
-                           && ((outerPositionsTaken[i % 
outerPositionsTaken.length] - innerCirclePos) < (0.7 * innerCSize)))
-                           || ((innerCirclePos - outerPositionsTaken[i % 
outerPositionsTaken.length]) > (0.7 * innerCSize))) {
+                       int index = (i % outerPositionsTaken.length + 
outerPositionsTaken.length) % outerPositionsTaken.length;
+                       if (((outerPositionsTaken[index] > innerCirclePos)
+                           && ((outerPositionsTaken[index] - innerCirclePos) < 
(0.7 * innerCSize)))
+                           || ((innerCirclePos - outerPositionsTaken[index]) > 
(0.7 * innerCSize))) {
                                j--;
                                i--;
                        }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to