From: jprocter Date: Mon, 27 Mar 2006 12:17:43 +0000 (+0000) Subject: Incorrect bounds for Provenance type in Dataset.DatasetAnnotations. (could have an... X-Git-Tag: Release_0.2~303 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fd8938de8d7dc5a010746d3d187e298b7a64577c;p=vamsas.git Incorrect bounds for Provenance type in Dataset.DatasetAnnotations. (could have an array of provenance arrays). git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@217 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/org/vamsas/objects/core/DataSetAnnotations.java b/src/org/vamsas/objects/core/DataSetAnnotations.java index d67201c..52c56e7 100644 --- a/src/org/vamsas/objects/core/DataSetAnnotations.java +++ b/src/org/vamsas/objects/core/DataSetAnnotations.java @@ -88,9 +88,9 @@ implements java.io.Serializable private java.util.Vector _annotationElementList; /** - * Field _provenanceList + * Field _provenance */ - private java.util.Vector _provenanceList; + private org.vamsas.objects.core.Provenance _provenance; //----------------/ @@ -101,7 +101,6 @@ implements java.io.Serializable { super(); _annotationElementList = new Vector(); - _provenanceList = new Vector(); } //-- org.vamsas.objects.core.DataSetAnnotations() @@ -137,33 +136,6 @@ implements java.io.Serializable } //-- void addAnnotationElement(int, org.vamsas.objects.core.AnnotationElement) /** - * Method addProvenance - * - * - * - * @param vProvenance - */ - public void addProvenance(org.vamsas.objects.core.Provenance vProvenance) - throws java.lang.IndexOutOfBoundsException - { - _provenanceList.addElement(vProvenance); - } //-- void addProvenance(org.vamsas.objects.core.Provenance) - - /** - * Method addProvenance - * - * - * - * @param index - * @param vProvenance - */ - public void addProvenance(int index, org.vamsas.objects.core.Provenance vProvenance) - throws java.lang.IndexOutOfBoundsException - { - _provenanceList.insertElementAt(vProvenance, index); - } //-- void addProvenance(int, org.vamsas.objects.core.Provenance) - - /** * Method deleteBegin * */ @@ -194,18 +166,6 @@ implements java.io.Serializable } //-- java.util.Enumeration enumerateAnnotationElement() /** - * Method enumerateProvenance - * - * - * - * @return Enumeration - */ - public java.util.Enumeration enumerateProvenance() - { - return _provenanceList.elements(); - } //-- java.util.Enumeration enumerateProvenance() - - /** * Note: hashCode() has not been overriden * * @param obj @@ -272,12 +232,12 @@ implements java.io.Serializable } else if (temp._annotationElementList != null) return false; - if (this._provenanceList != null) { - if (temp._provenanceList == null) return false; - else if (!(this._provenanceList.equals(temp._provenanceList))) + if (this._provenance != null) { + if (temp._provenance == null) return false; + else if (!(this._provenance.equals(temp._provenance))) return false; } - else if (temp._provenanceList != null) + else if (temp._provenance != null) return false; return true; } @@ -377,52 +337,15 @@ implements java.io.Serializable } //-- java.lang.String getId() /** - * Method getProvenance - * - * - * - * @param index - * @return Provenance - */ - public org.vamsas.objects.core.Provenance getProvenance(int index) - throws java.lang.IndexOutOfBoundsException - { - //-- check bounds for index - if ((index < 0) || (index > _provenanceList.size())) { - throw new IndexOutOfBoundsException("getProvenance: Index value '"+index+"' not in range [0.."+_provenanceList.size()+ "]"); - } - - return (org.vamsas.objects.core.Provenance) _provenanceList.elementAt(index); - } //-- org.vamsas.objects.core.Provenance getProvenance(int) - - /** - * Method getProvenance - * - * + * Returns the value of field 'provenance'. * * @return Provenance + * @return the value of field 'provenance'. */ - public org.vamsas.objects.core.Provenance[] getProvenance() + public org.vamsas.objects.core.Provenance getProvenance() { - int size = _provenanceList.size(); - org.vamsas.objects.core.Provenance[] mArray = new org.vamsas.objects.core.Provenance[size]; - for (int index = 0; index < size; index++) { - mArray[index] = (org.vamsas.objects.core.Provenance) _provenanceList.elementAt(index); - } - return mArray; - } //-- org.vamsas.objects.core.Provenance[] getProvenance() - - /** - * Method getProvenanceCount - * - * - * - * @return int - */ - public int getProvenanceCount() - { - return _provenanceList.size(); - } //-- int getProvenanceCount() + return this._provenance; + } //-- org.vamsas.objects.core.Provenance getProvenance() /** * Returns the value of field 'seqRef'. @@ -537,15 +460,6 @@ implements java.io.Serializable } //-- void removeAllAnnotationElement() /** - * Method removeAllProvenance - * - */ - public void removeAllProvenance() - { - _provenanceList.removeAllElements(); - } //-- void removeAllProvenance() - - /** * Method removeAnnotationElement * * @@ -561,21 +475,6 @@ implements java.io.Serializable } //-- org.vamsas.objects.core.AnnotationElement removeAnnotationElement(int) /** - * Method removeProvenance - * - * - * - * @param index - * @return Provenance - */ - public org.vamsas.objects.core.Provenance removeProvenance(int index) - { - java.lang.Object obj = _provenanceList.elementAt(index); - _provenanceList.removeElementAt(index); - return (org.vamsas.objects.core.Provenance) obj; - } //-- org.vamsas.objects.core.Provenance removeProvenance(int) - - /** * Method setAnnotationElement * * @@ -652,37 +551,13 @@ implements java.io.Serializable } //-- void setId(java.lang.String) /** - * Method setProvenance - * - * - * - * @param index - * @param vProvenance - */ - public void setProvenance(int index, org.vamsas.objects.core.Provenance vProvenance) - throws java.lang.IndexOutOfBoundsException - { - //-- check bounds for index - if ((index < 0) || (index > _provenanceList.size())) { - throw new IndexOutOfBoundsException("setProvenance: Index value '"+index+"' not in range [0.."+_provenanceList.size()+ "]"); - } - _provenanceList.setElementAt(vProvenance, index); - } //-- void setProvenance(int, org.vamsas.objects.core.Provenance) - - /** - * Method setProvenance - * - * + * Sets the value of field 'provenance'. * - * @param provenanceArray + * @param provenance the value of field 'provenance'. */ - public void setProvenance(org.vamsas.objects.core.Provenance[] provenanceArray) + public void setProvenance(org.vamsas.objects.core.Provenance provenance) { - //-- copy array - _provenanceList.removeAllElements(); - for (int i = 0; i < provenanceArray.length; i++) { - _provenanceList.addElement(provenanceArray[i]); - } + this._provenance = provenance; } //-- void setProvenance(org.vamsas.objects.core.Provenance) /** diff --git a/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java b/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java index f74d6bc..cd77bea 100644 --- a/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java +++ b/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java @@ -372,8 +372,8 @@ public class DataSetAnnotationsDescriptor extends org.exolab.castor.xml.util.XML { //-- local scope } desc.setValidator(fieldValidator); - //-- _provenanceList - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenanceList", "Provenance", org.exolab.castor.xml.NodeType.Element); + //-- _provenance + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException @@ -386,7 +386,7 @@ public class DataSetAnnotationsDescriptor extends org.exolab.castor.xml.util.XML { try { DataSetAnnotations target = (DataSetAnnotations) object; - target.addProvenance( (org.vamsas.objects.core.Provenance) value); + target.setProvenance( (org.vamsas.objects.core.Provenance) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -399,10 +399,10 @@ public class DataSetAnnotationsDescriptor extends org.exolab.castor.xml.util.XML desc.setHandler(handler); desc.setNameSpaceURI("http://www.vamsas.org"); desc.setRequired(true); - desc.setMultivalued(true); + desc.setMultivalued(false); addFieldDescriptor(desc); - //-- validation code for: _provenanceList + //-- validation code for: _provenance fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope