diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java index 0948da2..8050a97 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java @@ -16,10 +16,12 @@ codes.add(new TypeDeclaration("Main")); for (ResourceNode rn : resources) { - codes.get(0).addField(new FieldDeclaration(rn.getIdentifierTemplate().getResourceStateType(), - rn.getIdentifierTemplate().getResourceName())); - codes.add(new TypeDeclaration(rn.getIdentifierTemplate().getResourceName())); + String name = rn.getIdentifierTemplate().getResourceName().substring(0, 1).toUpperCase() + + rn.getIdentifierTemplate().getResourceName().substring(1); + codes.get(0).addField(new FieldDeclaration(new Type(name, name), rn.getIdentifierTemplate().getResourceName())); + codes.add(new TypeDeclaration(name)); } + return codes; } @@ -43,22 +45,23 @@ if (flag) resources.add(rn); } - trackNode(resources.get(0),resources); + trackNode(resources.get(0), resources); return resources; } - - static private void trackNode(ResourceNode current,ArrayList resources) { - if(!resources.contains(current)) resources.add(current); - for(Edge e:current.getOutEdges()) { + + static private void trackNode(ResourceNode current, ArrayList resources) { + if (!resources.contains(current)) + resources.add(current); + for (Edge e : current.getOutEdges()) { ResourceDependency re = (ResourceDependency) e; - if(((PushPullAttribute) re.getAttribute()).getOptions().get(0) != PushPullValue.PUSH) { - trackNode((ResourceNode) re.getDestination(),resources); + if (((PushPullAttribute) re.getAttribute()).getOptions().get(0) != PushPullValue.PUSH) { + trackNode((ResourceNode) re.getDestination(), resources); } } for (Edge e : current.getInEdges()) { ResourceDependency re = (ResourceDependency) e; if (((PushPullAttribute) re.getAttribute()).getOptions().get(0) == PushPullValue.PUSH) { - trackNode((ResourceNode) re.getSource(),resources); + trackNode((ResourceNode) re.getSource(), resources); } } }