[archstudio-commits] svn commit: r7063 - /archstudio4/trunk/edu.uci.isr.archstudio4.comp.xarchcs/src/edu/uci/isr/archstudio4/comp/xarchcs/views/changesets/conversion/CSConverter.java

archstudio-commits-owner at uci.edu archstudio-commits-owner at uci.edu
Thu May 1 23:01:09 PDT 2008


Author: shendric
Date: Thu May  1 23:01:09 2008
New Revision: 7063

Log:
Some more progress on PLA to CS converter (still no variants)

Modified:
    archstudio4/trunk/edu.uci.isr.archstudio4.comp.xarchcs/src/edu/uci/isr/=
archstudio4/comp/xarchcs/views/changesets/conversion/CSConverter.java

Modified: archstudio4/trunk/edu.uci.isr.archstudio4.comp.xarchcs/src/edu/uc=
i/isr/archstudio4/comp/xarchcs/views/changesets/conversion/CSConverter.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/trunk/edu.uci.isr.archstudio4.comp.xarchcs/src/edu/uci/isr/=
archstudio4/comp/xarchcs/views/changesets/conversion/CSConverter.java (orig=
inal)
+++ archstudio4/trunk/edu.uci.isr.archstudio4.comp.xarchcs/src/edu/uci/isr/=
archstudio4/comp/xarchcs/views/changesets/conversion/CSConverter.java Thu M=
ay  1 23:01:09 2008
@@ -3,8 +3,10 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 =

 import edu.uci.isr.archstudio4.comp.xarchcs.xarchcs.XArchChangeSetInterfac=
e;
 import edu.uci.isr.sysutils.UIDGenerator;
@@ -85,7 +87,7 @@
 		return currentCSRef;
 	}
 =

-	private static void copyToCS(XArchChangeSetInterface xarch, ObjRef plaXAr=
chRef, ObjRef csXArchRef, Map<String, ObjRef> guardsToChangeSetRefs, ObjRef=
 toCSRef, ObjRef srcRef, ObjRef destRef){
+	private static void copyToCS(XArchChangeSetInterface xarch, ObjRef plaXAr=
chRef, ObjRef csXArchRef, Map<String, ObjRef> guardsToChangeSetRefs, Set<Ob=
jRef> variantTypeRefs, ObjRef toCSRef, ObjRef srcRef, ObjRef destRef){
 =

 		IXArchTypeMetadata srcType =3D xarch.getTypeMetadata(srcRef);
 =

@@ -98,11 +100,14 @@
 			case IXArchPropertyMetadata.ELEMENT: {
 				ObjRef childSrcRef =3D (ObjRef)xarch.get(srcRef, property.getName());
 				if(childSrcRef !=3D null){
+					if(xarch.isInstanceOf(childSrcRef, "options#Optional")){
+						continue;
+					}
 					ObjRef childToCSRef =3D selectChangeSetForGuard(xarch, csXArchRef, gu=
ardsToChangeSetRefs, toCSRef, childSrcRef);
 					xarch.setActiveChangeSetRef(csXArchRef, childToCSRef);
 					ObjRef childDestRef =3D cloneTypeAndAttributes(xarch, csXArchRef, chi=
ldSrcRef);
 					xarch.set(destRef, property.getName(), childDestRef);
-					copyToCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSetRefs, child=
ToCSRef, childSrcRef, childDestRef);
+					copyToCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSetRefs, varia=
ntTypeRefs, childToCSRef, childSrcRef, childDestRef);
 				}
 			}
 				break;
@@ -110,16 +115,19 @@
 			case IXArchPropertyMetadata.ELEMENT_MANY: {
 				for(ObjRef childSrcRef: xarch.getAll(srcRef, property.getName())){
 					if(xarch.isInstanceOf(childSrcRef, "variants#VariantComponentType")){
-						continue;
+						variantTypeRefs.add(childSrcRef);
 					}
-					if(xarch.isInstanceOf(childSrcRef, "variants#VariantComponentType")){
+					if(xarch.isInstanceOf(childSrcRef, "variants#VariantConnectorType")){
+						variantTypeRefs.add(childSrcRef);
+					}
+					if(xarch.isInstanceOf(childSrcRef, "variants#Variant")){
 						continue;
 					}
 					ObjRef childToCSRef =3D selectChangeSetForGuard(xarch, csXArchRef, gu=
ardsToChangeSetRefs, toCSRef, childSrcRef);
 					xarch.setActiveChangeSetRef(csXArchRef, childToCSRef);
 					ObjRef childDestRef =3D cloneTypeAndAttributes(xarch, csXArchRef, chi=
ldSrcRef);
 					xarch.add(destRef, property.getName(), childDestRef);
-					copyToCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSetRefs, child=
ToCSRef, childSrcRef, childDestRef);
+					copyToCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSetRefs, varia=
ntTypeRefs, childToCSRef, childSrcRef, childDestRef);
 				}
 			}
 				break;
@@ -127,6 +135,16 @@
 		}
 	}
 =

+	private static void variantsToInstancesInCS(XArchChangeSetInterface xarch=
, ObjRef plaXArchRef, ObjRef csXArchRef, Map<String, ObjRef> guardsToChange=
SetRefs, Set<ObjRef> variantTypeRefs, ObjRef baselineChangeSetRef, ObjRef p=
laXArchRef2, ObjRef csXArchRef2){
+		for(ObjRef variantTypeRef: variantTypeRefs){
+			for(ObjRef variantInstanceRef: xarch.getReferences(plaXArchRef, (String=
)xarch.get(variantTypeRef, "id"))){
+				if(xarch.getXArchPath(variantInstanceRef).toTagsOnlyString().startsWit=
h("xArch/archStructure")){
+
+				}
+			}
+		}
+	}
+
 	public static void convertPLAtoCS(XArchChangeSetInterface xarch, ObjRef p=
laXArchRef, ObjRef csXArchRef){
 		xarch.enableChangeSets(csXArchRef, null);
 		ObjRef changesetsContextRef =3D xarch.createContext(csXArchRef, "changes=
ets");
@@ -134,8 +152,10 @@
 		ObjRef baselineChangeSetRef =3D xarch.getAll(archChangeSetsRef, "ChangeS=
et")[0];
 =

 		Map<String, ObjRef> guardsToChangeSetRefs =3D new HashMap<String, ObjRef=
>();
+		Set<ObjRef> variantTypeRefs =3D new HashSet<ObjRef>();
 		guardsToChangeSetRefs.put(null, baselineChangeSetRef);
 =

-		copyToCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSetRefs, baseline=
ChangeSetRef, plaXArchRef, csXArchRef);
+		copyToCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSetRefs, variantT=
ypeRefs, baselineChangeSetRef, plaXArchRef, csXArchRef);
+		variantsToInstancesInCS(xarch, plaXArchRef, csXArchRef, guardsToChangeSe=
tRefs, variantTypeRefs, baselineChangeSetRef, plaXArchRef, csXArchRef);
 	}
 }




More information about the archstudio-commits mailing list