型関係の修正
1 parent ff28d90 commit a991d6c30037596c307ed4f59a39e61a733d5cfc
yoichiro authored on 27 Apr 2020
Showing 3 changed files
View
52
AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java
type.addField(new FieldDeclaration(new Type(rename, rename),
((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName()));
type.addConstructors(new VariableDeclaration(new Type(rename, rename),
((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName()));
}else {
vars.add(new VariableDeclaration(DataConstraintModel.typeInt,
} else {
vars.add(new VariableDeclaration(
((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceStateType(),
((ResourceNode) re.getSource()).getIdentifierTemplate().getResourceName()));
flag = true;
}
}
if(flag) type.addMethod(new MethodDeclaration("update", false, new Type("Void", "void"), vars));
if (flag)
type.addMethod(new MethodDeclaration("update", false, new Type("Void", "void"), vars));
if (((StoreAttribute) rn.getAttribute()).isStored()) {
type.addField(new FieldDeclaration(DataConstraintModel.typeInt,
type.addField(new FieldDeclaration(rn.getIdentifierTemplate().getResourceStateType(),
rn.getIdentifierTemplate().getResourceName()));
}
type.addMethod(new MethodDeclaration("get" + type.getTypeName(),DataConstraintModel.typeInt));
type.addMethod(new MethodDeclaration("get" + type.getTypeName(),
rn.getIdentifierTemplate().getResourceStateType()));
codes.add(type);
}
return codes;
}
}
}
codes.add("");
if (type.getTypeName() != "Main") {
String cons = "\t" + "public " + type.getTypeName() + "(";
for (VariableDeclaration constructor : type.getConstructors()) {
cons += constructor.getType().getTypeName() + " " + constructor.getName() + ",";
}
if (!type.getConstructors().isEmpty())
cons = cons.substring(0, cons.length() - 1);
cons += ");";
codes.add(cons);
for (FieldDeclaration field : type.getFields()) {
for (VariableDeclaration vari : type.getConstructors()) {
if (field.getType().getTypeName().equals(vari.getType().getTypeName())) {
codes.add("\t\t" + "this." + field.getName() + " = " + field.getName() + ";");
if (!type.getConstructors().isEmpty()) {
String cons = "\t" + "public " + type.getTypeName() + "(";
for (VariableDeclaration constructor : type.getConstructors()) {
cons += constructor.getType().getTypeName() + " " + constructor.getName() + ",";
}
if (!type.getConstructors().isEmpty())
cons = cons.substring(0, cons.length() - 1);
cons += "){";
codes.add(cons);
for (FieldDeclaration field : type.getFields()) {
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" + "}");
codes.add("\t" + "}");
}
}
codes.add("");
for (MethodDeclaration method : type.getMethods()) {
String varstr = "\t" + "public " + method.getReturnType().getImplementationTypeName() + " "
if (method.getParameters() != null) {
for (VariableDeclaration var : method.getParameters()) {
varstr += var.getType().getImplementationTypeName() + " " + var.getName() + ",";
}
if (!method.getParameters().isEmpty()) varstr = varstr.substring(0, varstr.length() - 1);
if (!method.getParameters().isEmpty())
varstr = varstr.substring(0, varstr.length() - 1);
}
codes.add(varstr + ")" + "{");
codes.add("\t" + "}");
codes.add("");
View
4
AlgebraicDataflowArchitectureModel/src/algorithms/DataStorageDecision.java
 
import java.util.HashSet;
 
import models.*;
import models.dataConstraintModel.DataConstraintModel;
import models.dataFlowModel.*;
 
public class DataStorageDecision {
static private HashSet<Node> arrivedNode = new HashSet<>();
}
if (resource.getInEdges().size() == 0)
flag = true;
((StoreAttribute) resource.getAttribute()).setStored(flag);
if(resource.getIdentifierTemplate().getResourceStateType() == null) {
resource.getIdentifierTemplate().setResourceStateType(DataConstraintModel.typeInt);
}
}
}
View
8
AlgebraicDataflowArchitectureModel/src/algorithms/EdgeTransitionSelectable.java
}
 
static private void trackEdges(Node n) {
PushPullAttribute ppat = new PushPullAttribute();
ppat.addOption(PushPullValue.PUSH);/*
* for (Node pre : n.getPredecessors()) { for (Edge in : n.getInEdges()) {
* ((ResourceDependency) in).setAttribute(ppat); } trackEdges(pre); }
*/
ppat.addOption(PushPullValue.PUSH);
for (Edge e : ((ResourceNode) n).getInEdges()) {
((ResourceDependency) e).setAttribute(ppat);
}
}