org.jmlspecs.jml4.rac
Class RacPrettyPrinter

java.lang.Object
  extended by org.jmlspecs.jml4.rac.RacPrettyPrinter

public class RacPrettyPrinter
extends java.lang.Object

Pretty prints RAC code.

Author:
Amritam Sarcar and Yoonsik Cheon

Constructor Summary
RacPrettyPrinter(CompilationResult compilationResult)
           
 
Method Summary
 TypeDeclaration[] cloneTypes(TypeDeclaration[] types)
          Clones the given types.
static void debug(CompilationUnitDeclaration sunit)
          Prints the given AST on debugStream if debugging information has been requested.
static void debugMergedRacCode(boolean flag)
          Makes the RAC code be printed for debugging purpose after it gets merged to the original source code.
static void debugRacCode(boolean flag)
          Makes the RAC code be printed for debugging purpose before it gets merged to the original source code.
 char[] getRacSourceCode()
          Returns the RAC source code.
 void printRacCode(CompilationUnitDeclaration sourceUnit, CompilationUnitDeclaration racUnit)
          Prints the given RAC code of the given source to an internal file for a later parsing.
static void setDebugStream(java.io.PrintStream out)
          Sets the output stream on which RAC code will be printed for debugging purpose.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RacPrettyPrinter

public RacPrettyPrinter(CompilationResult compilationResult)
Method Detail

debugRacCode

public static void debugRacCode(boolean flag)
Makes the RAC code be printed for debugging purpose before it gets merged to the original source code. The RAC code will be printed on the output stream set by setDebugStream(PrintStream) or System.out by default.


debugMergedRacCode

public static void debugMergedRacCode(boolean flag)
Makes the RAC code be printed for debugging purpose after it gets merged to the original source code. The RAC code will be printed on the output stream set by setDebugStream(PrintStream) or System.out by default.


setDebugStream

public static void setDebugStream(java.io.PrintStream out)
Sets the output stream on which RAC code will be printed for debugging purpose.


cloneTypes

public TypeDeclaration[] cloneTypes(TypeDeclaration[] types)
Clones the given types. This method makes copies of the given types at the type level. If the argument types contain member types, they are also cloned recursively; however, all other types of members such as fields and methods are not copied. For an interface, its surrogate class is created and appended to its member types; i.e., an interface's surrogate class is located at the last element in its member types.


printRacCode

public void printRacCode(CompilationUnitDeclaration sourceUnit,
                         CompilationUnitDeclaration racUnit)
Prints the given RAC code of the given source to an internal file for a later parsing.


getRacSourceCode

public char[] getRacSourceCode()
Returns the RAC source code. This method should be called after RAC code generation is done. The contents is retrieved from a temporary file created by printSourceCode(CompilationUnitDeclaration)}.

See Also:
printSourceCode(CompilationUnitDeclaration)

debug

public static void debug(CompilationUnitDeclaration sunit)
Prints the given AST on debugStream if debugging information has been requested.