Class DotGraphPrinter

  • All Implemented Interfaces:
    TreePrinter

    public class DotGraphPrinter
    extends Object
    implements TreePrinter
    Printer used for generating DOT graph representations of trees. Unlike its sister classes, it does not rely on an iterative approach, relying instead on the internal tree-sitter API.
    Since:
    1.2.0
    Author:
    Ozren Dabić
    • Constructor Detail

      • DotGraphPrinter

        public DotGraphPrinter​(@NotNull
                               @NotNull Tree tree)
    • Method Detail

      • print

        public String print()
        Generates a DOT graph of the tree.
        Specified by:
        print in interface TreePrinter
        Returns:
        A DOT graph string of the tree
      • export

        public File export()
                    throws IOException
        Generates a DOT graph of the tree, writing it directly to a file.
        Specified by:
        export in interface TreePrinter
        Returns:
        A file containing the DOT graph of the tree
        Throws:
        IOException - if an I/O error occurs