Author: kono
Date: 2011-09-13 13:34:23 -0700 (Tue, 13 Sep 2011)
New Revision: 26781

Modified:
   
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
Log:
Some minor optimizations had been done for apply() method.

Modified: 
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
===================================================================
--- 
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
     2011-09-13 20:01:10 UTC (rev 26780)
+++ 
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
     2011-09-13 20:34:23 UTC (rev 26781)
@@ -171,8 +171,11 @@
                        return;
                }
 
-               logger.debug("Visual Style Apply method called: " + this.title);
+               logger.info(networkView.getSUID() + ": Visual Style Apply 
method called: " + this.title);
 
+               
+               final long start = System.currentTimeMillis();
+               
                final Collection<View<CyNode>> nodeViews = 
networkView.getNodeViews();
                final Collection<View<CyEdge>> edgeViews = 
networkView.getEdgeViews();
                final Collection<View<CyNetwork>> networkViewSet = new 
HashSet<View<CyNetwork>>();
@@ -183,7 +186,7 @@
                applyImpl(edgeViews, lexManager.getEdgeVisualProperties());
                applyImpl(networkViewSet, 
lexManager.getNetworkVisualProperties());
 
-               logger.debug("Visual Style applied: " + this.title + "\n");
+               logger.info(title + ": Visual Style applied in " + 
(System.currentTimeMillis() - start) + " msec.");
        }
 
        /**
@@ -217,9 +220,8 @@
                        for (View<?> view : views) {
                                mapping.apply((View<? extends CyTableEntry>) 
view);
                                
-                               if (view.getVisualProperty(vp) == vpDefault) {
+                               if (view.getVisualProperty(vp) == vpDefault)
                                        view.setVisualProperty(vp, 
styleDefaultValue);
-                               } 
                        }
                } else if (!vp.shouldIgnoreDefault()) {
                        // Ignore defaults flag is OFF. Apply defaults.
@@ -233,11 +235,8 @@
                                defVal = getDefaultValue(vp);
                        }
                        for (View<?> view : views) {
-                               Object val = view.getVisualProperty(vp);
-                               // logger.debug(vp.getDisplayName() + ": Ignore 
flag.  Val = " +
-                               // val);
-                               // logger.debug(vp.getDisplayName() + ": DEF 
Val = " + defVal);
-                               if (defVal.equals(val) == false)
+                               final Object val = view.getVisualProperty(vp);
+                               if (defVal != val)
                                        view.setVisualProperty(vp, val);
                        }
                }
@@ -258,23 +257,12 @@
                        if (vp.getDefault() instanceof Visualizable)
                                continue;
 
-                       final Object currentValue = 
viewModel.getVisualProperty(vp);
+                       // If equals, it is not necessary to set new value.
+                       if (viewModel.getVisualProperty(vp) == defaultValue)
+                               continue;
 
-                       // // Some of the VP has null defaults.
-                       // if (currentValue == null)
-                       // continue;
-
-                       // // If equals, it is not necessary to set new value.
-                       // if (currentValue.equals(defaultValue))
-                       // continue;
-                       //
-                       //
-
                        // This is a leaf, and need to be updated.
                        viewModel.setVisualProperty(vp, defaultValue);
-
-                       // logger.debug(vp.getDisplayName() + " updated from: " 
+
-                       // currentValue + " to " + defaultValue);
                }
        }
 

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