diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java index 06b12cf..ff8a2b0 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java @@ -5,6 +5,7 @@ import code.ast.Block; import code.ast.CompilationUnit; import code.ast.FieldDeclaration; +import code.ast.ImportDeclaration; import code.ast.MethodDeclaration; import code.ast.TypeDeclaration; import code.ast.VariableDeclaration; @@ -51,7 +52,9 @@ ArrayList resources = StoreResourceCheck(graph); TypeDeclaration mainType = new TypeDeclaration(mainTypeName); - codes.add(new CompilationUnit(mainType)); + CompilationUnit mainCU = new CompilationUnit(mainType); + mainCU.addImport(new ImportDeclaration("java.util.*")); + codes.add(mainCU); for (ResourceNode rn : resources) { boolean f = false; String name = rn.getIdentifierTemplate().getResourceName().substring(0, 1).toUpperCase() @@ -80,7 +83,7 @@ if (rn.getIndegree() > 1) type.addField(new FieldDeclaration( ((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceStateType(), - rename)); + ((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); } } if (f) @@ -157,7 +160,9 @@ } type.addMethod(new MethodDeclaration("get" + type.getTypeName(), rn.getIdentifierTemplate().getResourceStateType())); - codes.add(new CompilationUnit(type)); + CompilationUnit cu = new CompilationUnit(type); + cu.addImport(new ImportDeclaration("java.util.*")); + codes.add(cu); } for (Node n : graph.getNodes()) { ResourceNode rn = (ResourceNode) n;