Class DotSerializer


  • public class DotSerializer
    extends Object
    Allows to generate a representation of a ModelGraph in the DOT language.
    Author:
    S. John
    See Also:
    DOT language
    • Constructor Detail

      • DotSerializer

        public DotSerializer​(String basepath)
    • Method Detail

      • saveAsDot

        public void saveAsDot​(ModelGraph graph,
                              String filename,
                              boolean resetIds)
                       throws IOException
        /** Save the graph in a DOT file. Setting resetIds to false the IDs used for labeling the graph elements in the DOT format are kept for the next call to saveAsDot(ModelGraph, String, boolean). In that case, the DOT representations of the given and the next saved graph will share the same labels for graph elements referencing the same objects. Otherwise the IDs are cleared and the labels of next graph are calculated independently.
        Parameters:
        graph - a graph to save as DOT file
        filename - name of the file
        resetIds - whether to reset the IDs used for labeling graph elements or not
        Throws:
        IOException - thrown if the file or any directories specified in filename could not be accessed
      • saveAsDot

        public void saveAsDot​(ModelGraph graph,
                              String filename)
                       throws IOException
        Save the graph in a DOT file and afterwards clear the IDs used for labeling the graph elements in the DOT format. The next call to saveAsDot(ModelGraph, String, boolean) will calculate new IDs regardless of whether or not the referenced objects of the next graph overlap with the objects of the given graph.

        Equivalent to a call to saveAsDot(ModelGraph, String, true).

        Parameters:
        graph - a graph to save as DOT file
        filename - name of the file
        Throws:
        IOException - thrown if the file or any directories specified in filename could not be accessed