-/*******************************************************************************\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.PrintStream;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-\r
-/**\r
- * A hierarchial part of a graph. \r
- * \r
- * @author Hannu Niemistö\r
- */\r
-public class Subgraph extends AbstractIdentifiableGraphPart implements IGraph {\r
- Collection<IGraphPart> parts = new ArrayList<IGraphPart>();\r
- int curId = 0;\r
-\r
- public Subgraph(IGraph parent) {\r
- super(parent);\r
- }\r
-\r
- @Override\r
- public void addPart(IGraphPart part) {\r
- parts.add(part); \r
- }\r
-\r
- @Override\r
- public String newId() {\r
- return getId() + "_" + (++curId);\r
- }\r
-\r
- @Override\r
- public Collection<IGraphPart> getParts() {\r
- return Collections.unmodifiableCollection(parts);\r
- }\r
-\r
- @Override\r
- public void write(PrintStream s) {\r
- s.print("subgraph ");\r
- s.print(id);\r
- s.println(" {");\r
- s.print("graph");\r
- writeAttributes(s);\r
- for(IGraphPart part : parts)\r
- part.write(s);\r
- s.println("};"); \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.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A hierarchial part of a graph.
+ *
+ * @author Hannu Niemistö
+ */
+public class Subgraph extends AbstractIdentifiableGraphPart implements IGraph {
+ Collection<IGraphPart> parts = new ArrayList<IGraphPart>();
+ int curId = 0;
+
+ public Subgraph(IGraph parent) {
+ super(parent);
+ }
+
+ @Override
+ public void addPart(IGraphPart part) {
+ parts.add(part);
+ }
+
+ @Override
+ public String newId() {
+ return getId() + "_" + (++curId);
+ }
+
+ @Override
+ public Collection<IGraphPart> getParts() {
+ return Collections.unmodifiableCollection(parts);
+ }
+
+ @Override
+ public void write(PrintStream s) {
+ s.print("subgraph ");
+ s.print(id);
+ s.println(" {");
+ s.print("graph");
+ writeAttributes(s);
+ for(IGraphPart part : parts)
+ part.write(s);
+ s.println("};");
+ }
+
+}