[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Mon Oct 30 15:55:36 UTC 2006


gordonp
Mon Oct 30 10:55:36 EST 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory dev.open-bio.org:/tmp/cvs-serv25319/main/org/biomoby/shared

Modified Files:
	MobyPrimaryDataSet.java 
Log Message:
Added support for declaring data type of set, even if no elements are present yet.  If elements are added, the data type is changed
moby-live/Java/src/main/org/biomoby/shared MobyPrimaryDataSet.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java	2006/07/07 04:12:40	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java	2006/10/30 15:55:36	1.8
@@ -25,6 +25,7 @@
     extends MobyPrimaryData {
 
     protected Vector elements = new Vector(); // elemenst are of type MobyPrimaryDataSimple
+    protected MobyDataType defaultDataType = new MobyDataType("Object");
 
     /**************************************************************************
      * Default constructor. Other characteristics are empty - which is usually
@@ -82,7 +83,7 @@
 	    if (elements.size() > 0)
 		return ((MobyPrimaryDataSimple)elements.firstElement()).getDataType();
 	    else
-		return null;
+		return defaultDataType;
 	}
     }
 
@@ -92,6 +93,7 @@
      * data type).
      *************************************************************************/
     public void setDataType (MobyDataType dataType) {
+	defaultDataType = dataType;
 	synchronized (elements) {
 	    for (Enumeration en = elements.elements(); en.hasMoreElements(); )
 		((MobyPrimaryDataSimple)en.nextElement()).setDataType (dataType);
@@ -170,6 +172,11 @@
 	    for (Enumeration en = elements.elements(); en.hasMoreElements(); )
 		buf.append (((MobyPrimaryDataSimple)en.nextElement()).toXML());
 	}
+	else{
+	    MobyPrimaryDataSimple template = new MobyPrimaryDataSimple();
+	    template.setDataType(defaultDataType);
+	    buf.append(template.toXML());
+	}
 	buf.append ("</Collection>");
 	buf.append ("\n");
 	return new String (buf);




More information about the MOBY-guts mailing list