[Mobies-commit] [commit] r3572 - GReAT/trunk/Tools/UMTInterpreters/Blockify

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Mon Nov 29 13:14:44 CST 2010


Author: ksmyth
Date: Mon Nov 29 13:14:44 2010
New Revision: 3572

Log:
Fix for Refport>NewBlock and NewBlock>Refport. Create one port in NewBlock for each port, instead of one port for each connection

Modified:
   GReAT/trunk/Tools/UMTInterpreters/Blockify/UdmApp.cpp

Modified: GReAT/trunk/Tools/UMTInterpreters/Blockify/UdmApp.cpp
==============================================================================
--- GReAT/trunk/Tools/UMTInterpreters/Blockify/UdmApp.cpp	Mon Nov 29 12:41:58 2010	(r3571)
+++ GReAT/trunk/Tools/UMTInterpreters/Blockify/UdmApp.cpp	Mon Nov 29 13:14:44 2010	(r3572)
@@ -174,65 +174,53 @@
 
 	for(set<UMLModelTransformer::In>::iterator it = inPorts.begin(); it != inPorts.end(); ++it)
 	{
-		set< UMLModelTransformer::Sequence> sequences= (*it).srcSequence();
+		UMLModelTransformer::In nIn = UMLModelTransformer::In::Create(blank);
+		nIn.position() = (*it).position();
+		nIn.name() = (*it).name();
 
+		set< UMLModelTransformer::Sequence> sequences= (*it).srcSequence();
 		//the input port had some incoming connections, so find them and re-assemble :)
+		for(set< UMLModelTransformer::Sequence>::iterator seqIt = sequences.begin(); seqIt != sequences.end(); ++seqIt)
 		{
-			for(set< UMLModelTransformer::Sequence>::iterator seqIt = sequences.begin(); seqIt != sequences.end(); ++seqIt)
+			UMLModelTransformer::ExpressionRef rpCont = seqIt->In_end__rp_helper();
+			if ((rpCont && rpCont != oold) ||
+				(!rpCont && old != oold)) {
+				continue;
+			}
+			UMLModelTransformer::Port otherOut= (*seqIt).srcSequence_end();
+			if(Uml::IsDerivedFrom( otherOut.type(), UMLModelTransformer::Out::meta))
+			{	
+				UMLModelTransformer::Out currOut= UMLModelTransformer::Out::Cast( otherOut);
+
+				/* Now do the following:
+					1. Create a new input port in blank
+					2. Connect currOut to the new input port
+					3. Connect the new input port to (*it)
+					4. Delete *seqIt
+				*/
+
+				UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
+				nSeq.Out_end__rp_helper() = seqIt->Out_end__rp_helper();
+				nSeq.srcSequence_end() = currOut;
+				nSeq.dstSequence_end() = nIn;
+				inputMap.insert(pair<UMLModelTransformer::In, UMLModelTransformer::In>(nIn, (*it)));
+			}
+			else if(Uml::IsDerivedFrom( otherOut.type(), UMLModelTransformer::In::meta)) /* Input to Input */
 			{
-				UMLModelTransformer::ExpressionRef rpCont = seqIt->In_end__rp_helper();
-				if ((rpCont && rpCont != oold) ||
-					(!rpCont && old != oold)) {
-					continue;
-				}
-				UMLModelTransformer::Port otherOut= (*seqIt).srcSequence_end();
-				if(Uml::IsDerivedFrom( otherOut.type(), UMLModelTransformer::Out::meta))
-				{	
-					UMLModelTransformer::Out currOut= UMLModelTransformer::Out::Cast( otherOut);
-
-					/* Now do the following:
-					   1. Create a new input port in blank
-					   2. Connect currOut to the new input port
-					   3. Connect the new input port to (*it)
-					   4. Delete *seqIt
-					*/
-
-					UMLModelTransformer::In nIn = UMLModelTransformer::In::Create(blank);
-					nIn.position() = (*it).position();
-					nIn.name() = (*it).name();
-					UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
-					nSeq.srcSequence_end() = currOut;
-					nSeq.dstSequence_end() = nIn;
-					nSeq.Out_end__rp_helper() = seqIt->Out_end__rp_helper();
-					if (oold.type() == UMLModelTransformer::ExpressionRef::meta) {
-						nSeq.In_end__rp_helper() = UMLModelTransformer::ExpressionRef::Cast(oold);
-					}
-					inputMap.insert(pair<UMLModelTransformer::In, UMLModelTransformer::In>(nIn, (*it)));
-				}
-				else if(Uml::IsDerivedFrom( otherOut.type(), UMLModelTransformer::In::meta)) /* Input to Input */
-				{
-					UMLModelTransformer::In currOut= UMLModelTransformer::In::Cast( otherOut);
-
-					/* Now do the following:
-					   1. Create a new input port in blank
-					   2. Connect currOut to the new input port
-					   3. Connect the new input port to (*it)
-					   4. Delete *seqIt
-					*/
-
-					UMLModelTransformer::In nIn = UMLModelTransformer::In::Create(blank);
-					nIn.position() = (*it).position();
-					nIn.name() = (*it).name();
-					UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
-					nSeq.srcSequence_end() = currOut;
-					nSeq.dstSequence_end() = nIn;
-					nSeq.Out_end__rp_helper() = seqIt->Out_end__rp_helper();
-					if (oold.type() == UMLModelTransformer::ExpressionRef::meta) {
-						nSeq.In_end__rp_helper() = UMLModelTransformer::ExpressionRef::Cast(oold);
-					}
-					inputMap.insert(pair<UMLModelTransformer::In, UMLModelTransformer::In>(nIn, (*it)));
-				}
+				UMLModelTransformer::In currOut= UMLModelTransformer::In::Cast( otherOut);
 
+				/* Now do the following:
+					1. Create a new input port in blank
+					2. Connect currOut to the new input port
+					3. Connect the new input port to (*it)
+					4. Delete *seqIt
+				*/
+
+				UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
+				nSeq.Out_end__rp_helper() = seqIt->Out_end__rp_helper();
+				nSeq.srcSequence_end() = currOut;
+				nSeq.dstSequence_end() = nIn;
+				inputMap.insert(pair<UMLModelTransformer::In, UMLModelTransformer::In>(nIn, (*it)));
 			}
 		}
 	}
@@ -245,66 +233,54 @@
 
 	for(set<UMLModelTransformer::Out>::iterator it = outPorts.begin(); it != outPorts.end(); ++it)
 	{
-		set< UMLModelTransformer::Sequence> sequences= (*it).dstSequence();
+		UMLModelTransformer::Out nOut = UMLModelTransformer::Out::Create(blank);
+		nOut.position() = (*it).position();
+		nOut.name() = (*it).name();
 
-		//the input port had some incoming connections, so find them and re-assemble :)
+		set< UMLModelTransformer::Sequence> sequences= (*it).dstSequence();
+		//the output port had some outgoing connections, so find them and re-assemble
+		for(set< UMLModelTransformer::Sequence>::iterator seqIt = sequences.begin(); seqIt != sequences.end(); ++seqIt)
 		{
-			for(set< UMLModelTransformer::Sequence>::iterator seqIt = sequences.begin(); seqIt != sequences.end(); ++seqIt)
+			UMLModelTransformer::ExpressionRef rpCont = seqIt->Out_end__rp_helper();
+			if ((rpCont && rpCont != oold) ||
+				(!rpCont && old != oold)) {
+				continue;
+			}
+			UMLModelTransformer::Port otherIn= (*seqIt).dstSequence_end();
+			if(Uml::IsDerivedFrom( otherIn.type(), UMLModelTransformer::In::meta))
 			{
-				UMLModelTransformer::ExpressionRef rpCont = seqIt->Out_end__rp_helper();
-				if ((rpCont && rpCont != oold) ||
-					(!rpCont && old != oold)) {
-					continue;
-				}
-				UMLModelTransformer::Port otherIn= (*seqIt).dstSequence_end();
-				if(Uml::IsDerivedFrom( otherIn.type(), UMLModelTransformer::In::meta))
-				{
-					UMLModelTransformer::In currIn= UMLModelTransformer::In::Cast( otherIn);
-
-					/* Now do the following:
-					   1. Create a new output port in blank
-					   2. Connect currOut to the new input port
-					   3. Connect the new input port to (*it)
-					   4. Delete *seqIt
-					*/
-
-					UMLModelTransformer::Out nOut = UMLModelTransformer::Out::Create(blank);
-					UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
-					nOut.position() = (*it).position();
-					nOut.name() = (*it).name();
-					nSeq.srcSequence_end() = nOut;
-					nSeq.dstSequence_end() = currIn;
-					nSeq.In_end__rp_helper() = seqIt->In_end__rp_helper();
-					if (oold.type() == UMLModelTransformer::ExpressionRef::meta) {
-						nSeq.Out_end__rp_helper() = UMLModelTransformer::ExpressionRef::Cast(oold);
-					}
-					outputMap.insert(pair<UMLModelTransformer::Out, UMLModelTransformer::Out>(*it, nOut));
-				}
-
-				else if(Uml::IsDerivedFrom( otherIn.type(), UMLModelTransformer::Out::meta))
-				{
-					UMLModelTransformer::Out currIn= UMLModelTransformer::Out::Cast( otherIn);
-
-					/* Now do the following:
-					   1. Create a new output port in blank
-					   2. Connect currOut to the new input port
-					   3. Connect the new input port to (*it)
-					   4. Delete *seqIt
-					*/
-
-					UMLModelTransformer::Out nOut = UMLModelTransformer::Out::Create(blank);
-					UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
-					nOut.position() = (*it).position();
-					nOut.name() = (*it).name();
-					nSeq.srcSequence_end() = nOut;
-					nSeq.dstSequence_end() = currIn;
-					nSeq.In_end__rp_helper() = seqIt->In_end__rp_helper();
-					if (oold.type() == UMLModelTransformer::ExpressionRef::meta) {
-						nSeq.Out_end__rp_helper() = UMLModelTransformer::ExpressionRef::Cast(oold);
-					}
-					outputMap.insert(pair<UMLModelTransformer::Out, UMLModelTransformer::Out>(*it, nOut));
-				}
+				UMLModelTransformer::In currIn= UMLModelTransformer::In::Cast( otherIn);
+
+				/* Now do the following:
+					1. Create a new output port in blank
+					2. Connect currOut to the new input port
+					3. Connect the new input port to (*it)
+					4. Delete *seqIt
+				*/
+
+				UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
+				nSeq.srcSequence_end() = nOut;
+				nSeq.In_end__rp_helper() = seqIt->In_end__rp_helper();
+				nSeq.dstSequence_end() = currIn;
+				outputMap.insert(pair<UMLModelTransformer::Out, UMLModelTransformer::Out>(*it, nOut));
+			}
+
+			else if(Uml::IsDerivedFrom( otherIn.type(), UMLModelTransformer::Out::meta))
+			{
+				UMLModelTransformer::Out currIn= UMLModelTransformer::Out::Cast( otherIn);
 
+				/* Now do the following:
+					1. Create a new output port in blank
+					2. Connect currOut to the new input port
+					3. Connect the new input port to (*it)
+					4. Delete *seqIt
+				*/
+
+				UMLModelTransformer::Sequence nSeq = UMLModelTransformer::Sequence::Create(focusObj);
+				nSeq.srcSequence_end() = nOut;
+				nSeq.In_end__rp_helper() = seqIt->In_end__rp_helper();
+				nSeq.dstSequence_end() = currIn;
+				outputMap.insert(pair<UMLModelTransformer::Out, UMLModelTransformer::Out>(*it, nOut));
 			}
 		}
 


More information about the Mobies-commit mailing list