diff --git a/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java index 75e5dce..f4e94dd 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java @@ -235,6 +235,20 @@ } } + protected void fillGetterMethodToReturnComponentOfStateField(MethodDeclaration getter, Type containerStateType, ILanguageSpecific langSpec) { + if (DataConstraintModel.typeList.isAncestorOf(containerStateType)) { + Term selector = new Term(DataConstraintModel.get); + selector.addChild(new Variable(langSpec.getFieldAccessor(fieldOfResourceState))); + selector.addChild(new Variable(getter.getParameters().get(getter.getParameters().size() - 1).getName())); + getter.addStatement(langSpec.getReturnStatement(selector.toImplementation(new String[] {})) + langSpec.getStatementDelimiter()); + } else if (DataConstraintModel.typeMap.isAncestorOf(containerStateType)) { + Term selector = new Term(DataConstraintModel.lookup); + selector.addChild(new Variable(langSpec.getFieldAccessor(fieldOfResourceState))); + selector.addChild(new Variable(getter.getParameters().get(getter.getParameters().size() - 1).getName())); + getter.addStatement(langSpec.getReturnStatement(selector.toImplementation(new String[] {})) + langSpec.getStatementDelimiter()); + } + } + protected void declareAccessorInMainComponent(TypeDeclaration mainComponent, ResourceNode accessRes, MethodDeclaration getter, ILanguageSpecific langSpec) { List mainParams = new ArrayList<>(); for (Selector selector: accessRes.getAllSelectors()) {