Browse Source

removeOutBindings

Cláudio Gomes 3 years ago
parent
commit
ca653f8cb4

+ 7 - 0
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/src/be/uantwerpen/ansymo/semanticadaptation/tests/SemanticAdaptationGeneratorTest.xtend

@@ -125,6 +125,13 @@ class SemanticAdaptationGeneratorTest extends AbstractSemanticAdaptationTest{
 			}
 		}) }
 	
+	@Test def test_removeOutBindings_sample1() { __generate('input/canonical_generation/sample1.sa', new IAcceptor<CompilationTestHelper.Result>(){
+			override accept(Result t) {
+				var Adaptation sa = t.resourceSet.resources.head.allContents.toIterable.filter(SemanticAdaptation).last.elements.filter(Adaptation).head
+				sa.outports.forall[p | p.sourcedependency === null]
+			}
+		}) }
+	
 	@Test def test_addOutParams_sample1() { __generate('input/canonical_generation/sample1.sa', new IAcceptor<CompilationTestHelper.Result>(){
 			override accept(Result t) {
 				var Adaptation sa = t.resourceSet.resources.head.allContents.toIterable.filter(SemanticAdaptation).last.elements.filter(Adaptation).head

+ 7 - 4
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation/src/be/uantwerpen/ansymo/semanticadaptation/generator/SemanticAdaptationCanonicalGenerator.xtend

@@ -234,7 +234,7 @@ class SemanticAdaptationCanonicalGenerator extends AbstractGenerator {
 		
 		addInRules_External2Internal_Assignments(sa, internalPort2ExternalPortBindings)
 		
-		removeInBindings(internalPort2ExternalPortBindings, sa)
+		removeBindings(internalPort2ExternalPortBindings, sa)
 		
 		addOutPorts(sa)
 		
@@ -248,6 +248,7 @@ class SemanticAdaptationCanonicalGenerator extends AbstractGenerator {
 		
 		addOutRules_Internal2External_Assignments(sa, internalOutputPort2ExternalPortBindings)
 		
+		removeBindings(internalOutputPort2ExternalPortBindings, sa)
 		
 		
 		Log.pop("Canonicalize")
@@ -278,16 +279,18 @@ class SemanticAdaptationCanonicalGenerator extends AbstractGenerator {
 		return port.name
 	}
 	
-	def removeInBindings(HashMap<Port, Port> internalPort2ExternalPortBindings, Adaptation sa) {
-		Log.push("removeInBindings")
+	def removeBindings(HashMap<Port, Port> internalPort2ExternalPortBindings, Adaptation sa) {
+		Log.push("removeBindings")
 		
 		for (internalPort : internalPort2ExternalPortBindings.keySet){
 			val externalPort = internalPort2ExternalPortBindings.get(internalPort)
 			Log.println("Removing binding " + externalPort.qualifiedName + "->" + internalPort.qualifiedName)
 			externalPort.targetdependency = null
+			Log.println("Removing binding " + externalPort.qualifiedName + "<-" + internalPort.qualifiedName)
+			externalPort.sourcedependency = null
 		}
 		
-		Log.pop("removeInBindings")
+		Log.pop("removeBindings")
 	}
 	
 	def findAllExternalPort2InputPort_Bindings(Adaptation sa) {