Author: clopes
Date: 2012-04-09 13:58:39 -0700 (Mon, 09 Apr 2012)
New Revision: 28771

Modified:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
Log:
XGMML parser: Removes internal node/edge suid-to-index map, since it is no 
longer necessary.

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
       2012-04-09 20:37:10 UTC (rev 28770)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
       2012-04-09 20:58:39 UTC (rev 28771)
@@ -429,12 +429,10 @@
         
         if (this.getCurrentNetwork() instanceof CySubNetwork && 
this.getParentNetwork() != null) {
                // Do not create the element again if the network is a 
sub-network!
-               Long index = cache.getIndex(oldId);
+               node = cache.getNode(oldId);
                
-               if (index != null) {
-                       node = this.getRootNetwork().getNode(index);
+               if (node != null) {
                        ((CySubNetwork) this.getCurrentNetwork()).addNode(node);
-                       node = this.getCurrentNetwork().getNode(index); // in 
order to return the correct instance!
                }
         }
         
@@ -459,12 +457,10 @@
         
         if (this.getCurrentNetwork() instanceof CySubNetwork && 
this.getParentNetwork() != null) {
                // Do not create the element again if the network is a 
sub-network and the edge already exists!
-               Long index = cache.getIndex(id);
+               edge = cache.getEdge(id);
                
-               if (index != null) {
-                       edge = this.getRootNetwork().getEdge(index);
+               if (edge != null) {
                        ((CySubNetwork) this.getCurrentNetwork()).addEdge(edge);
-                       edge = this.getCurrentNetwork().getEdge(index); // in 
order to return the correct instance!
                }
         }
         

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
   2012-04-09 20:37:10 UTC (rev 28770)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
   2012-04-09 20:58:39 UTC (rev 28771)
@@ -45,8 +45,6 @@
        
        /* Map of new to old element IDs */
        private Map<Long, Object> oldIdMap;
-       /* Map of old ID to node/edge indexes */
-       private Map<Object, Long> indexMap;
        
        /* Maps of XML ID's to elements (the keys should be a Long if reading a 
Cy3 session file) */
        private Map<Object, CyNetwork> networkByIdMap;
@@ -67,7 +65,6 @@
        
        public void init() {
                oldIdMap = new HashMap<Long, Object>();
-               indexMap = new HashMap<Object, Long>();
                
                nodeByIdMap = new HashMap<Object, CyNode>();
                edgeByIdMap = new HashMap<Object, CyEdge>();
@@ -102,15 +99,11 @@
         * @param element A CyNetwork, CyNetworkView, CyNode or CyEdge.
         */
        public void cache(Object xgmmlId, CyIdentifiable element) {
-       long index = -1;
-       
                if (xgmmlId != null) {
                        if (element instanceof CyNode) {
                                nodeByIdMap.put(xgmmlId, (CyNode) element);
-                               index = ((CyNode) element).getSUID();
                        } else if (element instanceof CyEdge) {
                                edgeByIdMap.put(xgmmlId, (CyEdge) element);
-                               index = ((CyEdge) element).getSUID();
                        } else if (element instanceof CyNetwork) {
                                networkByIdMap.put(xgmmlId, (CyNetwork) 
element);
                        } else if (element instanceof CyNetworkView) {
@@ -118,7 +111,6 @@
                        }
 
                        oldIdMap.put(element.getSUID(), xgmmlId);
-                       indexMap.put(xgmmlId, index);
                }
     }
        
@@ -166,10 +158,6 @@
                return null;
        }
        
-       public Long getIndex(Object oldId) {
-               return indexMap.get(oldId);
-       }
-       
        public CyNetwork getNetwork(Object oldId) {
                return networkByIdMap.get(oldId);
        }

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