| |
---|
| | + ((ResourceNode) re.getDestination()).getIdentifierTemplate().getResourceName().substring(1); |
---|
| | if (((PushPullAttribute) re.getAttribute()).getOptions().get(0) == PushPullValue.PUSH) { |
---|
| | type.addField(new FieldDeclaration(new Type(rename, rename), |
---|
| | ((ResourceNode) re.getDestination()).getIdentifierTemplate().getResourceName())); |
---|
| | type.addConstructor(new VariableDeclaration(new Type(rename, rename),((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); |
---|
| | type.addConstructors(new VariableDeclaration(new Type(rename, rename),((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); |
---|
| | } |
---|
| | } |
---|
| | for (Edge e : rn.getInEdges()) { |
---|
| | ResourceDependency re = (ResourceDependency) e; |
---|
| |
---|
| | + ((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName().substring(1); |
---|
| | if (((PushPullAttribute) re.getAttribute()).getOptions().get(0) != PushPullValue.PUSH) { |
---|
| | type.addField(new FieldDeclaration(new Type(rename, rename), |
---|
| | ((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); |
---|
| | type.addConstructor(new VariableDeclaration(new Type(rename, rename),((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); |
---|
| | type.addConstructors(new VariableDeclaration(new Type(rename, rename),((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName())); |
---|
| | } |
---|
| | } |
---|
| | if (((StoreAttribute) rn.getAttribute()).isStored()) |
---|
| | type.addField(new FieldDeclaration(DataConstraintModel.typeInt, |
---|
| |
---|
| | for (TypeDeclaration type : codeTree) { |
---|
| | codes.add("public class " + type.getTypeName() + "{"); |
---|
| | for (FieldDeclaration field : type.getFields()) { |
---|
| | if(type.getTypeName() != "Main") { |
---|
| | codes.add("\t" + field.getType().getImplementationTypeName() + " " + field.getName() + " = null;"); |
---|
| | codes.add("\t" + "private " + field.getType().getImplementationTypeName() + " " + field.getName() + ";"); |
---|
| | }else { |
---|
| | codes.add("\t" + field.getType().getImplementationTypeName() + " " + field.getName() + " = new " + field.getType().getTypeName() + "(" + ");"); |
---|
| | String cons = "\t" + "private " + field.getType().getImplementationTypeName() + " " + field.getName() + " = new " + field.getType().getTypeName() + "("; |
---|
| | for(VariableDeclaration constructor:type.getConstructors()) { |
---|
| | cons += constructor.getName() + ","; |
---|
| | } |
---|
| | if(!type.getConstructors().isEmpty()) cons = cons.substring(0, cons.length() - 1); |
---|
| | cons += ");"; |
---|
| | codes.add(cons); |
---|
| | } |
---|
| | } |
---|
| | codes.add(""); |
---|
| | if (type.getTypeName() != "Main") { |
---|
| | String cons = "\t" + type.getTypeName() + "("; |
---|
| | for(VariableDeclaration constructor:type.getConstructor()) { |
---|
| | String cons = "\t" + "public " + type.getTypeName() + "("; |
---|
| | for(VariableDeclaration constructor:type.getConstructors()) { |
---|
| | cons += constructor.getType().getTypeName() + " " + constructor.getName() + ","; |
---|
| | } |
---|
| | cons = cons.substring(0, cons.length() - 1); |
---|
| | if(!type.getConstructors().isEmpty()) cons = cons.substring(0, cons.length() - 1); |
---|
| | cons += ");"; |
---|
| | codes.add(cons); |
---|
| | for (FieldDeclaration field : type.getFields()) { |
---|
| | if(type.getTypeName().toLowerCase() != field.getName()) codes.add("\t\t" + "this." + field.getName() + " = " + field.getName()); |
---|
| | for(VariableDeclaration vari:type.getConstructors()) { |
---|
| | if(field.getType().getTypeName().equals(vari.getType().getTypeName())) { |
---|
| | codes.add("\t\t" + "this." + field.getName() + " = " + field.getName()); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | codes.add("\t" + "}"); |
---|
| | } |
---|
| | for (MethodDeclaration method : type.getMethods()) { |
---|
| |
---|
| | codes.add("\t" + "}"); |
---|
| | codes.add(""); |
---|
| | } |
---|
| | codes.add("}"); |
---|
| | codes.add(""); |
---|
| | } |
---|
| | return codes; |
---|
| | } |
---|
| | |
---|
| |
---|
| | |