Author: scooter
Date: 2010-10-26 13:01:25 -0700 (Tue, 26 Oct 2010)
New Revision: 22464
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/groups/CyGroupImpl.java
Log:
Need to check for the case where we create an (initially empty) group.
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/groups/CyGroupImpl.java
===================================================================
--- cytoscape/trunk/application/src/main/java/cytoscape/groups/CyGroupImpl.java
2010-10-26 19:36:06 UTC (rev 22463)
+++ cytoscape/trunk/application/src/main/java/cytoscape/groups/CyGroupImpl.java
2010-10-26 20:01:25 UTC (rev 22464)
@@ -153,8 +153,13 @@
this.groupNode = groupNode;
this.groupName = this.groupNode.getIdentifier();
- if (nodeList == null && internalEdges == null && externalEdges
== null)
+ if (nodeList == null && internalEdges == null && externalEdges
== null) {
+ CytoscapeRootGraph rootGraph = Cytoscape.getRootGraph();
+ Node[] nodeArray = null;
+ Edge[] edgeArray = null;
+ myGraph = rootGraph.createNetwork(nodeArray, edgeArray);
return;
+ }
// System.out.println(" Group "+groupNode+" has
"+nodeList.size()+" nodes");
@@ -576,29 +581,31 @@
// Add all of the edges
List<CyEdge> adjacentEdges =
(List<CyEdge>)groupNetwork.getAdjacentEdgesList(node, true, true, true);
- for (CyEdge edge: adjacentEdges) {
- // Not sure if this is faster or slower than going
through the entire loop
- if (myGraph.containsEdge(edge))
- continue;
-
- edgeList.add(edge);
- CyNode target = (CyNode)edge.getTarget();
- CyNode source = (CyNode)edge.getSource();
-
- // Check to see if this edge is one of our own metaEdges
- if (source == groupNode || target == groupNode) {
- // It is -- skip it
- continue;
+ if (adjacentEdges != null) {
+ for (CyEdge edge: adjacentEdges) {
+ // Not sure if this is faster or slower than
going through the entire loop
+ if (myGraph.containsEdge(edge))
+ continue;
+
+ edgeList.add(edge);
+ CyNode target = (CyNode)edge.getTarget();
+ CyNode source = (CyNode)edge.getSource();
+
+ // Check to see if this edge is one of our own
metaEdges
+ if (source == groupNode || target == groupNode)
{
+ // It is -- skip it
+ continue;
+ }
+
+ if (outerEdgeMap.containsKey(edge)) {
+ outerEdgeMap.remove(edge);
+ myGraph.addEdge(edge);
+ } else if (myGraph.containsNode(target) &&
myGraph.containsNode(source)) {
+ myGraph.addEdge(edge);
+ } else if (myGraph.containsNode(target) ||
myGraph.containsNode(source)) {
+ outerEdgeMap.put(edge,edge);
+ }
}
-
- if (outerEdgeMap.containsKey(edge)) {
- outerEdgeMap.remove(edge);
- myGraph.addEdge(edge);
- } else if (myGraph.containsNode(target) &&
myGraph.containsNode(source)) {
- myGraph.addEdge(edge);
- } else if (myGraph.containsNode(target) ||
myGraph.containsNode(source)) {
- outerEdgeMap.put(edge,edge);
- }
}
nodeToEdgeMap.put(node, edgeList);
--
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.