[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Mon Jan 7 22:11:36 UTC 2008


gordonp
Mon Jan  7 17:11:36 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory dev.open-bio.org:/tmp/cvs-serv15648/src/main/org/biomoby/shared

Modified Files:
	MobyData.java MobyPrimaryData.java MobyPrimaryDataSet.java 
	MobyPrimaryDataSimple.java MobySecondaryData.java 
Log Message:
Added cloneability to MobyData derivatives
moby-live/Java/src/main/org/biomoby/shared MobyData.java,1.5,1.6 MobyPrimaryData.java,1.2,1.3 MobyPrimaryDataSet.java,1.9,1.10 MobyPrimaryDataSimple.java,1.11,1.12 MobySecondaryData.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyData.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyData.java	2006/07/07 04:12:40	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyData.java	2008/01/07 22:11:36	1.6
@@ -21,7 +21,7 @@
  * @version $Id$
  */
 
-abstract public class MobyData {
+abstract public class MobyData implements Cloneable{
 
     protected String name;
     protected String id = null;
@@ -56,8 +56,9 @@
     }
 
     /**************************************************************************
-     * Must be overwritten byte a subclass.
+     * Must be overwritten by a subclass.
      *************************************************************************/
+    abstract public MobyData clone();
     abstract public String toXML();
     abstract public boolean isPrimary();
     abstract public String format (int indent);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryData.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryData.java	2006/07/07 04:12:40	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryData.java	2008/01/07 22:11:36	1.3
@@ -18,7 +18,7 @@
  */
 
 abstract public class MobyPrimaryData
-    extends MobyData {
+    extends MobyData implements Cloneable {
 
     /**************************************************************************
      *
@@ -44,6 +44,7 @@
     /**************************************************************************
      * Must be overwritten by a subclass.
      *************************************************************************/
+    abstract public MobyPrimaryData clone();
     abstract public MobyDataType getDataType();
     abstract public void setDataType (MobyDataType value);
     abstract public MobyNamespace[] getNamespaces();

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java	2006/11/11 23:04:34	1.9
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java	2008/01/07 22:11:36	1.10
@@ -22,7 +22,7 @@
  */
 
 public class MobyPrimaryDataSet
-    extends MobyPrimaryData {
+    extends MobyPrimaryData implements Cloneable{
 
     protected Vector<MobyPrimaryDataSimple> elements =
 	new Vector<MobyPrimaryDataSimple>();
@@ -57,6 +57,13 @@
 	}
     }
 
+    public MobyPrimaryDataSet clone(){
+	MobyPrimaryDataSet clone = new MobyPrimaryDataSet(getName());
+	clone.setDataType(getDataType());
+	clone.setElements(getElements());  // also sets namespaces implicitly
+	return clone;
+    }
+
     public MobyPrimaryDataSimple[] getElements() {
 	MobyPrimaryDataSimple[] result = new MobyPrimaryDataSimple [elements.size()];
 	elements.copyInto (result);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java	2007/04/27 13:44:21	1.11
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java	2008/01/07 22:11:36	1.12
@@ -26,7 +26,7 @@
  */
 
 public class MobyPrimaryDataSimple
-    extends MobyPrimaryData {
+    extends MobyPrimaryData implements Cloneable{
 
     protected Vector<MobyNamespace> namespaces = new Vector<MobyNamespace>();
     protected MobyDataType dataType;
@@ -88,6 +88,14 @@
 	}
     }
 
+    public MobyPrimaryDataSimple clone(){
+	MobyPrimaryDataSimple clone = new MobyPrimaryDataSimple(name);
+	clone.setId(getId());
+	clone.namespaces = new Vector<MobyNamespace>(namespaces);
+	clone.dataType = dataType;
+	return clone;
+    }
+
     /**************************************************************************
      *
      *************************************************************************/

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java	2006/12/07 16:37:36	1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java	2008/01/07 22:11:36	1.11
@@ -22,7 +22,7 @@
  */
 
 public class MobySecondaryData
-    extends MobyData {
+    extends MobyData implements Cloneable{
     public static final String INTEGER_TYPE = "Integer";
     public static final String FLOAT_TYPE = "Float";
     public static final String STRING_TYPE = "String";
@@ -90,6 +90,17 @@
 	}
     }
 
+    public MobySecondaryData clone(){
+	MobySecondaryData clone = new MobySecondaryData(getName());
+	clone.dataType = dataType;
+	clone.defaultValue = defaultValue;
+	clone.minimumValue = minimumValue;
+	clone.maximumValue = maximumValue;
+	clone.allowedValues = new Vector<String>(allowedValues);
+	clone.description = description;
+	return clone();
+    }
+
     public String getDataType() {
 	return dataType;
     }




More information about the MOBY-guts mailing list