Author: ruschein
Date: 2010-02-01 12:17:58 -0800 (Mon, 01 Feb 2010)
New Revision: 19096

Modified:
   cytoscape/trunk/src/cytoscape/actions/LoadNetworkTask.java
Log:
Now displays load times for nested networks.

Modified: cytoscape/trunk/src/cytoscape/actions/LoadNetworkTask.java
===================================================================
--- cytoscape/trunk/src/cytoscape/actions/LoadNetworkTask.java  2010-02-01 
20:08:05 UTC (rev 19095)
+++ cytoscape/trunk/src/cytoscape/actions/LoadNetworkTask.java  2010-02-01 
20:17:58 UTC (rev 19096)
@@ -78,6 +78,8 @@
  * Task to load a new network.
  */
 public class LoadNetworkTask implements Task {
+       private static long taskLoadStart = 0; // "0" means that it has not 
bene initialised!
+
        /**
         *  Load a network from a url.  The reader code will attempt to 
determine
         *  the format of the network (GML, XGMML, SIF) from the HTTP 
content-type
@@ -121,6 +123,7 @@
         *                        after it has been read in (provided that a 
view was created).
         */
        public static void loadURL(URL u, boolean skipMessage, 
CyLayoutAlgorithm layoutAlgorithm) {
+               taskLoadStart = System.nanoTime();
                LoadNetworkTask task = new LoadNetworkTask(u, layoutAlgorithm);
                setupTask(task, skipMessage, true);
        }
@@ -137,6 +140,7 @@
         *                        after it has been read in (provided that a 
view was created).
         */
        public static void loadFile(File file, boolean skipMessage, 
CyLayoutAlgorithm layoutAlgorithm) {
+               taskLoadStart = System.nanoTime();
                LoadNetworkTask task = new LoadNetworkTask(file, 
layoutAlgorithm);
                setupTask(task, skipMessage, true);
        }
@@ -282,20 +286,20 @@
        /**
         * Inform User of Network Stats.
         */
-
-       // Mod. by Kei 08/26/2005
-       //
-       // For the new GML format import function, added some messages
-       // for the users.
-       //
        private void informUserOfGraphStats(CyNetwork newNetwork) {
                NumberFormat formatter = new DecimalFormat("#,###,###");
                StringBuffer sb = new StringBuffer();
                
                String msg = "";
                if (reader instanceof NNFReader){
-                       NNFReader theReader = (NNFReader) reader;
-                       msg += "Successfully loaded "+ 
theReader.getNetworks().size() +" nested networks from " + name;
+                       final NNFReader theReader = (NNFReader) reader;
+                       msg += "Successfully loaded "+ 
theReader.getNetworks().size() + " nested networks from " + name;
+
+                       if (taskLoadStart != 0) // Display how long it took to 
load the NNs.
+                               msg += " in " + (System.nanoTime() - 
taskLoadStart + 500000L) / 1000000L + "ms.";
+                       else
+                               msg += ".";
+
                        taskMonitor.setStatus(msg);
                        return;
                }

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