Class JavaBranchPrinter

java.lang.Object
EDU.purdue.jtb.common.JavaBranchPrinter

public class JavaBranchPrinter extends 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
    Constructs a new instance with a default allocated buffer and a given indentation object.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 Details

    • 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 Details

    • genJavaBranch

      public 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