Author: kono
Date: 2010-01-29 11:53:58 -0800 (Fri, 29 Jan 2010)
New Revision: 19071

Modified:
   cytoscape/trunk/src/cytoscape/data/readers/AbstractGraphReader.java
   cytoscape/trunk/src/cytoscape/data/readers/GMLParser.java
   cytoscape/trunk/src/cytoscape/data/readers/GMLReader.java
   cytoscape/trunk/src/cytoscape/data/readers/KeyValue.java
   cytoscape/trunk/src/cytoscape/visual/AppearanceCalculator.java
Log:
Fixed NPE bug when loading GML file.

Modified: cytoscape/trunk/src/cytoscape/data/readers/AbstractGraphReader.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/AbstractGraphReader.java 
2010-01-29 19:25:15 UTC (rev 19070)
+++ cytoscape/trunk/src/cytoscape/data/readers/AbstractGraphReader.java 
2010-01-29 19:53:58 UTC (rev 19071)
@@ -40,16 +40,15 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.regex.Pattern;
+import java.util.Set;
 
 import cytoscape.CyNetwork;
+import cytoscape.Cytoscape;
 import cytoscape.layout.CyLayoutAlgorithm;
 import cytoscape.layout.CyLayouts;
 import cytoscape.task.TaskMonitor;
 import cytoscape.util.CyNetworkNaming;
 import cytoscape.view.CyNetworkView;
-import cytoscape.Cytoscape;
-import java.util.Set;
 
 
 /**

Modified: cytoscape/trunk/src/cytoscape/data/readers/GMLParser.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/GMLParser.java   2010-01-29 
19:25:15 UTC (rev 19070)
+++ cytoscape/trunk/src/cytoscape/data/readers/GMLParser.java   2010-01-29 
19:53:58 UTC (rev 19071)
@@ -33,77 +33,64 @@
   You should have received a copy of the GNU Lesser General Public License
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
+ */
 package cytoscape.data.readers;
 
-import cytoscape.util.FileUtil;
-import cytoscape.logger.CyLogger;
-
-import java.io.FileReader;
 import java.io.FilterReader;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StreamTokenizer;
 import java.io.Writer;
-
 import java.text.ParseException;
-
-import java.util.Iterator;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Vector;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import cytoscape.util.FileUtil;
 
 /**
- * The purpose of hte class is to translate gml into an object tree, and print 
out an object treee
- * into GML
+ * The purpose of this class is to translate GML into an object tree, and print
+ * out an object tree into GML
  */
 public class GMLParser {
        /**
         * This character begsin and ends a string literal in a GML file
         */
-       static int QUOTE_CHAR = '"';
+       private static final int QUOTE_CHAR = '"';
 
        /**
         * String versio of above
         */
-       static String QUOTE_STRING = "\"";
+       private static final String QUOTE_STRING = "\"";
 
        /**
         * This regex pattern will match a valid key
         */
-       static Pattern keyPattern = Pattern.compile("\\w+");
-       ;
+       private static final Pattern keyPattern = Pattern.compile("\\w+");;
 
        /**
         * This regex pattern will match a valid integer
         */
-       static Pattern integerPattern = Pattern.compile("(\\+|\\-){0,1}\\d+");
-       ;
+       private static final Pattern integerPattern = 
Pattern.compile("(\\+|\\-){0,1}\\d+");;
 
        /**
         * This regex pattern will match a valid real (double)
         */
-       static Pattern realPattern = 
Pattern.compile("(\\+|\\-){0,1}\\d+\\.\\d+((E|e)(\\+|\\-){0,1}\\d+){0,1}");
-       ;
+       private static final Pattern realPattern = Pattern
+                       
.compile("(\\+|\\-){0,1}\\d+\\.\\d+((E|e)(\\+|\\-){0,1}\\d+){0,1}");;
 
-       /*
-        * This string opens a list
-        */
-       static String LIST_OPEN = "[";
+       // opens a list
+       private static final String LIST_OPEN = "[";
 
-       /**
-        * This string close a list
-        */
-       static String LIST_CLOSE = "]";
-       StreamTokenizer tokenizer;
+       // close a list
+       private static final String LIST_CLOSE = "]";
+       
+       private StreamTokenizer tokenizer;
 
        /**
-        * Constructor has to initialize the relevenat
-        * regular expression patterns
+        * Constructor has to initialize the relevenat regular expression 
patterns
         */
        public GMLParser(StreamTokenizer tokenizer) {
                this.tokenizer = tokenizer;
@@ -112,15 +99,16 @@
        /**
         * Make a stream tokenizer out of the given this file and read in the 
file
         */
-       public GMLParser(String file) throws IOException, Exception {
+       public GMLParser(final String file) throws IOException, Exception {
                this(FileUtil.getInputStream(file));
        }
 
        /**
         * Make a stream tokenizer out of the given this file and read in the 
file
         */
-       public GMLParser(InputStream stream) throws IOException, Exception {
-               tokenizer = new StreamTokenizer(new FilterNewlineReader(new 
InputStreamReader(stream)));
+       public GMLParser(final InputStream stream) throws IOException, 
Exception {
+               tokenizer = new StreamTokenizer(new FilterNewlineReader(
+                               new InputStreamReader(stream)));
 
                tokenizer.resetSyntax();
                tokenizer.commentChar('#');
@@ -136,36 +124,36 @@
                tokenizer.nextToken();
        }
 
+       
        /**
-        * Public method to print out a given object tree(list)
-        * using the supplied filewriter
+        * Public method to print out a given object tree(list) using the 
supplied
+        * filewriter
         */
-       public static void printList(List list, Writer writer) throws 
IOException {
+       public static void printList(final List<KeyValue> list, final Writer 
writer) throws IOException {
                printList(list, "", writer);
        }
 
+       
        /**
         * Protected recurive helper method to print out an object tree
         */
-       protected static void printList(List list, String indent, Writer writer)
-           throws IOException {
-               for (Iterator it = list.iterator(); it.hasNext();) {
-                       KeyValue keyVal = (KeyValue) it.next();
-
-                       if (keyVal.value instanceof List) {
-                               //  If the value is a list, print that list 
recursively
-                               //  surrounded by the list open and close 
characters
+       protected static void printList(final List<KeyValue> list, final String 
indent, final Writer writer)
+                       throws IOException {
+               for (KeyValue keyVal: list) {
+                       if (keyVal.value instanceof List<?>) {
+                               // If the value is a list, print that list 
recursively
+                               // surrounded by the list open and close 
characters
                                writer.write(indent + keyVal.key + "\t");
                                writer.write(LIST_OPEN + "\n");
-                               printList((List) keyVal.value, indent + "\t", 
writer);
+                               printList((List<KeyValue>) keyVal.value, indent 
+ "\t", writer);
                                writer.write(indent + LIST_CLOSE + "\n");
                        } else if (keyVal.value instanceof String) {
-                               //  Surround a string with the quote characters
+                               // Surround a string with the quote characters
                                writer.write(indent + keyVal.key + "\t");
                                writer.write(QUOTE_STRING + keyVal.value + 
QUOTE_STRING + "\n");
                        } else if (keyVal.value instanceof Double) {
-                               //  If the double contains a non-number, we 
will refuse to write
-                               //  it out because the result will be invalid 
gml
+                               // If the double contains a non-number, we will 
refuse to write
+                               // it out because the result will be invalid gml
                                Double value = (Double) keyVal.value;
 
                                if (!(value.isNaN() || value.isInfinite())) {
@@ -173,8 +161,8 @@
                                        writer.write(keyVal.value + "\n");
                                }
                        } else if (keyVal.value instanceof Integer) {
-                               //  Everything else (Integer, double) relies 
upon the default
-                               //  toString() method  of the object
+                               // Everything else (Integer, double) relies 
upon the default
+                               // toString() method of the object
                                writer.write(indent + keyVal.key + "\t");
                                writer.write(keyVal.value + "\n");
                        }
@@ -184,8 +172,8 @@
        /**
         * A list consists of zero or more paris of keys and values
         */
-       public Vector parseList() throws IOException, ParseException {
-               Vector result = new Vector();
+       public List<KeyValue> parseList() throws IOException, ParseException {
+               final List<KeyValue> result = new ArrayList<KeyValue>();
 
                while (isKey()) {
                        String key = parseKey();
@@ -199,7 +187,9 @@
                        Object value = parseValue();
 
                        if (value == null) {
-                               throw new ParseException("Bad value associated 
with key " + key, tokenizer.lineno());
+                               throw new ParseException(
+                                               "Bad value associated with key 
" + key, tokenizer
+                                                               .lineno());
                        }
 
                        result.add(new KeyValue(key, value));
@@ -224,47 +214,45 @@
        }
 
        /**
-        * An integer consists of hte characters [0-9]
-        * Assuming hte precondition that we have already checked
-        * for the end of file
+        * An integer consists of hte characters [0-9] Assuming hte precondition
+        * that we have already checked for the end of file
         */
        private boolean isInteger() {
                return integerPattern.matcher(tokenizer.sval).matches();
        }
 
        /**
-        * A real consists of 1 or more digits followed by a ., followed by one 
or more digits
-        * and an optional mantissa. Assuming the preconiditon that we have 
already
-        * checked for hte end of file
+        * A real consists of 1 or more digits followed by a ., followed by one 
or
+        * more digits and an optional mantissa. Assuming the preconiditon that 
we
+        * have already checked for hte end of file
         */
        private boolean isReal() {
                return realPattern.matcher(tokenizer.sval).matches();
        }
 
        /**
-        * A string consits of a string that begins and ends with the quote 
character
-        * The streamtokenizer will basically check for this for me, so I just
-        * have to check the token type and see if it is a quote char
-        * It's also not supposed ot have a couple things in it, but I don't 
really
-        * have a check for that.
+        * A string consits of a string that begins and ends with the quote
+        * character The streamtokenizer will basically check for this for me, 
so I
+        * just have to check the token type and see if it is a quote char It's 
also
+        * not supposed ot have a couple things in it, but I don't really have a
+        * check for that.
         */
        private boolean isString() {
                return tokenizer.ttype == QUOTE_CHAR;
        }
 
        /**
-        * A list starts with the list open character
-        * I'm assuming I get some white space before and
-        * after the list delimiter, that might not actually
-        * be true according to the spec
+        * A list starts with the list open character I'm assuming I get some 
white
+        * space before and after the list delimiter, that might not actually be
+        * true according to the spec
         */
        private boolean isList() {
                return tokenizer.sval.equals(LIST_OPEN);
        }
 
        /**
-        * Verify that the current value is a key,
-        * and then return the key that is found
+        * Verify that the current value is a key, and then return the key that 
is
+        * found
         */
        private String parseKey() {
                if (isKey()) {
@@ -275,8 +263,8 @@
        }
 
        /**
-        * Parse out a value, it can be a integer,real,string, or a list. 
Assume is has already been found
-        * to not be the end of file
+        * Parse out a value, it can be a integer,real,string, or a list. 
Assume is
+        * has already been found to not be the end of file
         */
        private Object parseValue() throws IOException, ParseException {
                Object result = null;
@@ -303,7 +291,8 @@
                        List list = parseList();
 
                        if (!tokenizer.sval.equals(LIST_CLOSE)) {
-                               throw new ParseException("Unterminated list", 
tokenizer.lineno());
+                               throw new ParseException("Unterminated list", 
tokenizer
+                                               .lineno());
                        }
 
                        return list;
@@ -315,10 +304,10 @@
        /**
         * This misery exists to overcome a bug in the java.io.StreamTokenizer 
lib.
         * the problem is that StreamTokenizer treats newlines as end-of-quotes,
-        * which means you can't have quoted strings over multiple lines.  This,
-        * however, violates the GML grammar.  So, since the grammar treats 
newlines
-        * and spaces the same, we just turn all newlines and carriage returns
-        * into spaces.  Fortunately for us, StreamTokenizer only calls the 
read() method.
+        * which means you can't have quoted strings over multiple lines. This,
+        * however, violates the GML grammar. So, since the grammar treats 
newlines
+        * and spaces the same, we just turn all newlines and carriage returns 
into
+        * spaces. Fortunately for us, StreamTokenizer only calls the read() 
method.
         */
        private class FilterNewlineReader extends FilterReader {
                public FilterNewlineReader(Reader r) {

Modified: cytoscape/trunk/src/cytoscape/data/readers/GMLReader.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/GMLReader.java   2010-01-29 
19:25:15 UTC (rev 19070)
+++ cytoscape/trunk/src/cytoscape/data/readers/GMLReader.java   2010-01-29 
19:53:58 UTC (rev 19071)
@@ -36,59 +36,44 @@
  */
 package cytoscape.data.readers;
 
-import cern.colt.list.IntArrayList;
+import giny.model.Edge;
+import giny.model.Node;
+import giny.view.EdgeView;
+import giny.view.GraphView;
+import giny.view.NodeView;
 
-import cern.colt.map.OpenIntIntHashMap;
+import java.awt.Color;
+import java.awt.geom.Point2D;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
 
+import cern.colt.list.IntArrayList;
+import cern.colt.map.OpenIntIntHashMap;
 import cytoscape.CyEdge;
 import cytoscape.CyNetwork;
 import cytoscape.Cytoscape;
 import cytoscape.CytoscapeInit;
-
 import cytoscape.data.CyAttributes;
 import cytoscape.data.Semantics;
-
 import cytoscape.init.CyInitParams;
-
 import cytoscape.layout.CyLayoutAlgorithm;
 import cytoscape.layout.LayoutAdapter;
-
 import cytoscape.logger.CyLogger;
-
 import cytoscape.task.TaskMonitor;
-
 import cytoscape.util.FileUtil;
 import cytoscape.util.PercentUtil;
-
 import cytoscape.view.CyNetworkView;
-
 import cytoscape.visual.ArrowShape;
-import cytoscape.visual.LineStyle;
 import cytoscape.visual.NodeShape;
-import cytoscape.visual.VisualMappingManager;
 import cytoscape.visual.VisualPropertyType;
 
-import giny.model.Edge;
-import giny.model.Node;
 
-import giny.view.EdgeView;
-import giny.view.GraphView;
-import giny.view.NodeView;
-
-import java.awt.Color;
-import java.awt.geom.Point2D;
-
-import java.io.InputStream;
-import java.io.StringWriter;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-
 /**
  * This class is responsible for converting a gml object tree into cytoscape
  * objects New features to the current version: 1. Small bug fixes. 2. 
Translate
@@ -108,74 +93,75 @@
         */
 
        // Graph Tags
-       protected static String GRAPH = "graph";
-       protected static String NODE = "node";
-       protected static String EDGE = "edge";
-       protected static String GRAPHICS = "graphics";
-       protected static String LABEL = "label";
-       protected static String SOURCE = "source";
-       protected static String TARGET = "target";
+       protected static final String GRAPH = "graph";
+       protected static final String NODE = "node";
+       protected static final String EDGE = "edge";
+       protected static final String GRAPHICS = "graphics";
+       protected static final String LABEL = "label";
+       protected static final String SOURCE = "source";
+       protected static final String TARGET = "target";
 
        // The following elements are in "graphics" section of GML
-       protected static String X = "x";
-       protected static String Y = "y";
-       protected static String H = "h";
-       protected static String W = "w";
-       protected static String TYPE = "type";
-       protected static String ID = "id";
-       protected static String ROOT_INDEX = "root_index";
+       protected static final String X = "x";
+       protected static final String Y = "y";
+       protected static final String H = "h";
+       protected static final String W = "w";
+       protected static final String TYPE = "type";
+       protected static final String ID = "id";
+       protected static final String ROOT_INDEX = "root_index";
 
        // Shapes used in Cytoscape (not GML standard)
        // In GML, they are called "type"
-       protected static String RECTANGLE = "rectangle";
-       protected static String ELLIPSE = "ellipse";
-       protected static String LINE = "Line"; // This is the Polyline object.
+       protected static final String RECTANGLE = "rectangle";
+       protected static final String ELLIPSE = "ellipse";
+       protected static final String LINE = "Line"; // This is the Polyline 
object.
                                               // no support for now...
-       protected static String POINT = "point";
-       protected static String DIAMOND = "diamond";
-       protected static String HEXAGON = "hexagon";
-       protected static String OCTAGON = "octagon";
-       protected static String PARALELLOGRAM = "parallelogram";
-       protected static String TRIANGLE = "triangle";
+       protected static final String POINT = "point";
+       protected static final String DIAMOND = "diamond";
+       protected static final String HEXAGON = "hexagon";
+       protected static final String OCTAGON = "octagon";
+       protected static final String PARALELLOGRAM = "parallelogram";
+       protected static final String TRIANGLE = "triangle";
 
        // Other GML "graphics" attributes
-       protected static String FILL = "fill";
-       protected static String WIDTH = "width";
-       protected static String STRAIGHT_LINES = "line";
-       protected static String CURVED_LINES = "curved";
-       protected static String SOURCE_ARROW = "source_arrow";
-       protected static String TARGET_ARROW = "target_arrow";
+       protected static final String FILL = "fill";
+       protected static final String WIDTH = "width";
+       protected static final String STRAIGHT_LINES = "line";
+       protected static final String CURVED_LINES = "curved";
+       protected static final String SOURCE_ARROW = "source_arrow";
+       protected static final String TARGET_ARROW = "target_arrow";
 
        // Support for yEd GML dialect
-       protected static String YED_SOURCE_ARROW = "sourceArrow";
-       protected static String YED_TARGET_ARROW = "targetArrow";
-       protected static String YED_DELTA = "delta";
-       protected static String YED_STANDARD = "standard";
-       protected static String YED_DIAMOND = "diamond";
-       protected static String YED_SHORT = "short";
-       protected static String YED_WHITE_DELTA = "white_delta";
-       protected static String YED_WHITE_DIAMOND = "white_diamond";
+       protected static final String YED_SOURCE_ARROW = "sourceArrow";
+       protected static final String YED_TARGET_ARROW = "targetArrow";
+       protected static final String YED_DELTA = "delta";
+       protected static final String YED_STANDARD = "standard";
+       protected static final String YED_DIAMOND = "diamond";
+       protected static final String YED_SHORT = "short";
+       protected static final String YED_WHITE_DELTA = "white_delta";
+       protected static final String YED_WHITE_DIAMOND = "white_diamond";
 
        // States of the ends of arrows
-       protected static String ARROW = "arrow";
-       protected static String ARROW_NONE = "none";
-       protected static String ARROW_FIRST = "first";
-       protected static String ARROW_LAST = "last";
-       protected static String ARROW_BOTH = "both";
-       protected static String OUTLINE = "outline";
-       protected static String OUTLINE_WIDTH = "outline_width";
-       protected static String DEFAULT_EDGE_INTERACTION = "pp";
-       protected static String VERSION = "Version";
-       protected static String CREATOR = "Creator";
-       private String mapSuffix;
-       private Color DEF_COLOR = new Color(153, 153, 255);
+       protected static final String ARROW = "arrow";
+       protected static final String ARROW_NONE = "none";
+       protected static final String ARROW_FIRST = "first";
+       protected static final String ARROW_LAST = "last";
+       protected static final String ARROW_BOTH = "both";
+       protected static final String OUTLINE = "outline";
+       protected static final String OUTLINE_WIDTH = "outline_width";
+       protected static final String DEFAULT_EDGE_INTERACTION = "pp";
+       protected static final String VERSION = "Version";
+       protected static final String CREATOR = "Creator";
+       
+       private static final Color DEF_COLOR = new Color(153, 153, 255);
+       
        private String vsbSwitch = 
CytoscapeInit.getProperties().getProperty("visualStyleBuilder");
        private VisualStyleBuilder graphStyle = null;
 
-       protected static CyLogger logger = CyLogger.getLogger(GMLReader.class);
+       private static CyLogger logger = CyLogger.getLogger(GMLReader.class);
 
        // Entries in the file
-       List keyVals;
+       private List<KeyValue> keyVals;
 
        // Node ID's
        OpenIntIntHashMap nodeIDMap;
@@ -227,7 +213,7 @@
         *
         * @param filename File name.
         */
-       public GMLReader(String filename) {
+       public GMLReader(final String filename) {
                this(filename, null);
        }
 
@@ -239,7 +225,7 @@
         *            Input stream of GML file,
         *
         */
-       public GMLReader(InputStream is, String name) {
+       public GMLReader(final InputStream is, final String name) {
                super(name);
 
                // Set new style name
@@ -256,7 +242,7 @@
         * @param filename File name.
         * @param taskMonitor TaskMonitor Object.
         */
-       public GMLReader(String filename, TaskMonitor taskMonitor) {
+       public GMLReader(final String filename, final TaskMonitor taskMonitor) {
                super(filename);
                inputStream = FileUtil.getInputStream(filename);
 
@@ -282,111 +268,30 @@
        }
 
        private String createVSName() {
-               // Create new style name
-               // String target = null;
-
-               // File fileTest = new File(fileName);
-               // target = fileTest.getName();
-               // logger.info("Target GML file is " + fileName);
-               mapSuffix = " for " + fileName;
-
-               return getNetworkName(); //fileName.concat("_GML_style");
+               return getNetworkName() + " Style";
        }
 
        private void initializeHash() {
-               // Initialize HashMap for new visual style
-               //nodeW = new HashMap();
-               //nodeH = new HashMap();
-               //nodeShape = new HashMap<String,NodeShape>();
-               //nodeCol = new HashMap();
-               //nodeBWidth = new HashMap<String,Double>();
-               //nodeBCol = new HashMap();
-               //edgeCol = new HashMap();
-               //edgeWidth = new HashMap<String,Float>();
-               //edgeArrow = new HashMap<String,String>();
-               //edgeShape = new HashMap();
                edge_names = new Vector();
                node_names = new Vector();
        }
 
+       
        // Initialize variables for the new style created from GML
-       //
        private void initStyle() {
                graphStyle = new VisualStyleBuilder(styleName, false);
                graphStyle.setNodeSizeLocked(false);
        }
 
-       // Create maps for the node attribute and set it as a Visual Style.
-       /**
-        *  DOCUMENT ME!
-        *
-        * @param vizmapper DOCUMENT ME!
-        * @deprecated Don't use this. Gone 2/2009.
-        */
-       @Deprecated
-       public void setNodeMaps(VisualMappingManager vizmapper) {
-       }
 
-       //
        /**
-        *  DOCUMENT ME!
-        *
-        * @param vizmapper DOCUMENT ME!
-        * @deprecated Don't use this. Gone 2/2009.
+        *  Read GML file contents
         */
-       @Deprecated
-       public void setEdgeMaps(VisualMappingManager vizmapper) {
-       }
-
-       /**
-        *  DOCUMENT ME!
-        *
-        * @param mapSuffix DOCUMENT ME!
-        * @param VSName DOCUMENT ME!
-        * @deprecated Don't use this. Gone 2/2009.
-        */
-       @Deprecated
-       public void applyMaps(String mapSuffix, String VSName) {
-               // CytoscapeDesktop cyDesktop = Cytoscape.getDesktop();
-               // VisualMappingManager vizmapper = 
cyDesktop.getVizMapManager();
-               /*
-               if (VSName != null) {
-                   styleName = VSName;
-               }
-
-               if (mapSuffix != null) {
-                   this.mapSuffix = mapSuffix;
-               }
-
-               VisualMappingManager vizmapper = 
Cytoscape.getVisualMappingManager();
-               catalog = vizmapper.getCalculatorCatalog();
-
-               setNodeMaps(vizmapper);
-               setEdgeMaps(vizmapper);
-
-               //
-               // Create new VS and apply it
-               //
-               gac.setDefaultBackgroundColor(DEF_COLOR);
-               gmlstyle = new VisualStyle(styleName, nac, eac, gac);
-
-               catalog.addVisualStyle(gmlstyle);
-               vizmapper.setVisualStyle(gmlstyle);
-
-               Cytoscape.getCurrentNetworkView().redrawGraph(false, true);
-               */
-       }
-
-       //
-       /**
-        *  DOCUMENT ME!
-        */
        public void read() {
                try {
             try {
                 keyVals = (new GMLParser(inputStream)).parseList();
-            }
-            finally {
+            } finally {
                 if (inputStream != null) {
                     inputStream.close();
                 }
@@ -570,10 +475,8 @@
         * This function takes in a list which was given as the value to a 
"graph"
         * key underneath the main gml list
         */
-       protected void readGraph(List list) {
-               for (Iterator it = list.iterator(); it.hasNext();) {
-                       KeyValue keyVal = (KeyValue) it.next();
-
+       protected void readGraph(final List<KeyValue> list) {
+               for (KeyValue keyVal: list) {
                        if (keyVal.key.equals(NODE)) {
                                readNode((List) keyVal.value);
                        }
@@ -1219,8 +1122,8 @@
         *
         * @param net DOCUMENT ME!
         */
-       public void doPostProcessing(CyNetwork net) {
-               // 
+       public void doPostProcessing(final CyNetwork net) {
+
                CyInitParams init = CytoscapeInit.getCyInitParams();
 
                if (init == null)

Modified: cytoscape/trunk/src/cytoscape/data/readers/KeyValue.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/KeyValue.java    2010-01-29 
19:25:15 UTC (rev 19070)
+++ cytoscape/trunk/src/cytoscape/data/readers/KeyValue.java    2010-01-29 
19:53:58 UTC (rev 19071)
@@ -33,31 +33,27 @@
   You should have received a copy of the GNU Lesser General Public License
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
+ */
 package cytoscape.data.readers;
 
-
 /**
- *
+ * Key and Value pair in GML file.
  */
 public class KeyValue {
-       /**
-        *
-        */
-       public String key;
 
-       /**
-        *
-        */
+       // These are immutable.
+       public final String key;
        public Object value;
 
        /**
         * Creates a new KeyValue object.
-        *
-        * @param key  DOCUMENT ME!
-        * @param value  DOCUMENT ME!
+        * 
+        * @param key
+        *            DOCUMENT ME!
+        * @param value
+        *            DOCUMENT ME!
         */
-       public KeyValue(String key, Object value) {
+       public KeyValue(final String key, final Object value) {
                this.key = key;
                this.value = value;
        }

Modified: cytoscape/trunk/src/cytoscape/visual/AppearanceCalculator.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/AppearanceCalculator.java      
2010-01-29 19:25:15 UTC (rev 19070)
+++ cytoscape/trunk/src/cytoscape/visual/AppearanceCalculator.java      
2010-01-29 19:53:58 UTC (rev 19071)
@@ -80,12 +80,11 @@
                if (toCopy == null)
                        return;
 
-               for (Calculator c : toCopy.getCalculators()) {
-                       CyLogger.getLogger().info("New calc = " + c.toString());
+               for (Calculator c : toCopy.getCalculators())
                        setCalculator(c);
-               }
 
-               deps.copy( toCopy.deps );
+               if (deps != null)
+                       deps.copy( toCopy.deps );
 
                copyDefaultAppearance(toCopy);
        }

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