Author: mes
Date: 2010-11-04 14:14:55 -0700 (Thu, 04 Nov 2010)
New Revision: 22724
Modified:
core3/model-impl/trunk/pom.xml
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArraySubGraph.java
core3/model-impl/trunk/src/test/java/org/cytoscape/model/subnetwork/CySubNetworkCyNetworkTest.java
Log:
updated to clarify getIndex behavior
Modified: core3/model-impl/trunk/pom.xml
===================================================================
--- core3/model-impl/trunk/pom.xml 2010-11-04 21:08:20 UTC (rev 22723)
+++ core3/model-impl/trunk/pom.xml 2010-11-04 21:14:55 UTC (rev 22724)
@@ -168,13 +168,13 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>model-api</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>model-api</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha2-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
2010-11-04 21:08:20 UTC (rev 22723)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
2010-11-04 21:14:55 UTC (rev 22724)
@@ -189,10 +189,13 @@
* {...@inheritdoc}
*/
public synchronized CyNode getNode(final int n) {
- if ((n >= 0) && (n < nodePointers.size()))
- return nodePointers.get(n).cyNode;
- else
- return null;
+ if ((n >= 0) && (n < nodePointers.size())) {
+ final NodePointer np = nodePointers.get(n);
+ if ( np != null )
+ return np.cyNode;
+ }
+
+ return null;
}
/**
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArraySubGraph.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArraySubGraph.java
2010-11-04 21:08:20 UTC (rev 22723)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArraySubGraph.java
2010-11-04 21:14:55 UTC (rev 22724)
@@ -209,14 +209,32 @@
* {...@inheritdoc}
*/
public CyNode getNode(final int index) {
- return parent.getNode(index);
+ // get the node from the parent
+ final CyNode n = parent.getNode(index);
+ if ( n == null )
+ return null;
+
+ // make sure the subnetwork still contains the node
+ if ( nodeSet.contains(n) )
+ return n;
+ else
+ return null;
}
/**
* {...@inheritdoc}
*/
public CyEdge getEdge(final int index) {
- return parent.getEdge(index);
+ // get the edge from the parent
+ final CyEdge e = parent.getEdge(index);
+ if ( e == null )
+ return null;
+
+ // make sure the subnetwork still contains the edge
+ if ( edgeSet.contains(e) )
+ return e;
+ else
+ return null;
}
/**
Modified:
core3/model-impl/trunk/src/test/java/org/cytoscape/model/subnetwork/CySubNetworkCyNetworkTest.java
===================================================================
---
core3/model-impl/trunk/src/test/java/org/cytoscape/model/subnetwork/CySubNetworkCyNetworkTest.java
2010-11-04 21:08:20 UTC (rev 22723)
+++
core3/model-impl/trunk/src/test/java/org/cytoscape/model/subnetwork/CySubNetworkCyNetworkTest.java
2010-11-04 21:14:55 UTC (rev 22724)
@@ -54,14 +54,7 @@
*/
public void setUp() {
CyRootNetwork root = TestCyNetworkFactory.getRootInstance();
- CyNode n1 = root.addNode();
-// List<CyNode> list = new ArrayList<CyNode>(1);
-// list.add(n1);
- CySubNetwork s1 = root.addSubNetwork();
- s1.addNode(n1);
-
- net = s1;
- net.removeNode(n1);
+ net = root.addSubNetwork();
}
/**
--
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.