[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Tue Jan 8 15:20:31 UTC 2008


gordonp
Tue Jan  8 10:20:31 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv6266/src/main/org/biomoby/client

Modified Files:
	MobyRequest.java 
Log Message:
Foreach and Generics updates to request creation code, plus corrected default secondaries setting
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.33,1.34
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2008/01/07 22:45:32	1.33
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2008/01/08 15:20:31	1.34
@@ -873,34 +873,27 @@
 
 	MobyData[] inputs = mobyService.getPrimaryInputs();
 	MobySecondaryData[] secondaries = mobyService.getSecondaryInputs();
-	Iterator queries = data.keySet().iterator();
 
 	// Make sure the number of input args is correct for each query being submitted
-	while(queries.hasNext()){
-	    String queryName = (String) queries.next();
-	    MobyDataJob query = data.get(queryName);
+	for(Map.Entry<String,MobyDataJob> entry: data.entrySet()){
+	    String queryName = entry.getKey();
+	    MobyDataJob query = entry.getValue();
 
 	    // Additionally, we check if they are MobyDataInstances below
 	    Map<String,MobyPrimaryData> primaryParams = new HashMap<String,MobyPrimaryData>();
 	    Map<String,MobySecondaryData> secondaryParams = new HashMap<String,MobySecondaryData>();
 
-	    Iterator params = query.keySet().iterator();
 	    // To store the primary input parameter name as given by the user, 
 	    // in case we need it later on for parameter renaming...
 	    String primaryParamName = null;  
 
-	    while(params.hasNext()){
-		String name = (String) params.next();
-		Object param = query.get(name);
+	    for(Map.Entry<String,MobyDataInstance> subentry: query.entrySet()){
+		String name = subentry.getKey();
+		MobyDataInstance param = subentry.getValue();
 		if(param == null){
 		    throw new MobyException("Query " + queryName + 
 					    " contained a null input parameter (" + name + ")");
 		}
-		else if(!(param instanceof MobyDataInstance)){
-		    System.err.println("Input parameter " + name + " (query " + queryName +
-				       ") was not a MobyDataInstance " +
-				       "as expected, but rather was of class " + param.getClass().getName());
-		}
 		else if(param instanceof MobyPrimaryData){
 		    primaryParams.put(name, (MobyPrimaryData) param);
 		    primaryParamName = name;
@@ -926,7 +919,7 @@
 		if(secondaries.length != 0){
 		    for(MobySecondaryData secondary: secondaries){
 			if(!secondaryParams.containsKey(secondary.getName())){
-			    secondaryParams.put(secondary.getName(), new MobyDataSecondaryInstance(secondary));
+			    query.put(secondary.getName(), new MobyDataSecondaryInstance(secondary));
 			}
 		    }
 		}




More information about the MOBY-guts mailing list