Class JavaBranchPrinter


  • public class JavaBranchPrinter
    extends java.lang.Object
    Class JavaBranchPrinter is not itself a visitor but it uses a JavaPrinter visitor to visit a java code branch of the tree and returns a pretty printed string representation of the subtree.

    Class maintains state (for a grammar), and not supposed to be run in parallel threads (on the same grammar).

    • Constructor Summary

      Constructors 
      Constructor Description
      JavaBranchPrinter​(JTBOptions aJopt, Spacing aSpc)
      Constructs a new instance with a default allocated buffer and a given indentation object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuilder genJavaBranch​(INode aJavaNode)
      Visits a given (java code) node branch of the tree and returns a pretty printed string representation of the subtree.
      Implementation note : it reuses a class allocated StringBuilder buffer, which is therefore overwritten on a next call.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JavaBranchPrinter

        public JavaBranchPrinter​(JTBOptions aJopt,
                                 Spacing aSpc)
        Constructs a new instance with a default allocated buffer and a given indentation object.
        Parameters:
        aJopt - - the JTB options
        aSpc - - an indentation
    • Method Detail

      • genJavaBranch

        public java.lang.StringBuilder genJavaBranch​(INode aJavaNode)
        Visits a given (java code) node branch of the tree and returns a pretty printed string representation of the subtree.
        Implementation note : it reuses a class allocated StringBuilder buffer, which is therefore overwritten on a next call.
        Parameters:
        aJavaNode - - the node to walk down and pretty print
        Returns:
        the pretty print in a reused StringBuilder buffer