Code code = new Code();
String line = null;
+ Code fieldsInit = null;
// Add auto-generated comments
code.addLine("/**");
code.addLine("");
// Define @Print
- if (!globalConstruct.printState.isEmpty()) {
- code.addLine(ShortComment("Define @" + SpecNaming.PrintState));
- code.addLine("void _" + SpecNaming.PrintState.toLowerCase() + "("
- + SpecNaming.Method + " " + SpecNaming.Method1 + ") {");
-
- // Initialize state struct fields
- Code fieldsInit = GenerateStateFieldsInitialization(
- SpecNaming.Method1, SpecNaming.StateInst, globalConstruct);
- fieldsInit.align(1);
- code.addLines(fieldsInit);
- code.addLine("");
- if (!globalConstruct.autoGenPrint)
- code.addLine(TabbedLine(ShortComment("Execute user-defined state printing code")));
- else
- // Auto-generated the copy function
- code.addLine(TabbedLine(ShortComment("Execute auto-generated state printing code")));
-
- // Align the code with one tab
- globalConstruct.printState.align(1);
- code.addLines(globalConstruct.printState);
- code.addLine("}");
- code.addLine("");
- }
+ code.addLine(ShortComment("Define @" + SpecNaming.PrintState));
+ code.addLine("void _" + SpecNaming.PrintState.toLowerCase() + "("
+ + SpecNaming.Method + " " + SpecNaming.Method1 + ") {");
+
+ // Initialize state struct fields
+ fieldsInit = GenerateStateFieldsInitialization(SpecNaming.Method1,
+ SpecNaming.StateInst, globalConstruct);
+ fieldsInit.align(1);
+ code.addLines(fieldsInit);
+ code.addLine("");
+ if (!globalConstruct.autoGenPrint)
+ code.addLine(TabbedLine(ShortComment("Execute user-defined state printing code")));
+ else
+ // Auto-generated the copy function
+ code.addLine(TabbedLine(ShortComment("Execute auto-generated state printing code")));
+
+ // Align the code with one tab
+ globalConstruct.printState.align(1);
+ code.addLines(globalConstruct.printState);
+ code.addLine("}");
+ code.addLine("");
// Define @Commutativity
code.addLine(ShortComment("Define commutativity checking functions"));
for (File file : interfaceListMap.keySet()) {
ArrayList<InterfaceConstruct> list = interfaceListMap.get(file);
for (InterfaceConstruct construct : list) {
- Code fieldsInit = null;
+ fieldsInit = null;
// Define interface functions
String name = construct.getName();