[Swift-commit] r3173 - trunk/src/org/griphyn/vdl/karajan/lib

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Oct 23 15:31:00 CDT 2009


Author: hategan
Date: 2009-10-23 15:30:59 -0500 (Fri, 23 Oct 2009)
New Revision: 3173

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java
Log:
if tr not specified, return site profile only

Modified: trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java	2009-10-23 20:29:15 UTC (rev 3172)
+++ trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java	2009-10-23 20:30:59 UTC (rev 3173)
@@ -29,11 +29,11 @@
 public class TCProfile extends VDLFunction {
     public static final Logger logger = Logger.getLogger(TCProfile.class);
     
-	public static final Arg PA_TR = new Arg.Positional("tr");
+	public static final Arg OA_TR = new Arg.Optional("tr");
 	public static final Arg PA_HOST = new Arg.Positional("host");
 	
 	static {
-		setArguments(TCProfile.class, new Arg[] { PA_TR, PA_HOST });
+		setArguments(TCProfile.class, new Arg[] { PA_HOST, OA_TR });
 	}
 
 	private static Map PROFILE_T;
@@ -53,7 +53,10 @@
 
 	public Object function(VariableStack stack) throws ExecutionException {
 		TCCache tc = getTC(stack);
-		String tr = TypeUtil.toString(PA_TR.getValue(stack));
+		String tr = null;
+		if (OA_TR.isPresent(stack)) {
+		    tr = TypeUtil.toString(OA_TR.getValue(stack));
+		}
 		BoundContact bc = (BoundContact) PA_HOST.getValue(stack);
 		
 		NamedArguments named = ArgUtil.getNamedReturn(stack);
@@ -61,7 +64,10 @@
 		
 		attrs = attributesFromHost(bc, attrs, named);
 
-		TransformationCatalogEntry tce = getTCE(tc, new FQN(tr), bc);
+		TransformationCatalogEntry tce = null;
+		if (tr != null) {
+		    getTCE(tc, new FQN(tr), bc);
+		}
 		
 		Map env = new HashMap();
 		if (tce != null) {




More information about the Swift-commit mailing list