diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/JavaCodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/algorithms/JavaCodeGenerator.java index 92b0f8c..de89ba5 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithms/JavaCodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithms/JavaCodeGenerator.java @@ -143,10 +143,8 @@ constructor.addParameter(new VariableDeclaration(new Type(dstResName, dstResName), ((ResourceNode) re.getDestination()).getIdentifierTemplate().getResourceName())); block.addStatement("this." + dstResName.toLowerCase() + " = " + dstResName.toLowerCase() + ";"); - constructor.setBody(block); } } - block = new Block(); for (Edge e : rn.getInEdges()) { ResourceDependency re = (ResourceDependency) e; String srcResName = ((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName() @@ -159,7 +157,6 @@ constructor.addParameter(new VariableDeclaration(new Type(srcResName, srcResName), ((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); block.addStatement("this." + srcResName.toLowerCase() + " = " + srcResName.toLowerCase() + ";"); - constructor.setBody(block); } else { // Declare an update method in the type of the destination resource. ArrayList vars = new ArrayList<>(); @@ -182,11 +179,11 @@ type.addField(new FieldDeclaration(new Type(refResName, refResName), id.getResourceName())); constructor.addParameter(new VariableDeclaration(new Type(refResName, refResName), id.getResourceName())); block.addStatement("this." + refResName.toLowerCase() + " = " + refResName.toLowerCase() + ";"); - constructor.setBody(block); } } } } + constructor.setBody(block); if (constructor.getParameters() != null) type.addMethod(constructor);