[archstudio-commits] svn commit: r7054 - in /archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/comp/archipelago: types/ util/

archstudio-commits-owner at uci.edu archstudio-commits-owner at uci.edu
Thu May 1 08:17:03 PDT 2008


Author: shendric
Date: Thu May  1 08:17:02 2008
New Revision: 7054

Log:
Fixed: old hints were not being restored

Modified:
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/types/StructureEditorSupport.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/types/StructureFileManagerListener.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/ArrayPropertyCoder.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/BasicPropertyCoder.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/BasicSWTPropertyCoder.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/EnumPropertyCoder.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/HintSupport.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/IPropertyCoder.java
    archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/PropertyDecodeException.java

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/types/StructureEditorSupport.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/types/StructureEditorSupport.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/types/StructureEditorSupport.java Thu May  1 08:17:02 2008
@@ -4,7 +4,6 @@
 import java.util.Arrays;
 import java.util.List;
 =

-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.DisposeEvent;
 import org.eclipse.swt.events.DisposeListener;
@@ -78,7 +77,6 @@
 import edu.uci.isr.bna4.logics.events.DragMoveEventsLogic;
 import edu.uci.isr.bna4.logics.events.InternalWorldEventsLogic;
 import edu.uci.isr.bna4.logics.events.WorldThingExternalEventsLogic;
-import edu.uci.isr.bna4.logics.hints.SynchronizeHintsLogic;
 import edu.uci.isr.bna4.logics.information.ToolTipLogic;
 import edu.uci.isr.bna4.logics.navigating.FindDialogLogic;
 import edu.uci.isr.bna4.logics.navigating.MousePanningLogic;
@@ -183,7 +181,7 @@
 		return bnaWorld;
 	}
 =

-	static void setupWorld(ArchipelagoServices AS, final ObjRef xArchRef, fin=
al IBNAWorld bnaWorld, ObjRef diagramInputRef){
+	static void setupWorld(final ArchipelagoServices AS, final ObjRef xArchRe=
f, final IBNAWorld bnaWorld, final ObjRef diagramInputRef){
 		IThingLogicManager logicManager =3D bnaWorld.getThingLogicManager();
 =

 		String format;
@@ -227,12 +225,20 @@
 		if(DEBUG){
 			lTime =3D System.nanoTime();
 		}
+		readHints(AS, xArchRef, bnaWorld.getBNAModel(), diagramInputRef);
+		if(DEBUG){
+			lTime =3D System.nanoTime() - lTime;
+			System.err.printf(format, "Old hints", lTime);
+		}
+		if(DEBUG){
+			lTime =3D System.nanoTime();
+		}
 		XAdlHintRepository hr =3D new XAdlHintRepository(AS.xarch, diagramInputR=
ef, "edu.uci.isr.archstudio4.comp.archipelago", "4.1.0", tptl);
 		if(DEBUG){
 			lTime =3D System.nanoTime() - lTime;
 			System.err.printf(format, "Hint repository", lTime);
 		}
-		logicManager.addThingLogic(new SynchronizeHintsLogic(hr));
+		//logicManager.addThingLogic(new SynchronizeHintsLogic(hr));
 =

 		// maintenance logics
 		logicManager.addThingLogic(new MoveWithLogic(rtl));
@@ -365,41 +371,4 @@
 			}
 		}
 	}
-
-	@Deprecated
-	public static void writeHints(ArchipelagoServices AS, ObjRef xArchRef, IP=
rogressMonitor monitor){
-		//ObjRef typesContextRef =3D AS.xarch.createContext(xArchRef, "types");
-		//
-		//ObjRef[] archStructureRefs =3D AS.xarch.getAllElements(typesContextRef=
, "archStructure", xArchRef);
-		//if(archStructureRefs.length > 0){
-		//	ObjRef hintsContextRef =3D AS.xarch.createContext(xArchRef, "hints3");
-		//	ObjRef bundleRef =3D HintSupport.getArchipelagoHintsBundleRef(AS, xAr=
chRef);
-		//	AS.xarch.set(bundleRef, "type", "XML");
-		//	for(int i =3D 0; i < archStructureRefs.length; i++){
-		//		String archStructureDescription =3D XadlUtils.getDescription(AS.xarc=
h, archStructureRefs[i]);
-		//		if(archStructureDescription =3D=3D null)
-		//			archStructureDescription =3D "Structure";
-		//		monitor.setTaskName("Storing Hints for " + archStructureDescription);
-		//
-		//		// Find the model for this structure, if there isn't one we do nothi=
ng.
-		//		// If there were already hints in the model, they'll be left alone
-		//		// since they were never loaded out. If there are new hints,
-		//		// they will overwrite the ones in the xADL model
-		//		IBNAWorld world =3D (IBNAWorld)AS.treeNodeDataCache.getData(xArchRef=
, archStructureRefs[i], BNA_WORLD_KEY);
-		//		if(world !=3D null){
-		//			IBNAModel model =3D world.getBNAModel();
-		//			if(model !=3D null){
-		//				// We have new hints for this structure
-		//				// Remove the old set of hints for this structure, if they exist
-		//				ObjRef hintedElementRef =3D HintSupport.findChildHintedElementRef(=
AS, xArchRef, bundleRef, archStructureRefs[i]);
-		//				if(hintedElementRef !=3D null){
-		//					AS.xarch.remove(bundleRef, "hintedElement", hintedElementRef);
-		//				}
-		//				StructureHintSupport.writeHintsForStructure(AS, xArchRef, bundleRe=
f, model, archStructureRefs[i]);
-		//			}
-		//		}
-		//	}
-		//	// AS.xarch.cleanup(xArchRef);
-		//}
-	}
 }

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/types/StructureFileManagerListener.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/types/StructureFileManagerListener.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/types/StructureFileManagerListener.java Thu May  1 08:17:02=
 2008
@@ -6,22 +6,24 @@
 import edu.uci.isr.archstudio4.comp.fileman.IFileManagerListener;
 import edu.uci.isr.xarchflat.ObjRef;
 =

-public class StructureFileManagerListener implements IFileManagerListener{
+public class StructureFileManagerListener
+    implements IFileManagerListener{
+
 	protected ArchipelagoServices AS =3D null;
 	protected ObjRef xArchRef =3D null;
-	=

+
 	public StructureFileManagerListener(ArchipelagoServices services, ObjRef =
xArchRef){
 		this.AS =3D services;
 		this.xArchRef =3D xArchRef;
 	}
-	=

+
 	public void fileDirtyStateChanged(ObjRef xArchRef, boolean dirty){
 	}
-	=

+
 	public void fileSaving(final ObjRef xArchRef, final IProgressMonitor moni=
tor){
 		if(xArchRef.equals(this.xArchRef)){
 			monitor.subTask("Writing Hints");
-			StructureEditorSupport.writeHints(AS, xArchRef, monitor);
+			//StructureEditorSupport.writeHints(AS, xArchRef, monitor);
 		}
 	}
 }

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/ArrayPropertyCoder.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/ArrayPropertyCoder.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/ArrayPropertyCoder.java Thu May  1 08:17:02 2008
@@ -6,18 +6,20 @@
 import edu.uci.isr.archstudio4.comp.archipelago.ArchipelagoUtils;
 import edu.uci.isr.xarchflat.ObjRef;
 =

-public class ArrayPropertyCoder implements IPropertyCoder{
+ at Deprecated
+public class ArrayPropertyCoder
+    implements IPropertyCoder{
 =

 	public boolean encode(IPropertyCoder masterCoder, ArchipelagoServices AS,=
 ObjRef xArchRef, ObjRef propertyValueRef, Object propertyValue){
 		Class c =3D propertyValue.getClass();
 		if(c.isArray()){
 			AS.xarch.set(propertyValueRef, "type", ArchipelagoUtils.getClassName(c)=
);
-			=

+
 			ObjRef hintsContextRef =3D AS.xarch.createContext(xArchRef, "hints3");
 			Object[] arr =3D (Object[])propertyValue;
-			for(int i =3D 0; i < arr.length; i++){
-				ObjRef childValueRef =3D (ObjRef)AS.xarch.create(hintsContextRef, "pro=
pertyValue");
-				if(masterCoder.encode(masterCoder, AS, xArchRef, childValueRef, arr[i]=
)){
+			for(Object element: arr){
+				ObjRef childValueRef =3D AS.xarch.create(hintsContextRef, "propertyVal=
ue");
+				if(masterCoder.encode(masterCoder, AS, xArchRef, childValueRef, elemen=
t)){
 					AS.xarch.add(propertyValueRef, "value", childValueRef);
 				}
 			}
@@ -33,7 +35,7 @@
 		}
 		if(propertyType.endsWith("[]")){
 			String innerPropertyType =3D propertyType.substring(0, propertyType.len=
gth() - 2);
-			=

+
 			ObjRef[] refs =3D AS.xarch.getAll(propertyValueRef, "value");
 			try{
 				Class cc =3D HintSupport.getInstance().classForName(getRealClassName(i=
nnerPropertyType));
@@ -49,7 +51,7 @@
 		}
 		return null;
 	}
-	=

+
 	private static String getRealClassName(String name){
 		if(name.endsWith("[]")){
 			String internalName =3D getRealClassName(name.substring(0, name.length(=
) - 2));
@@ -60,8 +62,9 @@
 				return "[L" + getRealClassName(name.substring(0, name.length() - 2)) +=
 ";";
 			}
 		}
-		else return name;
+		else{
+			return name;
+		}
 	}
 =

-
 }

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/BasicPropertyCoder.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/BasicPropertyCoder.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/BasicPropertyCoder.java Thu May  1 08:17:02 2008
@@ -3,7 +3,9 @@
 import edu.uci.isr.archstudio4.comp.archipelago.ArchipelagoServices;
 import edu.uci.isr.xarchflat.ObjRef;
 =

-public class BasicPropertyCoder implements IPropertyCoder{
+ at Deprecated
+public class BasicPropertyCoder
+    implements IPropertyCoder{
 =

 	public boolean encode(IPropertyCoder masterCoder, ArchipelagoServices AS,=
 ObjRef xArchRef, ObjRef propertyValueRef, Object propertyValue){
 		if(propertyValue instanceof java.lang.String){
@@ -59,12 +61,12 @@
 		if(propertyType =3D=3D null){
 			return null;
 		}
-		=

+
 		String data =3D (String)AS.xarch.get(propertyValueRef, "data");
 		if(data =3D=3D null){
 			return null;
 		}
-		=

+
 		try{
 			if(propertyType.equals("java.lang.String")){
 				return data;

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/BasicSWTPropertyCoder.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/BasicSWTPropertyCoder.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/BasicSWTPropertyCoder.java Thu May  1 08:17:02 2008
@@ -7,7 +7,9 @@
 import edu.uci.isr.archstudio4.comp.archipelago.ArchipelagoServices;
 import edu.uci.isr.xarchflat.ObjRef;
 =

-public class BasicSWTPropertyCoder implements IPropertyCoder{
+ at Deprecated
+public class BasicSWTPropertyCoder
+    implements IPropertyCoder{
 =

 	public boolean encode(IPropertyCoder masterCoder, ArchipelagoServices AS,=
 ObjRef xArchRef, ObjRef propertyValueRef, Object propertyValue){
 		if(propertyValue instanceof Point){
@@ -27,25 +29,25 @@
 		}
 		return false;
 	}
-	=

+
 	public Object decode(IPropertyCoder masterCoder, ArchipelagoServices AS, =
ObjRef xArchRef, ObjRef propertyValueRef) throws PropertyDecodeException{
 		String propertyType =3D (String)AS.xarch.get(propertyValueRef, "type");
 		if(propertyType =3D=3D null){
 			return null;
 		}
-		=

+
 		String data =3D (String)AS.xarch.get(propertyValueRef, "data");
 		if(data =3D=3D null){
 			return null;
 		}
-		=

+
 		if(propertyType.equals(Rectangle.class.getName())){
 			try{
 				String[] ss =3D data.split(",");
 				if(ss.length !=3D 4){
 					throw new PropertyDecodeException("Can't decode rectangle: " + data);
 				}
-				Rectangle r =3D new Rectangle(0,0,0,0);
+				Rectangle r =3D new Rectangle(0, 0, 0, 0);
 				r.x =3D Integer.parseInt(ss[0]);
 				r.y =3D Integer.parseInt(ss[1]);
 				r.width =3D Integer.parseInt(ss[2]);
@@ -62,7 +64,7 @@
 				if(ss.length !=3D 2){
 					throw new PropertyDecodeException("Can't decode point: " + data);
 				}
-				Point p =3D new Point(0,0);
+				Point p =3D new Point(0, 0);
 				p.x =3D Integer.parseInt(ss[0]);
 				p.y =3D Integer.parseInt(ss[1]);
 				return p;
@@ -77,7 +79,7 @@
 				if(ss.length !=3D 3){
 					throw new PropertyDecodeException("Can't decode RGB: " + data);
 				}
-				RGB rgb =3D new RGB(0,0,0);
+				RGB rgb =3D new RGB(0, 0, 0);
 				rgb.red =3D Integer.parseInt(ss[0]);
 				rgb.green =3D Integer.parseInt(ss[1]);
 				rgb.blue =3D Integer.parseInt(ss[2]);

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/EnumPropertyCoder.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/EnumPropertyCoder.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/EnumPropertyCoder.java Thu May  1 08:17:02 2008
@@ -4,7 +4,9 @@
 import edu.uci.isr.archstudio4.comp.archipelago.ArchipelagoUtils;
 import edu.uci.isr.xarchflat.ObjRef;
 =

-public class EnumPropertyCoder implements IPropertyCoder{
+ at Deprecated
+public class EnumPropertyCoder
+    implements IPropertyCoder{
 =

 	public boolean encode(IPropertyCoder masterCoder, ArchipelagoServices AS,=
 ObjRef xArchRef, ObjRef propertyValueRef, Object propertyValue){
 		Class c =3D propertyValue.getClass();
@@ -24,7 +26,7 @@
 		}
 		if(propertyType.endsWith("[E]")){
 			String innerPropertyType =3D propertyType.substring(0, propertyType.len=
gth() - 3);
-			=

+
 			String data =3D (String)AS.xarch.get(propertyValueRef, "data");
 			if(data !=3D null){
 				try{

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/HintSupport.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/HintSupport.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/HintSupport.java Thu May  1 08:17:02 2008
@@ -7,12 +7,15 @@
 import edu.uci.isr.xadlutils.XadlUtils;
 import edu.uci.isr.xarchflat.ObjRef;
 =

-public class HintSupport implements IPropertyCoder{
-	=

+ at Deprecated
+public class HintSupport
+    implements IPropertyCoder{
+
 	protected static HintSupport __instance =3D null;
-	=

-	protected HintSupport(){}
-	=

+
+	protected HintSupport(){
+	}
+
 	public void writeTarget(ArchipelagoServices AS, ObjRef xArchRef, ObjRef e=
ltRef, ObjRef targetRef){
 		if(targetRef !=3D null){
 			String targetID =3D XadlUtils.getID(AS.xarch, targetRef);
@@ -21,10 +24,12 @@
 			}
 		}
 	}
-	=

+
 	public void writeProperty(ArchipelagoServices AS, ObjRef xArchRef, ObjRef=
 eltRef, String name, Object value){
-		if(value =3D=3D null) return;
-		=

+		if(value =3D=3D null){
+			return;
+		}
+
 		ObjRef hintsContextRef =3D AS.xarch.createContext(xArchRef, "hints3");
 		ObjRef propertyRef =3D AS.xarch.create(hintsContextRef, "property");
 =

@@ -42,13 +47,13 @@
 		}
 		return null;
 	}
-	=

+
 	public Object readProperty(ArchipelagoServices AS, ObjRef xArchRef, ObjRe=
f eltRef, String name){
 		ObjRef[] propertyRefs =3D AS.xarch.getAll(eltRef, "property");
-		for(int i =3D 0; i < propertyRefs.length; i++){
-			String n =3D (String)AS.xarch.get(propertyRefs[i], "name");
-			if((n !=3D null) && (n.equals(name))){
-				ObjRef propertyValueRef =3D (ObjRef)AS.xarch.get(propertyRefs[i], "val=
ue");
+		for(ObjRef propertyRef: propertyRefs){
+			String n =3D (String)AS.xarch.get(propertyRef, "name");
+			if(n !=3D null && n.equals(name)){
+				ObjRef propertyValueRef =3D (ObjRef)AS.xarch.get(propertyRef, "value");
 				try{
 					Object o =3D decode(this, AS, xArchRef, propertyValueRef);
 					return o;
@@ -59,14 +64,14 @@
 		}
 		return null;
 	}
-	=

+
 	public Class classForName(String name) throws ClassNotFoundException{
 		try{
 			Class c =3D Class.forName(name);
 			return c;
 		}
 		catch(ClassNotFoundException cnfe){
-			for(ClassLoader cl : classLoaders){
+			for(ClassLoader cl: classLoaders){
 				try{
 					Class c =3D Class.forName(name, true, cl);
 					return c;
@@ -74,7 +79,7 @@
 				catch(ClassNotFoundException cnfe2){
 				}
 			}
-			for(IPropertyCoder pc : propertyCoders){
+			for(IPropertyCoder pc: propertyCoders){
 				try{
 					Class c =3D Class.forName(name, true, pc.getClass().getClassLoader());
 					return c;
@@ -85,44 +90,44 @@
 			throw cnfe;
 		}
 	}
-	=

+
 	protected Set<ClassLoader> classLoaderSet =3D new HashSet<ClassLoader>();
 	protected ClassLoader[] classLoaders =3D new ClassLoader[0];
-	=

+
 	public void registerClassLoader(ClassLoader cl){
 		classLoaderSet.add(cl);
 		classLoaders =3D classLoaderSet.toArray(new ClassLoader[classLoaderSet.s=
ize()]);
 	}
-	=

+
 	public void unregisterClassloader(ClassLoader cl){
 		classLoaderSet.remove(cl);
 		classLoaders =3D classLoaderSet.toArray(new ClassLoader[classLoaderSet.s=
ize()]);
 	}
-	=

+
 	protected Set<IPropertyCoder> propertyCoderSet =3D new HashSet<IPropertyC=
oder>();
 	protected IPropertyCoder[] propertyCoders =3D new IPropertyCoder[0];
-	=

+
 	public void registerPropertyCoder(IPropertyCoder coder){
 		propertyCoderSet.add(coder);
 		propertyCoders =3D propertyCoderSet.toArray(new IPropertyCoder[propertyC=
oderSet.size()]);
 	}
-	=

+
 	public void unregisterPropertyCoder(IPropertyCoder coder){
 		propertyCoderSet.remove(coder);
 		propertyCoders =3D propertyCoderSet.toArray(new IPropertyCoder[propertyC=
oderSet.size()]);
 	}
-	=

+
 	public boolean encode(IPropertyCoder masterCoder, ArchipelagoServices AS,=
 ObjRef xArchRef, ObjRef propertyValueRef, Object propertyValue){
-		for(IPropertyCoder pc : propertyCoders){
+		for(IPropertyCoder pc: propertyCoders){
 			if(pc.encode(this, AS, xArchRef, propertyValueRef, propertyValue)){
 				return true;
 			}
 		}
 		return false;
 	}
-	=

+
 	public Object decode(IPropertyCoder masterCoder, ArchipelagoServices AS, =
ObjRef xArchRef, ObjRef propertyValueRef) throws PropertyDecodeException{
-		for(IPropertyCoder pc : propertyCoders){
+		for(IPropertyCoder pc: propertyCoders){
 			Object o =3D pc.decode(this, AS, xArchRef, propertyValueRef);
 			if(o !=3D null){
 				return o;
@@ -130,7 +135,7 @@
 		}
 		return null;
 	}
-	=

+
 	public static HintSupport getInstance(){
 		if(__instance =3D=3D null){
 			__instance =3D new HintSupport();
@@ -141,7 +146,7 @@
 		}
 		return __instance;
 	}
-	=

+
 	public static ObjRef getHintsRootRef(ArchipelagoServices AS, ObjRef xArch=
Ref){
 		ObjRef hintsContextRef =3D AS.xarch.createContext(xArchRef, "hints3");
 		ObjRef rootRef =3D AS.xarch.getElement(hintsContextRef, "renderingHints3=
", xArchRef);
@@ -152,18 +157,18 @@
 		AS.xarch.add(xArchRef, "Object", rootRef);
 		return rootRef;
 	}
-	=

+
 	public static ObjRef getArchipelagoHintsBundleRef(ArchipelagoServices AS,=
 ObjRef xArchRef){
 		ObjRef hintsRootRef =3D getHintsRootRef(AS, xArchRef);
 		ObjRef[] bundleRefs =3D AS.xarch.getAll(hintsRootRef, "hintedElement");
-		for(int i =3D 0; i < bundleRefs.length; i++){
-			if(AS.xarch.isInstanceOf(bundleRefs[i], "hints3#HintBundle")){
-				String maintainer =3D (String)AS.xarch.get(bundleRefs[i], "maintainer"=
);
-				String version =3D (String)AS.xarch.get(bundleRefs[i], "version");
-				=

-				if((maintainer !=3D null) && (version !=3D null)){
-					if(maintainer.equals("edu.uci.isr.archstudio4.comp.archipelago") && (=
version.equals("4.0.0"))){
-						return bundleRefs[i];
+		for(ObjRef bundleRef: bundleRefs){
+			if(AS.xarch.isInstanceOf(bundleRef, "hints3#HintBundle")){
+				String maintainer =3D (String)AS.xarch.get(bundleRef, "maintainer");
+				String version =3D (String)AS.xarch.get(bundleRef, "version");
+
+				if(maintainer !=3D null && version !=3D null){
+					if(maintainer.equals("edu.uci.isr.archstudio4.comp.archipelago") && v=
ersion.equals("4.0.0")){
+						return bundleRef;
 					}
 				}
 			}
@@ -172,64 +177,61 @@
 		ObjRef bundleRef =3D AS.xarch.create(hintsContextRef, "hintBundle");
 		AS.xarch.set(bundleRef, "maintainer", "edu.uci.isr.archstudio4.comp.arch=
ipelago");
 		AS.xarch.set(bundleRef, "version", "4.0.0");
-		=

+
 		AS.xarch.add(hintsRootRef, "hintedElement", bundleRef);
 		return bundleRef;
 	}
-	=

+
 	/*
-	public static ObjRef findHintedElementRef(ArchipelagoServices AS, ObjRef =
xArchRef, ObjRef bundleRef, String targetID){
-		ObjRef[] topLevelRefs =3D AS.xarch.getAll(bundleRef, "hintedElement");
-		String targetHref =3D "#" + targetID;
-		for(int i =3D 0; i < topLevelRefs.length; i++){
-			ObjRef targetRef =3D (ObjRef)AS.xarch.get(topLevelRefs[i], "target");
-			if(targetRef !=3D null){
-				String href =3D XadlUtils.getHref(AS.xarch, targetRef);
-				if((href !=3D null) && (href.equals(targetHref))){
-					return topLevelRefs[i];
-				}
-			}
-		}
-		return null;
-	}
-	*/
+	 * public static ObjRef findHintedElementRef(ArchipelagoServices AS, ObjR=
ef
+	 * xArchRef, ObjRef bundleRef, String targetID){ ObjRef[] topLevelRefs =
=3D
+	 * AS.xarch.getAll(bundleRef, "hintedElement"); String targetHref =3D "#"=
 +
+	 * targetID; for(int i =3D 0; i < topLevelRefs.length; i++){ ObjRef targe=
tRef =3D
+	 * (ObjRef)AS.xarch.get(topLevelRefs[i], "target"); if(targetRef !=3D nul=
l){
+	 * String href =3D XadlUtils.getHref(AS.xarch, targetRef); if((href !=3D =
null) &&
+	 * (href.equals(targetHref))){ return topLevelRefs[i]; } } } return null;=
 }
+	 */
 =

 	public static ObjRef findChildHintedElementRef(ArchipelagoServices AS, Ob=
jRef xArchRef, ObjRef rootRef, ObjRef targetRef){
 		ObjRef[] subRefs =3D AS.xarch.getAll(rootRef, "hintedElement");
-		for(int i =3D 0; i < subRefs.length; i++){
-			ObjRef tRef =3D XadlUtils.resolveXLink(AS.xarch, subRefs[i], "target");
+		for(ObjRef subRef: subRefs){
+			ObjRef tRef =3D XadlUtils.resolveXLink(AS.xarch, subRef, "target");
 			if(equals(AS, targetRef, tRef)){
-				return subRefs[i];
+				return subRef;
 			}
 		}
 		return null;
 	}
-	=

+
 	public static ObjRef findHintedElementRef(ArchipelagoServices AS, ObjRef =
xArchRef, ObjRef rootRef, ObjRef targetRef){
 		ObjRef tRef =3D XadlUtils.resolveXLink(AS.xarch, rootRef, "target");
 		if(equals(AS, targetRef, tRef)){
 			return rootRef;
 		}
-		=

+
 		ObjRef[] subRefs =3D AS.xarch.getAll(rootRef, "hintedElement");
-		for(int i =3D 0; i < subRefs.length; i++){
-			ObjRef matchRef =3D findHintedElementRef(AS, xArchRef, subRefs[i], targ=
etRef);
+		for(ObjRef subRef: subRefs){
+			ObjRef matchRef =3D findHintedElementRef(AS, xArchRef, subRef, targetRe=
f);
 			if(matchRef !=3D null){
 				return matchRef;
 			}
 		}
 		return null;
 	}
-	=

+
 	private static boolean equals(ArchipelagoServices AS, ObjRef ref1, ObjRef=
 ref2){
-		if(ref1 =3D=3D ref2) return true;
-		if(ref1.equals(ref2)) return true;
-		=

+		if(ref1 =3D=3D ref2){
+			return true;
+		}
+		if(ref1.equals(ref2)){
+			return true;
+		}
+
 		try{
 			String id1 =3D XadlUtils.getID(AS.xarch, ref1);
 			String id2 =3D XadlUtils.getID(AS.xarch, ref2);
-			=

-			if((id1 !=3D null) && (id2 !=3D null) && (id1.equals(id2))){
+
+			if(id1 !=3D null && id2 !=3D null && id1.equals(id2)){
 				return true;
 			}
 		}
@@ -237,5 +239,5 @@
 		}
 		return false;
 	}
-	=

+
 }

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/IPropertyCoder.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/IPropertyCoder.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/IPropertyCoder.java Thu May  1 08:17:02 2008
@@ -3,8 +3,11 @@
 import edu.uci.isr.archstudio4.comp.archipelago.ArchipelagoServices;
 import edu.uci.isr.xarchflat.ObjRef;
 =

+ at Deprecated
 public interface IPropertyCoder{
+
 	public boolean encode(IPropertyCoder masterCoder, ArchipelagoServices AS,=
 ObjRef xArchRef, ObjRef propertyValueRef, Object propertyValue);
+
 	public Object decode(IPropertyCoder masterCoder, ArchipelagoServices AS, =
ObjRef xArchRef, ObjRef propertyValueRef) throws PropertyDecodeException;
-	=

+
 }

Modified: archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstu=
dio4/comp/archipelago/util/PropertyDecodeException.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/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/PropertyDecodeException.java (original)
+++ archstudio4/trunk/edu.uci.isr.archstudio4/src/edu/uci/isr/archstudio4/c=
omp/archipelago/util/PropertyDecodeException.java Thu May  1 08:17:02 2008
@@ -1,6 +1,8 @@
 package edu.uci.isr.archstudio4.comp.archipelago.util;
 =

-public class PropertyDecodeException extends Exception{
+ at Deprecated
+public class PropertyDecodeException
+    extends Exception{
 =

 	public PropertyDecodeException(){
 	}




More information about the archstudio-commits mailing list