Author: mes
Date: 2011-09-21 15:59:09 -0700 (Wed, 21 Sep 2011)
New Revision: 26916
Modified:
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/EdgePointer.java
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/NodePointer.java
Log:
updated initial allocation of arrays
Modified:
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/EdgePointer.java
===================================================================
---
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/EdgePointer.java
2011-09-21 21:36:01 UTC (rev 26915)
+++
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/EdgePointer.java
2011-09-21 22:59:09 UTC (rev 26916)
@@ -42,10 +42,11 @@
final NodePointer source;
final NodePointer target;
- EdgePointer[] nextOutEdge = new EdgePointer[1];
- EdgePointer[] prevOutEdge = new EdgePointer[1];
- EdgePointer[] nextInEdge = new EdgePointer[1];
- EdgePointer[] prevInEdge = new EdgePointer[1];
+ // See comments in NodePointer for explanation of INITIAL_ALLOCATION
+ EdgePointer[] nextOutEdge = new
EdgePointer[NodePointer.INITIAL_ALLOCATION];
+ EdgePointer[] prevOutEdge = new
EdgePointer[NodePointer.INITIAL_ALLOCATION];
+ EdgePointer[] nextInEdge = new
EdgePointer[NodePointer.INITIAL_ALLOCATION];
+ EdgePointer[] prevInEdge = new
EdgePointer[NodePointer.INITIAL_ALLOCATION];
EdgePointer(final NodePointer s, final NodePointer t, final boolean
dir, final int ind, final CyEdge edge) {
index = ind;
Modified:
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/NodePointer.java
===================================================================
---
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/NodePointer.java
2011-09-21 21:36:01 UTC (rev 26915)
+++
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/NodePointer.java
2011-09-21 22:59:09 UTC (rev 26916)
@@ -38,22 +38,27 @@
final class NodePointer {
final CyNode cyNode;
final int index;
- NodePointer[] nextNode = new NodePointer[1];
- NodePointer[] prevNode = new NodePointer[1];
- EdgePointer[] firstOutEdge = new EdgePointer[1];
- EdgePointer[] firstInEdge = new EdgePointer[1];
+ // In general, there will always be the root network,
+ // the base network, and a subnetwork for visualization,
+ // so we use 3 as a sensible default.
+ final static int INITIAL_ALLOCATION = 3;
+ NodePointer[] nextNode = new NodePointer[INITIAL_ALLOCATION];
+ NodePointer[] prevNode = new NodePointer[INITIAL_ALLOCATION];
+ EdgePointer[] firstOutEdge = new EdgePointer[INITIAL_ALLOCATION];
+ EdgePointer[] firstInEdge = new EdgePointer[INITIAL_ALLOCATION];
+
// The number of directed edges whose source is this node.
- int[] outDegree = new int[1];
+ int[] outDegree = new int[INITIAL_ALLOCATION];
// The number of directed edges whose target is this node.
- int[] inDegree = new int[1];
+ int[] inDegree = new int[INITIAL_ALLOCATION];
// The number of undirected edges which touch this node.
- int[] undDegree = new int[1];
+ int[] undDegree = new int[INITIAL_ALLOCATION];
// The number of directed self-edges on this node.
- int[] selfEdges = new int[1];
+ int[] selfEdges = new int[INITIAL_ALLOCATION];
NodePointer(final int nodeIndex, final CyNode cyn) {
index = nodeIndex;
--
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.