envgen.codegen
Class EnvPrinter

java.lang.Object
  |
  +--envgen.codegen.EnvPrinter

public class EnvPrinter
extends java.lang.Object

Class used for various printing tasks: printing of environment classes into their separate files, printing of error messages.


Field Summary
(package private) static java.lang.String context
          Set to use identify the framework to be used with the generated program (Bandera or JPF).
(package private)  int debug
           
(package private)  java.util.HashMap envTable
           
(package private)  java.lang.String outputDirName
           
(package private) static java.lang.String packageName
           
(package private)  java.util.HashMap unitTable
           
 
Constructor Summary
EnvPrinter(java.util.HashMap unitTable, java.util.HashMap envTable)
           
 
Method Summary
static void error(java.lang.String msg)
          Prints the error message and halts the execution.
static java.lang.String getBeginAtomicCall()
           
private  soot.SootMethod getConstructor(soot.SootClass sc)
           
static java.lang.String getDefValName(soot.Type type)
           
static java.lang.String getEndAtomicCall()
           
private  java.lang.String getFullPathName(java.lang.String name)
          Returns the name of the path by replacing "." with "/".
static java.lang.String getPackageAdjustedName(java.lang.String name)
           
static java.lang.String getPackageAdjustedName(soot.Type type)
          Returns the name of type as a string.
private  java.lang.String getPackageName(java.lang.String name)
          Returns the name of the package from name.
private  java.lang.String getPathName(java.lang.String name)
          Returns the name of the path by replacing "." with "/".
static java.lang.String getPrefixedName(java.lang.String name)
          Appends a dummy prefix to a name, Scene doesn't allow multiple classes with the same name, therefore stubs have special prefixed names.
static java.lang.String getRandomBoolCall()
           
static java.lang.String getRandomIntCall(int n)
           
static java.lang.String getRandomObjectCall(soot.Type type)
           
static java.lang.String getRandomReachableCall(soot.Type type, java.lang.String from)
           
static java.lang.String getRealName(java.lang.String name)
          Removes the prefix, reveals the real name of a class.
static java.lang.String getShortName(java.lang.String name)
          Returns a name of the class name excluding the package name.
static java.lang.String getTopArgs(java.util.List types)
          Generates a list of top values for a list of types.
static java.lang.String getTopValName(soot.Type type)
          Returns a name for a top value of type.
private  void printClass(java.io.FileWriter file, soot.SootClass sc)
          Prints sc class to a file.
private  void printf(java.io.FileWriter outStream, java.lang.String string)
          Prints string to a file.
private  void printFields(java.io.FileWriter file, soot.SootClass sc)
          Prints fields of sc to a file.
 void printfTable(java.util.HashMap markedTable)
          Prints soot classes of markedTable to their files.
private  void printInterface(java.io.FileWriter file, soot.SootClass sc)
          Prints information about interfaces of sc to a file.
private  void printMethod(java.io.FileWriter file, soot.SootMethod markedMethod)
          Prints method of sc to file.
private  void printMethods(java.io.FileWriter file, soot.SootClass sc)
          Prints methods of sc to file.
private  void printParams(java.io.FileWriter file, soot.SootMethod markedMethod)
          Prints parameters of markedMethod to file.
static void printTable(java.util.HashMap table)
          Prints a hashtable of sootclasses and their methods.
private  void printThrowsExceptions(java.io.FileWriter file, soot.SootMethod markedMethod)
           
 void setEnvTable(java.util.HashMap envTable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitTable

java.util.HashMap unitTable

envTable

java.util.HashMap envTable

packageName

static java.lang.String packageName

outputDirName

java.lang.String outputDirName

context

static java.lang.String context
Set to use identify the framework to be used with the generated program (Bandera or JPF). By default, JPF is used.


debug

int debug
Constructor Detail

EnvPrinter

public EnvPrinter(java.util.HashMap unitTable,
                  java.util.HashMap envTable)
Method Detail

setEnvTable

public void setEnvTable(java.util.HashMap envTable)

printTable

public static void printTable(java.util.HashMap table)
Prints a hashtable of sootclasses and their methods.


printfTable

public void printfTable(java.util.HashMap markedTable)
Prints soot classes of markedTable to their files.


printf

private void printf(java.io.FileWriter outStream,
                    java.lang.String string)
Prints string to a file.


printClass

private void printClass(java.io.FileWriter file,
                        soot.SootClass sc)
Prints sc class to a file.


printInterface

private void printInterface(java.io.FileWriter file,
                            soot.SootClass sc)
Prints information about interfaces of sc to a file.


printFields

private void printFields(java.io.FileWriter file,
                         soot.SootClass sc)
Prints fields of sc to a file.


printMethods

private void printMethods(java.io.FileWriter file,
                          soot.SootClass sc)
Prints methods of sc to file.


printMethod

private void printMethod(java.io.FileWriter file,
                         soot.SootMethod markedMethod)
Prints method of sc to file.


printParams

private void printParams(java.io.FileWriter file,
                         soot.SootMethod markedMethod)
Prints parameters of markedMethod to file.


printThrowsExceptions

private void printThrowsExceptions(java.io.FileWriter file,
                                   soot.SootMethod markedMethod)
Parameters:
file -
markedMethod -

getConstructor

private soot.SootMethod getConstructor(soot.SootClass sc)

getRealName

public static java.lang.String getRealName(java.lang.String name)
Removes the prefix, reveals the real name of a class.


getPrefixedName

public static java.lang.String getPrefixedName(java.lang.String name)
Appends a dummy prefix to a name, Scene doesn't allow multiple classes with the same name, therefore stubs have special prefixed names.


getFullPathName

private java.lang.String getFullPathName(java.lang.String name)
Returns the name of the path by replacing "." with "/".


getPathName

private java.lang.String getPathName(java.lang.String name)
Returns the name of the path by replacing "." with "/".


getShortName

public static java.lang.String getShortName(java.lang.String name)
Returns a name of the class name excluding the package name.


getPackageName

private java.lang.String getPackageName(java.lang.String name)
Returns the name of the package from name.


getPackageAdjustedName

public static java.lang.String getPackageAdjustedName(java.lang.String name)

getPackageAdjustedName

public static java.lang.String getPackageAdjustedName(soot.Type type)
Returns the name of type as a string.


getBeginAtomicCall

public static java.lang.String getBeginAtomicCall()

getEndAtomicCall

public static java.lang.String getEndAtomicCall()

getRandomBoolCall

public static java.lang.String getRandomBoolCall()

getRandomIntCall

public static java.lang.String getRandomIntCall(int n)

getRandomObjectCall

public static java.lang.String getRandomObjectCall(soot.Type type)

getRandomReachableCall

public static java.lang.String getRandomReachableCall(soot.Type type,
                                                      java.lang.String from)

getTopValName

public static java.lang.String getTopValName(soot.Type type)
Returns a name for a top value of type.


getTopArgs

public static java.lang.String getTopArgs(java.util.List types)
Generates a list of top values for a list of types.


getDefValName

public static java.lang.String getDefValName(soot.Type type)

error

public static void error(java.lang.String msg)
Prints the error message and halts the execution.