X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graphviz%2Fsrc%2Forg%2Fsimantics%2Fgraphviz%2FSubgraph.java;h=b20d307c0b9d8d6bceb8cf82467dd38ad6265994;hp=170b215a96879d83083662248239e3427119f71b;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.graphviz/src/org/simantics/graphviz/Subgraph.java b/bundles/org.simantics.graphviz/src/org/simantics/graphviz/Subgraph.java index 170b215a9..b20d307c0 100644 --- a/bundles/org.simantics.graphviz/src/org/simantics/graphviz/Subgraph.java +++ b/bundles/org.simantics.graphviz/src/org/simantics/graphviz/Subgraph.java @@ -1,59 +1,59 @@ -/******************************************************************************* - * 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 parts = new ArrayList(); - 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 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("};"); - } - -} +/******************************************************************************* + * 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 parts = new ArrayList(); + 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 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("};"); + } + +}