[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sun Apr 11 02:00:02 UTC 2010


gordonp
Sat Apr 10 22:00:02 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv19034/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyObjectTransferHandler.java 
Log Message:
Added native support for primitive datatype recognition in text transfers
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyObjectTransferHandler.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyObjectTransferHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyObjectTransferHandler.java	2007/12/17 18:44:13	1.3
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyObjectTransferHandler.java	2010/04/11 02:00:02	1.4
@@ -218,7 +218,30 @@
 	for(String fieldName: acceptableData.keySet()){
 	    int itemCount = 1;
 	    MobyDataType desiredDataType = acceptableData.get(fieldName).getDataType();
+	    String dataTypeName = desiredDataType.getName();
 	    System.err.println("Checking text for field " + fieldName+ ", data type " + desiredDataType.getName());
+
+	    // trivial data creations first ...
+	    if(dataTypeName.equals(MobyTags.MOBYSTRING)){
+		foundData.put(fieldName+"#"+itemCount++, new MobyDataString(text));
+	    }
+	    else if(dataTypeName.equals(MobyTags.MOBYBOOLEAN) && 
+		    text.matches("(true|True|TRUE|1|yes|Yes|YES|false|False|FALSE|0|no|No|NO)")){
+		foundData.put(fieldName+"#"+itemCount++, 
+			      new MobyDataBoolean(text.matches("(true|True|TRUE|1|yes|Yes|YES)")));
+	    }
+	    else if(dataTypeName.equals(MobyTags.MOBYINTEGER) && 
+		    text.matches("\\d+")){
+		foundData.put(fieldName+"#"+itemCount++, new MobyDataInt("", text));
+	    }
+	    else if(dataTypeName.equals(MobyTags.MOBYFLOAT) && 
+		    text.matches("\\d+(?:\\.\\d*)?(?:[eE][\\-\\+]?\\d+)?")){
+		foundData.put(fieldName+"#"+itemCount++, new MobyDataFloat(text));
+	    }
+	    else if(dataTypeName.equals(MobyTags.MOBYFLOAT) && 
+		    text.matches("(?:19|20)\\d\\d-(?:0[1-9]|1[012])-([012][1-9]|3[01])")){
+		foundData.put(fieldName+"#"+itemCount++, new MobyDataDateTime(text));
+	    }
 	    MobyDataObject[] textData = client.getMobyObjects(text, desiredDataType);
 	    if(textData != null){
 		System.err.println("Found " + textData.length + " matches");




More information about the MOBY-guts mailing list