]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graphviz/src/org/simantics/graphviz/Graph.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.graphviz / src / org / simantics / graphviz / Graph.java
index e66b82f751bbbfb5d222dcd254acf9e31899ac3f..1be2e660b845046f8552fe58365fa7c7cb399ceb 100644 (file)
@@ -1,95 +1,95 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.graphviz;\r
-\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.PrintStream;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-\r
-/**\r
- * Root graph that contains nodes, edges and subgraphs.\r
- * \r
- * @author Hannu Niemistö\r
- */\r
-public class Graph extends AbstractAttributeContainer implements IGraph {\r
-    Collection<IGraphPart> parts = new ArrayList<IGraphPart>();\r
-    int curId = 0;\r
-    \r
-    public Graph() {\r
-        super();\r
-    }\r
-\r
-    public Graph(String label) {\r
-        super();\r
-        setLabel(label);\r
-    }\r
-\r
-    @Override\r
-    public void addPart(IGraphPart part) {\r
-        parts.add(part);        \r
-    }\r
-\r
-    @Override\r
-    public String newId() {\r
-        return "n" + (++curId);\r
-    }\r
-\r
-    @Override\r
-    public Collection<IGraphPart> getParts() {\r
-        return Collections.unmodifiableCollection(parts);\r
-    }\r
-\r
-    public void write(PrintStream s) {\r
-        s.print("digraph {");\r
-        s.print("graph");\r
-        writeAttributes(s);\r
-        for(IGraphPart part : parts)\r
-            part.write(s);\r
-        s.println("};");        \r
-    }\r
-    \r
-    @Override\r
-    public String toString() {\r
-        ByteArrayOutputStream ba = new ByteArrayOutputStream();\r
-        write(new PrintStream(ba));\r
-        return ba.toString();\r
-    }\r
-    \r
-    public void setLabel(String label) {\r
-        set("label", label);\r
-    }\r
-    \r
-    /**\r
-     * Color used for text.\r
-     */\r
-    public void setFontColor(String color) {\r
-        set("fontcolor", color);\r
-    }\r
-    \r
-    /**\r
-     * <p>Sets direction of graph layout. For example, if rankdir="LR", and barring cycles, an edge T -> H; will go from left to right. By default, graphs are laid out from top to bottom.</p>\r
-     * <p>Alternatives: <tt>TB LR BT RL</tt></p>\r
-     */\r
-    public void setRankdir(String rankdir) {\r
-        set("rankdir", rankdir);\r
-    }\r
-    \r
-    /**\r
-     * <p>In dot, this gives the desired rank separation, in inches. This is the minimum vertical distance between the bottom of the nodes in one rank and the tops of nodes in the next. If the value contains "equally", the centers of all ranks are spaced equally apart. Note that both settings are possible, e.g., ranksep = "1.2 equally". In twopi, specifies radial separation of concentric circles.</p>\r
-     */\r
-    public void setRanksep(double ranksep, boolean equally) {\r
-        set("ranksep", Double.toString(ranksep) + (equally ? " equally" : ""));\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.graphviz;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Root graph that contains nodes, edges and subgraphs.
+ * 
+ * @author Hannu Niemistö
+ */
+public class Graph extends AbstractAttributeContainer implements IGraph {
+    Collection<IGraphPart> parts = new ArrayList<IGraphPart>();
+    int curId = 0;
+    
+    public Graph() {
+        super();
+    }
+
+    public Graph(String label) {
+        super();
+        setLabel(label);
+    }
+
+    @Override
+    public void addPart(IGraphPart part) {
+        parts.add(part);        
+    }
+
+    @Override
+    public String newId() {
+        return "n" + (++curId);
+    }
+
+    @Override
+    public Collection<IGraphPart> getParts() {
+        return Collections.unmodifiableCollection(parts);
+    }
+
+    public void write(PrintStream s) {
+        s.print("digraph {");
+        s.print("graph");
+        writeAttributes(s);
+        for(IGraphPart part : parts)
+            part.write(s);
+        s.println("};");        
+    }
+    
+    @Override
+    public String toString() {
+        ByteArrayOutputStream ba = new ByteArrayOutputStream();
+        write(new PrintStream(ba));
+        return ba.toString();
+    }
+    
+    public void setLabel(String label) {
+        set("label", label);
+    }
+    
+    /**
+     * Color used for text.
+     */
+    public void setFontColor(String color) {
+        set("fontcolor", color);
+    }
+    
+    /**
+     * <p>Sets direction of graph layout. For example, if rankdir="LR", and barring cycles, an edge T -> H; will go from left to right. By default, graphs are laid out from top to bottom.</p>
+     * <p>Alternatives: <tt>TB LR BT RL</tt></p>
+     */
+    public void setRankdir(String rankdir) {
+        set("rankdir", rankdir);
+    }
+    
+    /**
+     * <p>In dot, this gives the desired rank separation, in inches. This is the minimum vertical distance between the bottom of the nodes in one rank and the tops of nodes in the next. If the value contains "equally", the centers of all ranks are spaced equally apart. Note that both settings are possible, e.g., ranksep = "1.2 equally". In twopi, specifies radial separation of concentric circles.</p>
+     */
+    public void setRanksep(double ranksep, boolean equally) {
+        set("ranksep", Double.toString(ranksep) + (equally ? " equally" : ""));
+    }
+
+}