Author: ruschein
Date: 2010-01-15 12:37:52 -0800 (Fri, 15 Jan 2010)
New Revision: 18931

Modified:
   
csplugins/trunk/ucsd/ruschein/BipartiteVisualiser/src/org/cytoscape/BipartiteVisualiserPlugin/BipartiteLayoutContextMenuListener.java
Log:
Computed the set of possible reference networks.

Modified: 
csplugins/trunk/ucsd/ruschein/BipartiteVisualiser/src/org/cytoscape/BipartiteVisualiserPlugin/BipartiteLayoutContextMenuListener.java
===================================================================
--- 
csplugins/trunk/ucsd/ruschein/BipartiteVisualiser/src/org/cytoscape/BipartiteVisualiserPlugin/BipartiteLayoutContextMenuListener.java
       2010-01-15 20:09:05 UTC (rev 18930)
+++ 
csplugins/trunk/ucsd/ruschein/BipartiteVisualiser/src/org/cytoscape/BipartiteVisualiserPlugin/BipartiteLayoutContextMenuListener.java
       2010-01-15 20:37:52 UTC (rev 18931)
@@ -1,9 +1,14 @@
 package org.cytoscape.BipartiteVisualiserPlugin;
 
+import java.util.Set;
 import java.util.SortedSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.TreeSet;
 
 import giny.model.Edge;
 import giny.model.Node;
+import giny.model.GraphPerspective;
 import giny.view.EdgeView;
 
 import javax.swing.JMenuItem;
@@ -49,9 +54,29 @@
                                                edgeView,parentNetwork, 
network1, network2));
 
        }
-       
+
+       /**
+        * @returns a set of all the networks that are not "parentNetwork" or a 
nested network of a
+        *          node in "parentNetwork."
+        */
        private SortedSet<CyNetwork> getReferenceNetworkCandidates(final 
CyNetwork parentNetwork) { 
-               return null;
+               // Determine the set of networks that can't possible be 
candidates for the reference network:
+               final Set<CyNetwork> verboten = new HashSet<CyNetwork>();
+               verboten.add(parentNetwork);
+               @SuppressWarnings("unchecked") final List<Node> nodes = 
parentNetwork.nodesList();
+               for (final Node node : nodes) {
+                       final GraphPerspective nestedNetwork = 
node.getNestedNetwork();
+                       if (nestedNetwork != null)
+                               verboten.add((CyNetwork)nestedNetwork);
+               }
+
+               final SortedSet<CyNetwork> candidates = new 
TreeSet<CyNetwork>();
+               for (final CyNetwork candidate : Cytoscape.getNetworkSet()) {
+                       if (!verboten.contains(candidate))
+                               candidates.add(candidate);
+               }
+
+               return candidates;
        }
 
 }

-- 
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