Skip to content
Snippets Groups Projects
Commit 7c8765e6 authored by René Schöne's avatar René Schöne
Browse files

Merge branch 'feature/remove-tree-list-in-dsl' into 33-make-specification-langauge-more-concise

parents e7e762da 0d65fe3a
No related branches found
No related tags found
3 merge requests!39Version 1.1.0,!35Version 1.0.0,!19Resolve "Make specification langauge more concise"
Showing
with 223 additions and 105 deletions
...@@ -5,9 +5,9 @@ The full example is available at <https://git-st.inf.tu-dresden.de/jastadd/ragco ...@@ -5,9 +5,9 @@ The full example is available at <https://git-st.inf.tu-dresden.de/jastadd/ragco
## Preparation and Specification ## Preparation and Specification
The following examples are inspired by the real test case [read1write2](https://git-st.inf.tu-dresden.de/jastadd/ragconnect-tests/-/tree/master/ragconnect.tests/src/test/01-input/read1write2) The following examples are inspired by the real test case [read1write2](https://git-st.inf.tu-dresden.de/jastadd/ragconnect-tests/-/tree/master/ragconnect.tests/src/test/01-input/read1write2)
The idea is to have two nonterminals, where input information is received on one of them, and - after transformation - is sent out by both. The idea is to have two non-terminals, where input information is received on one of them, and - after transformation - is sent out by both.
Let the following grammar be used: Let's use the following grammar:
``` ```
A ::= <Input:String> /<OutputOnA:String>/ B* ; A ::= <Input:String> /<OutputOnA:String>/ B* ;
...@@ -105,7 +105,7 @@ b1.connectOutputOnB("mqtt://localhost/b1/out", true); ...@@ -105,7 +105,7 @@ b1.connectOutputOnB("mqtt://localhost/b1/out", true);
b2.connectOutputOnB("mqtt://localhost/b2/out", false); b2.connectOutputOnB("mqtt://localhost/b2/out", false);
``` ```
The first parameter of those connect-methods is always an URI-like String, to identify the protocol to use, the server operating the protocol, and a path to identify the concrete token. The first parameter of those connect-methods is always a URI-like String, to identify the protocol to use, the server operating the protocol, and a path to identify the concrete token.
In case of MQTT, the server is the host running an MQTT broker, and the path is equal to the topic to publish or subscribe to. In case of MQTT, the server is the host running an MQTT broker, and the path is equal to the topic to publish or subscribe to.
Please note, that the first leading slash (`/`) is removed for MQTT topics, e.g., for `A.Input` the topic is actually `topic/for/input`. Please note, that the first leading slash (`/`) is removed for MQTT topics, e.g., for `A.Input` the topic is actually `topic/for/input`.
......
aspect NameResolution { aspect RagConnectNameResolution {
// rel EndpointDefinition.Mapping* -> MappingDefinition
refine RefResolverStubs eq EndpointDefinition.resolveMappingByToken(String id, int position) { refine RefResolverStubs eq EndpointDefinition.resolveMappingByToken(String id, int position) {
// return a MappingDefinition MappingDefinition result = tryResolveMappingByToken(id);
if (result == null) {
System.err.println("Could not resolve MappingDefinition '" + id + "'.");
}
return result;
}
syn MappingDefinition EndpointDefinition.tryResolveMappingByToken(String id) {
for (MappingDefinition mappingDefinition : ragconnect().allMappingDefinitionList()) { for (MappingDefinition mappingDefinition : ragconnect().allMappingDefinitionList()) {
if (mappingDefinition.getID().equals(id)) { if (mappingDefinition.getID().equals(id)) {
return mappingDefinition; return mappingDefinition;
} }
} }
System.err.println("Could not resolve MappingDefinition '" + id + "'.");
return null; return null;
} }
// rel ___ -> TypeComponent
refine RefResolverStubs eq ASTNode.globallyResolveTypeComponentByToken(String id) { refine RefResolverStubs eq ASTNode.globallyResolveTypeComponentByToken(String id) {
// return a TypeComponent. id is of the form 'parent_type_name + "." + child_type_name' TypeComponent result = tryGloballyResolveTypeComponentByToken(id);
if (result == null) {
System.err.println("Could not resolve TypeComponent '" + id + "'.");
}
return result;
}
syn TypeComponent ASTNode.tryGloballyResolveTypeComponentByToken(String id) {
// id is of the form 'parent_type_name + "." + child_type_name'
int dotIndex = id.indexOf("."); int dotIndex = id.indexOf(".");
String parentTypeName = id.substring(0, dotIndex); String parentTypeName = id.substring(0, dotIndex);
String childTypeName = id.substring(dotIndex + 1); String childTypeName = id.substring(dotIndex + 1);
...@@ -23,12 +37,19 @@ aspect NameResolution { ...@@ -23,12 +37,19 @@ aspect NameResolution {
return comp.asTypeComponent(); return comp.asTypeComponent();
} }
} }
System.err.println("Could not resolve TypeComponent '" + id + "'.");
return null; return null;
} }
// rel ___ -> Component
refine RefResolverStubs eq ASTNode.globallyResolveComponentByToken(String id) { refine RefResolverStubs eq ASTNode.globallyResolveComponentByToken(String id) {
// return a Component. id is of the form 'parent_type_name + "." + child_type_name' Component result = tryGloballyResolveComponentByToken(id);
if (result == null) {
System.err.println("Could not resolve Component '" + id + "'.");
}
return result;
}
syn Component ASTNode.tryGloballyResolveComponentByToken(String id) {
// id is of the form 'parent_type_name + "." + child_type_name'
int dotIndex = id.indexOf("."); int dotIndex = id.indexOf(".");
String parentTypeName = id.substring(0, dotIndex); String parentTypeName = id.substring(0, dotIndex);
String childTypeName = id.substring(dotIndex + 1); String childTypeName = id.substring(dotIndex + 1);
...@@ -39,7 +60,30 @@ aspect NameResolution { ...@@ -39,7 +60,30 @@ aspect NameResolution {
return comp; return comp;
} }
} }
System.err.println("Could not resolve Component '" + id + "'."); return null;
}
// rel ___ -> TokenComponent (from relast-preprocessor)
// refine here to have an attribute without writing on stderr if not found
refine NameResolution eq ASTNode.globallyResolveTokenComponentByToken(String id) {
TokenComponent result = tryGloballyResolveTokenComponentByToken(id);
if (result == null) {
System.err.println("Could not resolve TokenComponent '" + id + "'.");
}
return result;
}
syn TokenComponent ASTNode.tryGloballyResolveTokenComponentByToken(String id) {
// id is of the form 'type_name + "." + token_name'
int dotIndex = id.indexOf(".");
String typeName = id.substring(0, dotIndex);
String tokenName = id.substring(dotIndex + 1);
TypeDecl type = program().resolveTypeDecl(typeName);
// iterate over components and find the matching tokenComponent
for (Component comp : type.getComponentList()) {
if (comp.isTokenComponent() && comp.getName().equals(tokenName)) {
return comp.asTokenComponent();
}
}
return null; return null;
} }
......
...@@ -13,7 +13,7 @@ rel TokenEndpointDefinition.Token <-> TokenComponent.TokenEndpointDefinition*; ...@@ -13,7 +13,7 @@ rel TokenEndpointDefinition.Token <-> TokenComponent.TokenEndpointDefinition*;
ReceiveTokenEndpointDefinition : TokenEndpointDefinition; ReceiveTokenEndpointDefinition : TokenEndpointDefinition;
SendTokenEndpointDefinition : TokenEndpointDefinition; SendTokenEndpointDefinition : TokenEndpointDefinition;
abstract TypeEndpointDefinition : EndpointDefinition ::= <UseList:boolean> ; abstract TypeEndpointDefinition : EndpointDefinition ::= <IndexBasedListAccess:boolean> ;
rel TypeEndpointDefinition.Type <-> TypeComponent.TypeEndpointDefinition*; rel TypeEndpointDefinition.Type <-> TypeComponent.TypeEndpointDefinition*;
ReceiveTypeEndpointDefinition : TypeEndpointDefinition ::= <WithAdd:boolean>; ReceiveTypeEndpointDefinition : TypeEndpointDefinition ::= <WithAdd:boolean>;
...@@ -28,3 +28,8 @@ abstract MappingDefinitionType ::= ; ...@@ -28,3 +28,8 @@ abstract MappingDefinitionType ::= ;
JavaMappingDefinitionType : MappingDefinitionType ::= Type:JavaTypeUse ; JavaMappingDefinitionType : MappingDefinitionType ::= Type:JavaTypeUse ;
JavaArrayMappingDefinitionType : MappingDefinitionType ::= Type:JavaTypeUse ; JavaArrayMappingDefinitionType : MappingDefinitionType ::= Type:JavaTypeUse ;
DefaultMappingDefinition : MappingDefinition ; DefaultMappingDefinition : MappingDefinition ;
// only used by parser
abstract UntypedEndpointDefinition : EndpointDefinition ::= <TokenOrType> <Indexed:boolean> <WithAdd:boolean> ;
ReceiveUntypedEndpointDefinition : UntypedEndpointDefinition;
SendUntypedEndpointDefinition : UntypedEndpointDefinition;
...@@ -124,10 +124,10 @@ aspect AttributesForMustache { ...@@ -124,10 +124,10 @@ aspect AttributesForMustache {
// --- MTypeEndpointDefinition --- // --- MTypeEndpointDefinition ---
syn boolean MTypeEndpointDefinition.isWithAdd() = endpointDef().isReceiveTypeEndpointDefinition() ? endpointDef().asReceiveTypeEndpointDefinition().getWithAdd() : false; syn boolean MTypeEndpointDefinition.isWithAdd() = endpointDef().isReceiveTypeEndpointDefinition() ? endpointDef().asReceiveTypeEndpointDefinition().getWithAdd() : false;
syn boolean MTypeEndpointDefinition.isUseList() = endpointDef().asTypeEndpointDefinition().getUseList(); syn boolean MTypeEndpointDefinition.isIndexBasedListAccess() = endpointDef().asTypeEndpointDefinition().getIndexBasedListAccess();
eq MTypeEndpointDefinition.getterMethod() = "get" + typeName() + (typeIsList() ? "List" : ""); eq MTypeEndpointDefinition.getterMethod() = "get" + typeName() + (typeIsList() ? "List" : "");
eq MTypeEndpointDefinition.parentTypeName() = type().containingTypeDecl().getName(); eq MTypeEndpointDefinition.parentTypeName() = type().containingTypeDecl().getName();
eq MTypeEndpointDefinition.entityName() = typeName() + (isUseList() ? "List" : ""); eq MTypeEndpointDefinition.entityName() = typeName() + (typeIsList() && !isIndexBasedListAccess() ? "List" : "");
// --- MInnerMappingDefinition --- // --- MInnerMappingDefinition ---
inh boolean MInnerMappingDefinition.isLast(); inh boolean MInnerMappingDefinition.isLast();
...@@ -398,7 +398,7 @@ aspect GrammarGeneration { ...@@ -398,7 +398,7 @@ aspect GrammarGeneration {
syn TokenComponent EndpointDefinition.getTokenToCreate() = null; syn TokenComponent EndpointDefinition.getTokenToCreate() = null;
eq TypeEndpointDefinition.getTokenToCreate() { eq TypeEndpointDefinition.getTokenToCreate() {
if (typeIsList() && !getUseList()) { if (typeIsList() && getIndexBasedListAccess()) {
TokenComponent result = new TokenComponent(); TokenComponent result = new TokenComponent();
result.setName(idTokenName()); result.setName(idTokenName());
result.setNTA(false); result.setNTA(false);
......
...@@ -145,7 +145,7 @@ aspect Mappings { ...@@ -145,7 +145,7 @@ aspect Mappings {
// if no mappings are specified, or if first mapping is not suitable. // if no mappings are specified, or if first mapping is not suitable.
// then prepend the suitable default mapping // then prepend the suitable default mapping
if (getMappingList().isEmpty() || !getMappingList().get(0).getFromType().isByteArray()) { if (getMappingList().isEmpty() || !getMappingList().get(0).getFromType().isByteArray()) {
result = new java.util.ArrayList(); result = new java.util.ArrayList<>();
result.add(suitableReceiveDefaultMapping()); result.add(suitableReceiveDefaultMapping());
result.addAll(getMappingList()); result.addAll(getMappingList());
} else { } else {
...@@ -155,7 +155,7 @@ aspect Mappings { ...@@ -155,7 +155,7 @@ aspect Mappings {
// if no mappings are specified, or if last mapping is not suitable // if no mappings are specified, or if last mapping is not suitable
// then append the suitable default mapping // then append the suitable default mapping
if (getMappingList().isEmpty() || !getMappingList().get(getMappingList().size() - 1).getToType().isByteArray()) { if (getMappingList().isEmpty() || !getMappingList().get(getMappingList().size() - 1).getToType().isByteArray()) {
result = new java.util.ArrayList(getMappingList()); result = new java.util.ArrayList<>(getMappingList());
result.add(suitableSendDefaultMapping()); result.add(suitableSendDefaultMapping());
} else { } else {
result = getMappingList(); result = getMappingList();
...@@ -220,7 +220,7 @@ aspect Mappings { ...@@ -220,7 +220,7 @@ aspect Mappings {
eq TypeEndpointDefinition.suitableReceiveDefaultMapping() { eq TypeEndpointDefinition.suitableReceiveDefaultMapping() {
try { try {
TypeDecl typeDecl = program().resolveTypeDecl(targetTypeName()); TypeDecl typeDecl = program().resolveTypeDecl(targetTypeName());
return typeIsList() && getUseList() ? ragconnect().defaultBytesToListTreeMapping(typeDecl.getName()) : ragconnect().defaultBytesToTreeMapping(typeDecl.getName()); return typeIsList() && !getIndexBasedListAccess() ? ragconnect().defaultBytesToListTreeMapping(typeDecl.getName()) : ragconnect().defaultBytesToTreeMapping(typeDecl.getName());
} catch (Exception ignore) {} } catch (Exception ignore) {}
return super.suitableReceiveDefaultMapping(); return super.suitableReceiveDefaultMapping();
} }
...@@ -256,7 +256,7 @@ aspect Mappings { ...@@ -256,7 +256,7 @@ aspect Mappings {
eq TypeEndpointDefinition.suitableSendDefaultMapping() { eq TypeEndpointDefinition.suitableSendDefaultMapping() {
try { try {
TypeDecl typeDecl = program().resolveTypeDecl(targetTypeName()); TypeDecl typeDecl = program().resolveTypeDecl(targetTypeName());
return typeIsList() && getUseList() ? ragconnect().defaultListTreeToBytesMapping() : ragconnect().defaultTreeToBytesMapping(typeDecl.getName()); return typeIsList() && !getIndexBasedListAccess() ? ragconnect().defaultListTreeToBytesMapping() : ragconnect().defaultTreeToBytesMapping(typeDecl.getName());
} catch (Exception ignore) {} } catch (Exception ignore) {}
return super.suitableSendDefaultMapping(); return super.suitableSendDefaultMapping();
} }
......
aspect ParserRewrites {
rewrite SendUntypedEndpointDefinition {
when (tryGloballyResolveTypeComponentByToken(getTokenOrType()) != null)
to SendTypeEndpointDefinition {
SendTypeEndpointDefinition result = new SendTypeEndpointDefinition();
result.applyFrom(this);
result.setIndexBasedListAccess(this.getIndexed());
return result;
}
}
rewrite ReceiveUntypedEndpointDefinition {
when (tryGloballyResolveTypeComponentByToken(getTokenOrType()) != null)
to ReceiveTypeEndpointDefinition {
ReceiveTypeEndpointDefinition result = new ReceiveTypeEndpointDefinition();
result.applyFrom(this);
result.setWithAdd(this.getWithAdd());
result.setIndexBasedListAccess(this.getIndexed());
return result;
}
}
rewrite SendUntypedEndpointDefinition {
when (tryGloballyResolveTokenComponentByToken(getTokenOrType()) != null)
to SendTokenEndpointDefinition {
SendTokenEndpointDefinition result = new SendTokenEndpointDefinition();
result.applyFrom(this);
return result;
}
}
rewrite ReceiveUntypedEndpointDefinition {
when (tryGloballyResolveTokenComponentByToken(getTokenOrType()) != null)
to ReceiveTokenEndpointDefinition {
ReceiveTokenEndpointDefinition result = new ReceiveTokenEndpointDefinition();
result.applyFrom(this);
return result;
}
}
protected void TypeEndpointDefinition.applyFrom(UntypedEndpointDefinition def) {
this.setAlwaysApply(def.getAlwaysApply());
this.setType(TypeComponent.createRef(def.getTokenOrType()));
this.moveMappingsFrom(def);
}
protected void TokenEndpointDefinition.applyFrom(UntypedEndpointDefinition def) {
this.setAlwaysApply(def.getAlwaysApply());
this.setToken(TokenComponent.createRef(def.getTokenOrType()));
this.moveMappingsFrom(def);
}
protected void EndpointDefinition.moveMappingsFrom(UntypedEndpointDefinition def) {
// can safely iterate over list as we get an unmodifyable list
for (MappingDefinition mapping : def.getMappingList().toArray(new MappingDefinition[0])) {
def.removeMapping(mapping);
this.addMapping(mapping);
}
}
private void UntypedEndpointDefinition.clearMappings() {
}
eq UntypedEndpointDefinition.targetTypeName() = "<unknown>";
syn MEndpointDefinition UntypedEndpointDefinition.toMustache() {
throw new RuntimeException("UntypedEndpoint can not be transformed using toMustache!");
}
}
...@@ -43,49 +43,49 @@ EndpointDefinition endpoint_definition ...@@ -43,49 +43,49 @@ EndpointDefinition endpoint_definition
; ;
EndpointDefinition endpoint_definition_type EndpointDefinition endpoint_definition_type
= RECEIVE token_ref {: return new ReceiveTokenEndpointDefinition().setToken(token_ref); :} = SEND ID.type_name DOT ID.child_name
| SEND token_ref {: return new SendTokenEndpointDefinition().setToken(token_ref); :}
| RECEIVE TREE type_ref {: return new ReceiveTypeEndpointDefinition().setType(type_ref); :}
| RECEIVE TREE WITH ADD type_ref
{: {:
ReceiveTypeEndpointDefinition result = new ReceiveTypeEndpointDefinition(); SendUntypedEndpointDefinition result = new SendUntypedEndpointDefinition();
result.setType(type_ref); result.setTokenOrType(type_name + "." + child_name);
result.setWithAdd(true); return result;
:}
| SEND INDEXED ID.type_name DOT ID.child_name
{:
SendUntypedEndpointDefinition result = new SendUntypedEndpointDefinition();
result.setTokenOrType(type_name + "." + child_name);
result.setIndexed(true);
return result;
:}
| RECEIVE ID.type_name DOT ID.child_name
{:
ReceiveUntypedEndpointDefinition result = new ReceiveUntypedEndpointDefinition();
result.setTokenOrType(type_name + "." + child_name);
return result; return result;
:} :}
| SEND TREE type_ref {: return new SendTypeEndpointDefinition().setType(type_ref); :} | RECEIVE INDEXED ID.type_name DOT ID.child_name
| RECEIVE LIST type_ref
{: {:
ReceiveTypeEndpointDefinition result = new ReceiveTypeEndpointDefinition(); ReceiveUntypedEndpointDefinition result = new ReceiveUntypedEndpointDefinition();
result.setType(type_ref); result.setTokenOrType(type_name + "." + child_name);
result.setUseList(true); result.setIndexed(true);
return result; return result;
:} :}
| RECEIVE LIST WITH ADD type_ref | RECEIVE WITH ADD ID.type_name DOT ID.child_name
{: {:
ReceiveTypeEndpointDefinition result = new ReceiveTypeEndpointDefinition(); ReceiveUntypedEndpointDefinition result = new ReceiveUntypedEndpointDefinition();
result.setType(type_ref); result.setTokenOrType(type_name + "." + child_name);
result.setWithAdd(true); result.setWithAdd(true);
result.setUseList(true);
return result; return result;
:} :}
| SEND LIST type_ref | RECEIVE INDEXED WITH ADD ID.type_name DOT ID.child_name
{: {:
SendTypeEndpointDefinition result = new SendTypeEndpointDefinition(); ReceiveUntypedEndpointDefinition result = new ReceiveUntypedEndpointDefinition();
result.setType(type_ref); result.setTokenOrType(type_name + "." + child_name);
result.setUseList(true); result.setIndexed(true);
result.setWithAdd(true);
return result; return result;
:} :}
; ;
TokenComponent token_ref
= ID.type_name DOT ID.token_name {: return TokenComponent.createRef(type_name + "." + token_name); :}
;
TypeComponent type_ref
= ID.parent_type_name DOT ID.child_type_name {: return TypeComponent.createRef(parent_type_name + "." + child_type_name); :}
;
ArrayList string_list ArrayList string_list
= ID = ID
| string_list COMMA ID | string_list COMMA ID
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"maps" { return sym(Terminals.MAPS); } "maps" { return sym(Terminals.MAPS); }
"to" { return sym(Terminals.TO); } "to" { return sym(Terminals.TO); }
"as" { return sym(Terminals.AS); } "as" { return sym(Terminals.AS); }
"tree" { return sym(Terminals.TREE); } //"tree" { return sym(Terminals.TREE); }
"list" { return sym(Terminals.LIST); } //"list" { return sym(Terminals.LIST); }
"with" { return sym(Terminals.WITH); } "with" { return sym(Terminals.WITH); }
"indexed" { return sym(Terminals.INDEXED); }
"add" { return sym(Terminals.ADD); } "add" { return sym(Terminals.ADD); }
{{#typeIsList}} {{#typeIsList}}
{{^UseList}} {{#IndexBasedListAccess}}
private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) { private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) {
for (int index = 0; index < getNum{{entityName}}(); index++) { for (int index = 0; index < getNum{{entityName}}(); index++) {
if (get{{entityName}}(index).get{{idTokenName}}().equals(topic)) { if (get{{entityName}}(index).get{{idTokenName}}().equals(topic)) {
...@@ -8,7 +8,7 @@ private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) { ...@@ -8,7 +8,7 @@ private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) {
} }
return -1; return -1;
} }
{{/UseList}} {{/IndexBasedListAccess}}
{{/typeIsList}} {{/typeIsList}}
/** /**
...@@ -17,13 +17,13 @@ private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) { ...@@ -17,13 +17,13 @@ private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) {
* New values are appended to the end of the list. * New values are appended to the end of the list.
{{/isWithAdd}}{{/typeIsList}} {{/isWithAdd}}{{/typeIsList}}
* @param {{connectParameterName}} string describing protocol and path as an URI * @param {{connectParameterName}} string describing protocol and path as an URI
{{#typeIsList}}{{^UseList}}{{^isWithAdd}} {{#typeIsList}}{{#IndexBasedListAccess}}{{^isWithAdd}}
* @param index index of node in list to connect (the list is expected to have enough elements) * @param index index of node in list to connect (the list is expected to have enough elements)
{{/isWithAdd}}{{/UseList}}{{/typeIsList}} {{/isWithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}
* @return true if connect was successful, false otherwise * @return true if connect was successful, false otherwise
* @throws java.io.IOException if connect failed * @throws java.io.IOException if connect failed
*/ */
public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterName}}{{#typeIsList}}{{^UseList}}{{^isWithAdd}}, int index{{/isWithAdd}}{{/UseList}}{{/typeIsList}}) throws java.io.IOException { public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterName}}{{#typeIsList}}{{#IndexBasedListAccess}}{{^isWithAdd}}, int index{{/isWithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}) throws java.io.IOException {
java.util.function.BiConsumer<String, byte[]> consumer = (topic, message) -> { java.util.function.BiConsumer<String, byte[]> consumer = (topic, message) -> {
{{> mappingApplication}} {{> mappingApplication}}
{{#loggingEnabledForReads}} {{#loggingEnabledForReads}}
...@@ -32,15 +32,15 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam ...@@ -32,15 +32,15 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam
{{#isTypeEndpointDefinition}} {{#isTypeEndpointDefinition}}
{{lastResult}}.treeResolveAll(); {{lastResult}}.treeResolveAll();
{{#typeIsList}} {{#typeIsList}}
{{#UseList}} {{^IndexBasedListAccess}}
{{#isWithAdd}} {{#isWithAdd}}
{{getterMethod}}().addAll({{lastResult}}); {{getterMethod}}().addAll({{lastResult}});
{{/isWithAdd}} {{/isWithAdd}}
{{^isWithAdd}} {{^isWithAdd}}
set{{entityName}}({{lastResult}}); set{{entityName}}({{lastResult}});
{{/isWithAdd}} {{/isWithAdd}}
{{/UseList}} {{/IndexBasedListAccess}}
{{^UseList}} {{#IndexBasedListAccess}}
{{lastResult}}.set{{idTokenName}}(topic); {{lastResult}}.set{{idTokenName}}(topic);
{{#isWithAdd}} {{#isWithAdd}}
{{getterMethod}}().add({{lastResult}}); {{getterMethod}}().add({{lastResult}});
...@@ -48,7 +48,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam ...@@ -48,7 +48,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam
{{^isWithAdd}} {{^isWithAdd}}
set{{entityName}}({{lastResult}}, index); set{{entityName}}({{lastResult}}, index);
{{/isWithAdd}} {{/isWithAdd}}
{{/UseList}} {{/IndexBasedListAccess}}
{{/typeIsList}} {{/typeIsList}}
{{^typeIsList}} {{^typeIsList}}
set{{entityName}}({{lastResult}}); set{{entityName}}({{lastResult}});
...@@ -61,7 +61,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam ...@@ -61,7 +61,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam
return {{internalConnectMethod}}({{connectParameterName}}, consumer); return {{internalConnectMethod}}({{connectParameterName}}, consumer);
} }
{{#typeIsList}}{{^UseList}}{{^isWithAdd}} {{#typeIsList}}{{#IndexBasedListAccess}}{{^isWithAdd}}
/** /**
* Connects the receive endpoint {{entityName}} using a "wildcard" URI (if supported by the chosen protocol). * Connects the receive endpoint {{entityName}} using a "wildcard" URI (if supported by the chosen protocol).
* @param {{connectParameterName}} string describing protocol and path as an URI * @param {{connectParameterName}} string describing protocol and path as an URI
...@@ -84,7 +84,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam ...@@ -84,7 +84,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam
}; };
return {{internalConnectMethod}}({{connectParameterName}}, consumer); return {{internalConnectMethod}}({{connectParameterName}}, consumer);
} }
{{/isWithAdd}}{{/UseList}}{{/typeIsList}} {{/isWithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}
private boolean {{parentTypeName}}.{{internalConnectMethod}}(String {{connectParameterName}}, private boolean {{parentTypeName}}.{{internalConnectMethod}}(String {{connectParameterName}},
java.util.function.BiConsumer<String, byte[]> consumer) throws java.io.IOException { java.util.function.BiConsumer<String, byte[]> consumer) throws java.io.IOException {
......
send list SenderRoot.A ; send SenderRoot.A ;
send list SenderRoot.SingleA ; send SenderRoot.SingleA ;
receive list ReceiverRoot.A ; receive ReceiverRoot.A ;
receive list ReceiverRoot.FromSingleA ; receive ReceiverRoot.FromSingleA ;
receive list with add ReceiverRoot.WithAddFromA ; receive with add ReceiverRoot.WithAddFromA ;
receive list with add ReceiverRoot.WithAddFromSingleA ; receive with add ReceiverRoot.WithAddFromSingleA ;
...@@ -18,7 +18,7 @@ SenderRoot ReceiverRoot ...@@ -18,7 +18,7 @@ SenderRoot ReceiverRoot
## Computation ## Computation
A _n_ = Input _n_ + 1, e.g., A1 = Input1 + 1 A _n_ = Input _n_ + _n_, e.g., A1 = Input1 + 1 and A3 = Input3 + 3
## Execution-Trace (SendInitialValue) ## Execution-Trace (SendInitialValue)
......
send tree SenderRoot.A1 ; send SenderRoot.A1 ;
send tree SenderRoot.A2 ; send SenderRoot.A2 ;
send tree SenderRoot.A3 ; send SenderRoot.A3 ;
send tree SenderRoot.A4 ; send SenderRoot.A4 ;
send SenderRoot.InOutput using IntToA ; send SenderRoot.InOutput using IntToA ;
receive tree ReceiverRoot.A ; receive indexed ReceiverRoot.A ;
receive tree ReceiverRoot.UsingWildcardA ; receive indexed ReceiverRoot.UsingWildcardA ;
receive tree with add ReceiverRoot.WithAddA ; receive indexed with add ReceiverRoot.WithAddA ;
receive tree with add ReceiverRoot.UsingWildcardWithAddA ; receive indexed with add ReceiverRoot.UsingWildcardWithAddA ;
IntToA maps int i to A {: IntToA maps int i to A {:
return new A().setID(i); return new A().setID(i);
......
send tree SenderRoot.T_Empty ; send SenderRoot.T_Empty ;
send tree SenderRoot.T_Token ; send SenderRoot.T_Token ;
send tree SenderRoot.T_OneChild ; send SenderRoot.T_OneChild ;
send tree SenderRoot.T_OneOpt ; send SenderRoot.T_OneOpt ;
send tree SenderRoot.T_OneList ; send SenderRoot.T_OneList ;
send tree SenderRoot.T_TwoChildren ; send SenderRoot.T_TwoChildren ;
send tree SenderRoot.T_OneOfEach ; send SenderRoot.T_OneOfEach ;
send tree SenderRoot.T_Abstract ; send SenderRoot.T_Abstract ;
receive tree ReceiverRoot.T_Empty ; receive indexed ReceiverRoot.T_Empty ;
receive tree ReceiverRoot.T_Token ; receive indexed ReceiverRoot.T_Token ;
receive tree ReceiverRoot.T_OneChild ; receive indexed ReceiverRoot.T_OneChild ;
receive tree ReceiverRoot.T_OneOpt ; receive indexed ReceiverRoot.T_OneOpt ;
receive tree ReceiverRoot.T_OneList ; receive indexed ReceiverRoot.T_OneList ;
receive tree ReceiverRoot.T_TwoChildren ; receive indexed ReceiverRoot.T_TwoChildren ;
receive tree ReceiverRoot.T_OneOfEach ; receive indexed ReceiverRoot.T_OneOfEach ;
receive tree ReceiverRoot.T_Abstract ; receive indexed ReceiverRoot.T_Abstract ;
receive tree ReceiverRoot.MyEmpty ; receive indexed ReceiverRoot.MyEmpty ;
receive tree with add ReceiverRoot.EmptyWithAdd ; receive indexed with add ReceiverRoot.EmptyWithAdd ;
receive tree with add ReceiverRoot.TokenWithAdd ; receive indexed with add ReceiverRoot.TokenWithAdd ;
receive tree with add ReceiverRoot.OneChildWithAdd ; receive indexed with add ReceiverRoot.OneChildWithAdd ;
receive tree with add ReceiverRoot.OneOptWithAdd ; receive indexed with add ReceiverRoot.OneOptWithAdd ;
receive tree with add ReceiverRoot.OneListWithAdd ; receive indexed with add ReceiverRoot.OneListWithAdd ;
receive tree with add ReceiverRoot.TwoChildrenWithAdd ; receive indexed with add ReceiverRoot.TwoChildrenWithAdd ;
receive tree with add ReceiverRoot.OneOfEachWithAdd ; receive indexed with add ReceiverRoot.OneOfEachWithAdd ;
receive tree with add ReceiverRoot.AbstractWithAdd ; receive indexed with add ReceiverRoot.AbstractWithAdd ;
send tree SenderRoot.Alfa ; send SenderRoot.Alfa ;
receive tree ReceiverRoot.Alfa ; receive ReceiverRoot.Alfa ;
send tree SenderRoot.Alfa ; send SenderRoot.Alfa ;
receive tree ReceiverRoot.Alfa ; receive ReceiverRoot.Alfa ;
receive SenderRoot.Input1WhenFlagIsTrue ; receive SenderRoot.Input1WhenFlagIsTrue ;
receive SenderRoot.Input1WhenFlagIsFalse ; receive SenderRoot.Input1WhenFlagIsFalse ;
receive SenderRoot.Input2 ; receive SenderRoot.Input2 ;
receive SenderRoot.Input3 ; receive SenderRoot.Input3 ;
send tree SenderRoot.AlfaPrimitive using Alfa2String ; send SenderRoot.AlfaPrimitive using Alfa2String ;
receive tree ReceiverRoot.AlfaPrimitive using String2Alfa ; receive ReceiverRoot.AlfaPrimitive using String2Alfa ;
Alfa2String maps Alfa alfa to String {: Alfa2String maps Alfa alfa to String {:
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment