Package EDU.purdue.jtb.generate
Class UserFilesGenerator
- java.lang.Object
-
- EDU.purdue.jtb.generate.UserFilesGenerator
-
public class UserFilesGenerator extends java.lang.Object
ClassUserFilesGenerator
contains methods to generate: CODEJAVA- the (grammar) user nodes classes (genUserXxx, using
UserClassInfo
), - the hook interface and empty class files (genXxxEnterExitHook).
Class maintains a state, and is not supposed to be run in parallel threads (on the same grammar); however it internally uses different threads (streams) to generate the different user classes in parallel.
TESTCASE some to add - the (grammar) user nodes classes (genUserXxx, using
-
-
Constructor Summary
Constructors Constructor Description UserFilesGenerator(JTBOptions aJopt, CommonCodeGenerator aCcg, java.util.List<UserClassInfo> aClasses)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
genEmtpyEnterExitHookFile(java.io.File aHookDir)
Generates the genEmtpyEnterExitHookFile (class source) file.int
genIEnterExitHookFile(java.io.File aHookDir)
Generates the IEnterExitHook (interface source) file.int
genUserNodesFiles(java.io.File aNodesDir)
Generates user nodes (classes source) files.void
outputFormattedNodesClassesList(java.io.PrintWriter aPw)
Outputs the formatted nodes classes list.
-
-
-
Constructor Detail
-
UserFilesGenerator
public UserFilesGenerator(JTBOptions aJopt, CommonCodeGenerator aCcg, java.util.List<UserClassInfo> aClasses)
Constructor. Creates the syntaxtree and hook directories if they do not exist.- Parameters:
aJopt
- - the JTB optionsaCcg
- - theCommonCodeGenerator
aClasses
- - the list ofUserClassInfo
classes instances
-
-
Method Detail
-
outputFormattedNodesClassesList
public void outputFormattedNodesClassesList(java.io.PrintWriter aPw)
Outputs the formatted nodes classes list.- Parameters:
aPw
- - a PrintWriter to output on
-
genUserNodesFiles
public int genUserNodesFiles(java.io.File aNodesDir) throws java.lang.Exception
Generates user nodes (classes source) files.- Parameters:
aNodesDir
- - the nodes directory File- Returns:
- the number of generated files
- Throws:
java.lang.Exception
- - on any exception
-
genIEnterExitHookFile
public int genIEnterExitHookFile(java.io.File aHookDir) throws java.io.IOException
Generates the IEnterExitHook (interface source) file.- Parameters:
aHookDir
- - the hook directory File- Returns:
- OK_RC or FILE_EXISTS_RC
- Throws:
java.io.IOException
- - if IO problem
-
genEmtpyEnterExitHookFile
public int genEmtpyEnterExitHookFile(java.io.File aHookDir) throws java.io.IOException
Generates the genEmtpyEnterExitHookFile (class source) file.- Parameters:
aHookDir
- - the nodes directory File- Returns:
- OK_RC or FILE_EXISTS_RC
- Throws:
java.io.IOException
- - if IO problem
-
-