From eae55a9d436c058b8f03036faa0a4baa930c2cd5 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 22 May 2007 15:16:26 +0000 Subject: [PATCH] schema changes: provenance-entry-date is now an xmlSchema:dateTime bound directly to java.util.Date. Sequence and alignment sequence associated annotation takes an array of object references. Trees have a nodeMapping object to map between entities in the tree representation and objects in the document. Dataset sequences have Vxrefs which are named references to one or more other document objects. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@402 be28352e-c001-0410-b1a7-c7978e42abec --- schemas/vamsas.xsd | 102 ++- src/uk/ac/vamsas/objects/core/.castor.cdr | 12 +- .../vamsas/objects/core/AlignmentAnnotation.java | 203 ++++++ .../ac/vamsas/objects/core/DataSetAnnotations.java | 185 ++++- src/uk/ac/vamsas/objects/core/Entry.java | 14 +- src/uk/ac/vamsas/objects/core/Input.java | 187 ++++- src/uk/ac/vamsas/objects/core/NodeType.java | 718 ++++++++++++++++++++ src/uk/ac/vamsas/objects/core/ReferenceType.java | 443 ++++++++++++ src/uk/ac/vamsas/objects/core/Sequence.java | 206 ++++++ src/uk/ac/vamsas/objects/core/Tree.java | 206 ++++++ src/uk/ac/vamsas/objects/core/Treenode.java | 412 +++++++++++ src/uk/ac/vamsas/objects/core/Vref.java | 155 +++++ src/uk/ac/vamsas/objects/core/Vxref.java | 157 +++++ .../descriptors/AlignmentAnnotationDescriptor.java | 46 ++ .../descriptors/DataSetAnnotationsDescriptor.java | 19 +- .../objects/core/descriptors/EntryDescriptor.java | 8 +- .../objects/core/descriptors/InputDescriptor.java | 18 +- .../core/descriptors/NodeTypeDescriptor.java | 398 +++++++++++ .../core/descriptors/ReferenceTypeDescriptor.java | 280 ++++++++ .../core/descriptors/SequenceDescriptor.java | 42 ++ .../objects/core/descriptors/TreeDescriptor.java | 42 ++ .../core/descriptors/TreenodeDescriptor.java | 249 +++++++ .../objects/core/descriptors/VrefDescriptor.java | 159 +++++ .../objects/core/descriptors/VxrefDescriptor.java | 159 +++++ .../ac/vamsas/objects/utils/ProvenanceStuff.java | 2 +- .../test/simpleclient/simpleapp/VamsasClient.java | 2 +- .../simpleclient/simpleapp/VamsasDatastore.java | 2 +- 27 files changed, 4372 insertions(+), 54 deletions(-) create mode 100644 src/uk/ac/vamsas/objects/core/NodeType.java create mode 100644 src/uk/ac/vamsas/objects/core/ReferenceType.java create mode 100644 src/uk/ac/vamsas/objects/core/Treenode.java create mode 100644 src/uk/ac/vamsas/objects/core/Vref.java create mode 100644 src/uk/ac/vamsas/objects/core/Vxref.java create mode 100644 src/uk/ac/vamsas/objects/core/descriptors/NodeTypeDescriptor.java create mode 100644 src/uk/ac/vamsas/objects/core/descriptors/ReferenceTypeDescriptor.java create mode 100644 src/uk/ac/vamsas/objects/core/descriptors/TreenodeDescriptor.java create mode 100644 src/uk/ac/vamsas/objects/core/descriptors/VrefDescriptor.java create mode 100644 src/uk/ac/vamsas/objects/core/descriptors/VxrefDescriptor.java diff --git a/schemas/vamsas.xsd b/schemas/vamsas.xsd index 3b8d42b..cdbc003 100644 --- a/schemas/vamsas.xsd +++ b/schemas/vamsas.xsd @@ -58,6 +58,34 @@ + + + + node identity and mapping data between tree representations and vamsas document objects + + + + + + + + + reference to one or more trees containing the node being described. + + + + + + + String uniquely identifying a particular node in the referenced tree according to the format of the tree representation that is referenced. + + + + + + + + @@ -69,6 +97,58 @@ + + + + base type for citing arbitrary links between vamsas objects + + + + + + + Optional human readable description of the relationship + + + + + Primary Key for vamsas object referencing + + + + + List of one or more vamsas object references + + + + + + + + + + Short name for this node + + + + + Descriptive text for this node + + + + + Direct associations between this node and any vamsas objects + + + + + + + Primary Key for vamsas object referencing + + + + @@ -259,7 +339,7 @@ - + Reference Frame for rangeType specfication @@ -294,9 +374,9 @@ Did what - + - When + When @@ -408,6 +488,13 @@ + + + + explicitly named cross reference to other objects in the document. + + + @@ -454,7 +541,7 @@ - + annotation is associated with a particular dataset sequence @@ -487,6 +574,13 @@ graph + + + annotation is associated with a + range on a particular group of alignment sequences + + + diff --git a/src/uk/ac/vamsas/objects/core/.castor.cdr b/src/uk/ac/vamsas/objects/core/.castor.cdr index 512f81b..e9fc12e 100644 --- a/src/uk/ac/vamsas/objects/core/.castor.cdr +++ b/src/uk/ac/vamsas/objects/core/.castor.cdr @@ -1,9 +1,12 @@ -#Fri May 18 12:13:56 BST 2007 +#Tue May 22 14:53:59 BST 2007 +uk.ac.vamsas.objects.core.Vref=uk.ac.vamsas.objects.core.descriptors.VrefDescriptor +uk.ac.vamsas.objects.core.ReferenceType=uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor uk.ac.vamsas.objects.core.SequenceType=uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor uk.ac.vamsas.objects.core.DbRef=uk.ac.vamsas.objects.core.descriptors.DbRefDescriptor uk.ac.vamsas.objects.core.Tree=uk.ac.vamsas.objects.core.descriptors.TreeDescriptor uk.ac.vamsas.objects.core.VAMSAS=uk.ac.vamsas.objects.core.descriptors.VAMSASDescriptor uk.ac.vamsas.objects.core.Mapping=uk.ac.vamsas.objects.core.descriptors.MappingDescriptor +uk.ac.vamsas.objects.core.Treenode=uk.ac.vamsas.objects.core.descriptors.TreenodeDescriptor uk.ac.vamsas.objects.core.Glyph=uk.ac.vamsas.objects.core.descriptors.GlyphDescriptor uk.ac.vamsas.objects.core.DataSet=uk.ac.vamsas.objects.core.descriptors.DataSetDescriptor uk.ac.vamsas.objects.core.AnnotationElement=uk.ac.vamsas.objects.core.descriptors.AnnotationElementDescriptor @@ -12,6 +15,8 @@ uk.ac.vamsas.objects.core.Entry=uk.ac.vamsas.objects.core.descriptors.EntryDescr uk.ac.vamsas.objects.core.User=uk.ac.vamsas.objects.core.descriptors.UserDescriptor uk.ac.vamsas.objects.core.Provenance=uk.ac.vamsas.objects.core.descriptors.ProvenanceDescriptor uk.ac.vamsas.objects.core.RangeType=uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor +uk.ac.vamsas.objects.core.Vxref=uk.ac.vamsas.objects.core.descriptors.VxrefDescriptor +uk.ac.vamsas.objects.core.NodeType=uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor uk.ac.vamsas.objects.core.SequenceMapping=uk.ac.vamsas.objects.core.descriptors.SequenceMappingDescriptor uk.ac.vamsas.objects.core.Newick=uk.ac.vamsas.objects.core.descriptors.NewickDescriptor uk.ac.vamsas.objects.core.ApplicationData=uk.ac.vamsas.objects.core.descriptors.ApplicationDataDescriptor @@ -27,10 +32,11 @@ uk.ac.vamsas.objects.core.Sequence=uk.ac.vamsas.objects.core.descriptors.Sequenc uk.ac.vamsas.objects.core.Pos=uk.ac.vamsas.objects.core.descriptors.PosDescriptor uk.ac.vamsas.objects.core.Alignment=uk.ac.vamsas.objects.core.descriptors.AlignmentDescriptor uk.ac.vamsas.objects.core.Seg=uk.ac.vamsas.objects.core.descriptors.SegDescriptor +uk.ac.vamsas.objects.core.Docxrefs=uk.ac.vamsas.objects.core.descriptors.DocxrefsDescriptor uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation=uk.ac.vamsas.objects.core.descriptors.AlignmentSequenceAnnotationDescriptor -uk.ac.vamsas.objects.core.Score=uk.ac.vamsas.objects.core.descriptors.ScoreDescriptor -uk.ac.vamsas.objects.core.DataSetAnnotations=uk.ac.vamsas.objects.core.descriptors.DataSetAnnotationsDescriptor uk.ac.vamsas.objects.core.Input=uk.ac.vamsas.objects.core.descriptors.InputDescriptor +uk.ac.vamsas.objects.core.DataSetAnnotations=uk.ac.vamsas.objects.core.descriptors.DataSetAnnotationsDescriptor +uk.ac.vamsas.objects.core.Score=uk.ac.vamsas.objects.core.descriptors.ScoreDescriptor uk.ac.vamsas.objects.core.VamsasDocument=uk.ac.vamsas.objects.core.descriptors.VamsasDocumentDescriptor --=listing properties -- uk.ac.vamsas.objects.core.AppData=uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor diff --git a/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java b/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java index 17e7c78..0ffea12 100644 --- a/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java +++ b/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java @@ -44,6 +44,12 @@ implements java.io.Serializable private boolean _has_graph; /** + * annotation is associated with a + * range on a particular group of alignment sequences + */ + private java.util.Vector _seqrefs; + + /** * Field _provenance. */ private uk.ac.vamsas.objects.core.Provenance _provenance; @@ -55,6 +61,7 @@ implements java.io.Serializable public AlignmentAnnotation() { super(); + this._seqrefs = new java.util.Vector(); } @@ -63,6 +70,34 @@ implements java.io.Serializable //-----------/ /** + * + * + * @param vSeqrefs + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSeqrefs( + final java.lang.Object vSeqrefs) + throws java.lang.IndexOutOfBoundsException { + this._seqrefs.addElement(vSeqrefs); + } + + /** + * + * + * @param index + * @param vSeqrefs + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSeqrefs( + final int index, + final java.lang.Object vSeqrefs) + throws java.lang.IndexOutOfBoundsException { + this._seqrefs.add(index, vSeqrefs); + } + + /** */ public void deleteGraph( ) { @@ -70,6 +105,16 @@ implements java.io.Serializable } /** + * Method enumerateSeqrefs. + * + * @return an Enumeration over all java.lang.Object elements + */ + public java.util.Enumeration enumerateSeqrefs( + ) { + return this._seqrefs.elements(); + } + + /** * Overrides the java.lang.Object.equals method. * * @param obj @@ -90,6 +135,13 @@ implements java.io.Serializable return false; if (this._has_graph != temp._has_graph) return false; + if (this._seqrefs != null) { + if (temp._seqrefs == null) return false; + else if (!(this._seqrefs.equals(temp._seqrefs))) + return false; + } + else if (temp._seqrefs != null) + return false; if (this._provenance != null) { if (temp._provenance == null) return false; else if (!(this._provenance.equals(temp._provenance))) @@ -127,6 +179,62 @@ implements java.io.Serializable } /** + * Method getSeqrefs. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.Object at the given index + */ + public java.lang.Object getSeqrefs( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._seqrefs.size()) { + throw new IndexOutOfBoundsException("getSeqrefs: Index value '" + index + "' not in range [0.." + (this._seqrefs.size() - 1) + "]"); + } + + return _seqrefs.get(index); + } + + /** + * Method getSeqrefs.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.Object[] getSeqrefs( + ) { + java.lang.Object[] array = new java.lang.Object[0]; + return (java.lang.Object[]) this._seqrefs.toArray(array); + } + + /** + * Method getSeqrefsAsReference.Returns a reference to + * '_seqrefs'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getSeqrefsAsReference( + ) { + return this._seqrefs; + } + + /** + * Method getSeqrefsCount. + * + * @return the size of this collection + */ + public int getSeqrefsCount( + ) { + return this._seqrefs.size(); + } + + /** * Method hasGraph. * * @return true if at least one Graph has been added @@ -150,6 +258,9 @@ implements java.io.Serializable long tmp; result = 37 * result + (_graph?0:1); + if (_seqrefs != null) { + result = 37 * result + _seqrefs.hashCode(); + } if (_provenance != null) { result = 37 * result + _provenance.hashCode(); } @@ -219,6 +330,37 @@ implements java.io.Serializable } /** + */ + public void removeAllSeqrefs( + ) { + this._seqrefs.clear(); + } + + /** + * Method removeSeqrefs. + * + * @param vSeqrefs + * @return true if the object was removed from the collection. + */ + public boolean removeSeqrefs( + final java.lang.Object vSeqrefs) { + boolean removed = _seqrefs.remove(vSeqrefs); + return removed; + } + + /** + * Method removeSeqrefsAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.Object removeSeqrefsAt( + final int index) { + java.lang.Object obj = this._seqrefs.remove(index); + return obj; + } + + /** * Sets the value of field 'graph'. The field 'graph' has the * following description: TODO: decide if this flag is * redundant - when true it would suggest that @@ -244,6 +386,67 @@ implements java.io.Serializable } /** + * + * + * @param index + * @param vSeqrefs + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setSeqrefs( + final int index, + final java.lang.Object vSeqrefs) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._seqrefs.size()) { + throw new IndexOutOfBoundsException("setSeqrefs: Index value '" + index + "' not in range [0.." + (this._seqrefs.size() - 1) + "]"); + } + + this._seqrefs.set(index, vSeqrefs); + } + + /** + * + * + * @param vSeqrefsArray + */ + public void setSeqrefs( + final java.lang.Object[] vSeqrefsArray) { + //-- copy array + _seqrefs.clear(); + + for (int i = 0; i < vSeqrefsArray.length; i++) { + this._seqrefs.add(vSeqrefsArray[i]); + } + } + + /** + * Sets the value of '_seqrefs' by copying the given Vector. + * All elements will be checked for type safety. + * + * @param vSeqrefsList the Vector to copy. + */ + public void setSeqrefs( + final java.util.Vector vSeqrefsList) { + // copy vector + this._seqrefs.clear(); + + this._seqrefs.addAll(vSeqrefsList); + } + + /** + * Sets the value of '_seqrefs' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param seqrefsVector the Vector to set. + */ + public void setSeqrefsAsReference( + final java.util.Vector seqrefsVector) { + this._seqrefs = seqrefsVector; + } + + /** * Method unmarshal. * * @param reader diff --git a/src/uk/ac/vamsas/objects/core/DataSetAnnotations.java b/src/uk/ac/vamsas/objects/core/DataSetAnnotations.java index 2d1c91a..39aa939 100644 --- a/src/uk/ac/vamsas/objects/core/DataSetAnnotations.java +++ b/src/uk/ac/vamsas/objects/core/DataSetAnnotations.java @@ -32,7 +32,7 @@ implements java.io.Serializable * annotation is associated with a * particular dataset sequence */ - private java.lang.Object _seqRef; + private java.util.Vector _seqRef; /** * Field _provenance. @@ -46,6 +46,7 @@ implements java.io.Serializable public DataSetAnnotations() { super(); + this._seqRef = new java.util.Vector(); } @@ -54,6 +55,44 @@ implements java.io.Serializable //-----------/ /** + * + * + * @param vSeqRef + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSeqRef( + final java.lang.Object vSeqRef) + throws java.lang.IndexOutOfBoundsException { + this._seqRef.addElement(vSeqRef); + } + + /** + * + * + * @param index + * @param vSeqRef + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSeqRef( + final int index, + final java.lang.Object vSeqRef) + throws java.lang.IndexOutOfBoundsException { + this._seqRef.add(index, vSeqRef); + } + + /** + * Method enumerateSeqRef. + * + * @return an Enumeration over all java.lang.Object elements + */ + public java.util.Enumeration enumerateSeqRef( + ) { + return this._seqRef.elements(); + } + + /** * Overrides the java.lang.Object.equals method. * * @param obj @@ -100,18 +139,62 @@ implements java.io.Serializable } /** - * Returns the value of field 'seqRef'. The field 'seqRef' has - * the following description: annotation is associated with a - * particular dataset sequence + * Method getSeqRef. * - * @return the value of field 'SeqRef'. + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.Object at the given index */ public java.lang.Object getSeqRef( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._seqRef.size()) { + throw new IndexOutOfBoundsException("getSeqRef: Index value '" + index + "' not in range [0.." + (this._seqRef.size() - 1) + "]"); + } + + return _seqRef.get(index); + } + + /** + * Method getSeqRef.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.Object[] getSeqRef( + ) { + java.lang.Object[] array = new java.lang.Object[0]; + return (java.lang.Object[]) this._seqRef.toArray(array); + } + + /** + * Method getSeqRefAsReference.Returns a reference to + * '_seqRef'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getSeqRefAsReference( ) { return this._seqRef; } /** + * Method getSeqRefCount. + * + * @return the size of this collection + */ + public int getSeqRefCount( + ) { + return this._seqRef.size(); + } + + /** * Overrides the java.lang.Object.hashCode method. *

* The following steps came from Effective Java Programming @@ -182,6 +265,37 @@ implements java.io.Serializable } /** + */ + public void removeAllSeqRef( + ) { + this._seqRef.clear(); + } + + /** + * Method removeSeqRef. + * + * @param vSeqRef + * @return true if the object was removed from the collection. + */ + public boolean removeSeqRef( + final java.lang.Object vSeqRef) { + boolean removed = _seqRef.remove(vSeqRef); + return removed; + } + + /** + * Method removeSeqRefAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.Object removeSeqRefAt( + final int index) { + java.lang.Object obj = this._seqRef.remove(index); + return obj; + } + + /** * Sets the value of field 'provenance'. * * @param provenance the value of field 'provenance'. @@ -192,15 +306,64 @@ implements java.io.Serializable } /** - * Sets the value of field 'seqRef'. The field 'seqRef' has the - * following description: annotation is associated with a - * particular dataset sequence * - * @param seqRef the value of field 'seqRef'. + * + * @param index + * @param vSeqRef + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection */ public void setSeqRef( - final java.lang.Object seqRef) { - this._seqRef = seqRef; + final int index, + final java.lang.Object vSeqRef) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._seqRef.size()) { + throw new IndexOutOfBoundsException("setSeqRef: Index value '" + index + "' not in range [0.." + (this._seqRef.size() - 1) + "]"); + } + + this._seqRef.set(index, vSeqRef); + } + + /** + * + * + * @param vSeqRefArray + */ + public void setSeqRef( + final java.lang.Object[] vSeqRefArray) { + //-- copy array + _seqRef.clear(); + + for (int i = 0; i < vSeqRefArray.length; i++) { + this._seqRef.add(vSeqRefArray[i]); + } + } + + /** + * Sets the value of '_seqRef' by copying the given Vector. All + * elements will be checked for type safety. + * + * @param vSeqRefList the Vector to copy. + */ + public void setSeqRef( + final java.util.Vector vSeqRefList) { + // copy vector + this._seqRef.clear(); + + this._seqRef.addAll(vSeqRefList); + } + + /** + * Sets the value of '_seqRef' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param seqRefVector the Vector to set. + */ + public void setSeqRefAsReference( + final java.util.Vector seqRefVector) { + this._seqRef = seqRefVector; } /** diff --git a/src/uk/ac/vamsas/objects/core/Entry.java b/src/uk/ac/vamsas/objects/core/Entry.java index ec6444b..8cdd864 100644 --- a/src/uk/ac/vamsas/objects/core/Entry.java +++ b/src/uk/ac/vamsas/objects/core/Entry.java @@ -50,9 +50,9 @@ implements java.io.Serializable private java.lang.String _action; /** - * When : TODO: change to dateTime for release + * When */ - private org.exolab.castor.types.Date _date; + private java.util.Date _date; /** * additional information @@ -306,12 +306,11 @@ implements java.io.Serializable /** * Returns the value of field 'date'. The field 'date' has the - * following description: When : TODO: change to dateTime for - * release + * following description: When * * @return the value of field 'Date'. */ - public org.exolab.castor.types.Date getDate( + public java.util.Date getDate( ) { return this._date; } @@ -716,13 +715,12 @@ implements java.io.Serializable /** * Sets the value of field 'date'. The field 'date' has the - * following description: When : TODO: change to dateTime for - * release + * following description: When * * @param date the value of field 'date'. */ public void setDate( - final org.exolab.castor.types.Date date) { + final java.util.Date date) { this._date = date; } diff --git a/src/uk/ac/vamsas/objects/core/Input.java b/src/uk/ac/vamsas/objects/core/Input.java index 5d8b2b3..3ad7a8e 100644 --- a/src/uk/ac/vamsas/objects/core/Input.java +++ b/src/uk/ac/vamsas/objects/core/Input.java @@ -37,7 +37,7 @@ implements java.io.Serializable * Reference Frame for rangeType specfication * */ - private java.lang.Object _objRef; + private java.util.Vector _objRef; //----------------/ @@ -46,6 +46,7 @@ implements java.io.Serializable public Input() { super(); + this._objRef = new java.util.Vector(); } @@ -54,6 +55,44 @@ implements java.io.Serializable //-----------/ /** + * + * + * @param vObjRef + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addObjRef( + final java.lang.Object vObjRef) + throws java.lang.IndexOutOfBoundsException { + this._objRef.addElement(vObjRef); + } + + /** + * + * + * @param index + * @param vObjRef + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addObjRef( + final int index, + final java.lang.Object vObjRef) + throws java.lang.IndexOutOfBoundsException { + this._objRef.add(index, vObjRef); + } + + /** + * Method enumerateObjRef. + * + * @return an Enumeration over all java.lang.Object elements + */ + public java.util.Enumeration enumerateObjRef( + ) { + return this._objRef.elements(); + } + + /** * Overrides the java.lang.Object.equals method. * * @param obj @@ -100,19 +139,62 @@ implements java.io.Serializable } /** - * Returns the value of field 'objRef'. The field 'objRef' has - * the following description: Reference Frame for rangeType - * specfication - * + * Method getObjRef. * - * @return the value of field 'ObjRef'. + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.Object at the given index */ public java.lang.Object getObjRef( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._objRef.size()) { + throw new IndexOutOfBoundsException("getObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]"); + } + + return _objRef.get(index); + } + + /** + * Method getObjRef.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.Object[] getObjRef( + ) { + java.lang.Object[] array = new java.lang.Object[0]; + return (java.lang.Object[]) this._objRef.toArray(array); + } + + /** + * Method getObjRefAsReference.Returns a reference to + * '_objRef'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getObjRefAsReference( ) { return this._objRef; } /** + * Method getObjRefCount. + * + * @return the size of this collection + */ + public int getObjRefCount( + ) { + return this._objRef.size(); + } + + /** * Overrides the java.lang.Object.hashCode method. *

* The following steps came from Effective Java Programming @@ -183,6 +265,37 @@ implements java.io.Serializable } /** + */ + public void removeAllObjRef( + ) { + this._objRef.clear(); + } + + /** + * Method removeObjRef. + * + * @param vObjRef + * @return true if the object was removed from the collection. + */ + public boolean removeObjRef( + final java.lang.Object vObjRef) { + boolean removed = _objRef.remove(vObjRef); + return removed; + } + + /** + * Method removeObjRefAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.Object removeObjRefAt( + final int index) { + java.lang.Object obj = this._objRef.remove(index); + return obj; + } + + /** * Sets the value of field 'name'. * * @param name the value of field 'name'. @@ -193,16 +306,64 @@ implements java.io.Serializable } /** - * Sets the value of field 'objRef'. The field 'objRef' has the - * following description: Reference Frame for rangeType - * specfication - * * - * @param objRef the value of field 'objRef'. + * + * @param index + * @param vObjRef + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection */ public void setObjRef( - final java.lang.Object objRef) { - this._objRef = objRef; + final int index, + final java.lang.Object vObjRef) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._objRef.size()) { + throw new IndexOutOfBoundsException("setObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]"); + } + + this._objRef.set(index, vObjRef); + } + + /** + * + * + * @param vObjRefArray + */ + public void setObjRef( + final java.lang.Object[] vObjRefArray) { + //-- copy array + _objRef.clear(); + + for (int i = 0; i < vObjRefArray.length; i++) { + this._objRef.add(vObjRefArray[i]); + } + } + + /** + * Sets the value of '_objRef' by copying the given Vector. All + * elements will be checked for type safety. + * + * @param vObjRefList the Vector to copy. + */ + public void setObjRef( + final java.util.Vector vObjRefList) { + // copy vector + this._objRef.clear(); + + this._objRef.addAll(vObjRefList); + } + + /** + * Sets the value of '_objRef' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param objRefVector the Vector to set. + */ + public void setObjRefAsReference( + final java.util.Vector objRefVector) { + this._objRef = objRefVector; } /** diff --git a/src/uk/ac/vamsas/objects/core/NodeType.java b/src/uk/ac/vamsas/objects/core/NodeType.java new file mode 100644 index 0000000..7f480d1 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/NodeType.java @@ -0,0 +1,718 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Class NodeType. + * + * @version $Revision$ $Date$ + */ +public class NodeType extends uk.ac.vamsas.client.Vobject +implements java.io.Serializable +{ + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Primary Key for vamsas object referencing + */ + private java.lang.String _id; + + /** + * Field _modifiable. + */ + private java.lang.String _modifiable; + + /** + * Short name for this node + */ + private java.lang.String _name; + + /** + * Descriptive text for this node + */ + private java.lang.String _description; + + /** + * Direct associations between this node and any vamsas objects + */ + private java.util.Vector _vrefList; + + /** + * Field _propertyList. + */ + private java.util.Vector _propertyList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public NodeType() { + super(); + this._vrefList = new java.util.Vector(); + this._propertyList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addProperty( + final uk.ac.vamsas.objects.core.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.addElement(vProperty); + } + + /** + * + * + * @param index + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addProperty( + final int index, + final uk.ac.vamsas.objects.core.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.add(index, vProperty); + } + + /** + * + * + * @param vVref + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addVref( + final uk.ac.vamsas.objects.core.Vref vVref) + throws java.lang.IndexOutOfBoundsException { + this._vrefList.addElement(vVref); + } + + /** + * + * + * @param index + * @param vVref + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addVref( + final int index, + final uk.ac.vamsas.objects.core.Vref vVref) + throws java.lang.IndexOutOfBoundsException { + this._vrefList.add(index, vVref); + } + + /** + * Method enumerateProperty. + * + * @return an Enumeration over all + * uk.ac.vamsas.objects.core.Property elements + */ + public java.util.Enumeration enumerateProperty( + ) { + return this._propertyList.elements(); + } + + /** + * Method enumerateVref. + * + * @return an Enumeration over all + * uk.ac.vamsas.objects.core.Vref elements + */ + public java.util.Enumeration enumerateVref( + ) { + return this._vrefList.elements(); + } + + /** + * Overrides the java.lang.Object.equals method. + * + * @param obj + * @return true if the objects are equal. + */ + public boolean equals( + final java.lang.Object obj) { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof NodeType) { + + NodeType temp = (NodeType)obj; + if (this._id != null) { + if (temp._id == null) return false; + else if (!(this._id.equals(temp._id))) + return false; + } + else if (temp._id != null) + return false; + if (this._modifiable != null) { + if (temp._modifiable == null) return false; + else if (!(this._modifiable.equals(temp._modifiable))) + return false; + } + else if (temp._modifiable != null) + return false; + if (this._name != null) { + if (temp._name == null) return false; + else if (!(this._name.equals(temp._name))) + return false; + } + else if (temp._name != null) + return false; + if (this._description != null) { + if (temp._description == null) return false; + else if (!(this._description.equals(temp._description))) + return false; + } + else if (temp._description != null) + return false; + if (this._vrefList != null) { + if (temp._vrefList == null) return false; + else if (!(this._vrefList.equals(temp._vrefList))) + return false; + } + else if (temp._vrefList != null) + return false; + if (this._propertyList != null) { + if (temp._propertyList == null) return false; + else if (!(this._propertyList.equals(temp._propertyList))) + return false; + } + else if (temp._propertyList != null) + return false; + return true; + } + return false; + } + + /** + * Returns the value of field 'description'. The field + * 'description' has the following description: Descriptive + * text for this node + * + * @return the value of field 'Description'. + */ + public java.lang.String getDescription( + ) { + return this._description; + } + + /** + * Returns the value of field 'id'. The field 'id' has the + * following description: Primary Key for vamsas object + * referencing + * + * @return the value of field 'Id'. + */ + public java.lang.String getId( + ) { + return this._id; + } + + /** + * Returns the value of field 'modifiable'. + * + * @return the value of field 'Modifiable'. + */ + public java.lang.String getModifiable( + ) { + return this._modifiable; + } + + /** + * Returns the value of field 'name'. The field 'name' has the + * following description: Short name for this node + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Method getProperty. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the uk.ac.vamsas.objects.core.Property + * at the given index + */ + public uk.ac.vamsas.objects.core.Property getProperty( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._propertyList.size()) { + throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]"); + } + + return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index); + } + + /** + * Method getProperty.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public uk.ac.vamsas.objects.core.Property[] getProperty( + ) { + uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0]; + return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array); + } + + /** + * Method getPropertyAsReference.Returns a reference to + * '_propertyList'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getPropertyAsReference( + ) { + return this._propertyList; + } + + /** + * Method getPropertyCount. + * + * @return the size of this collection + */ + public int getPropertyCount( + ) { + return this._propertyList.size(); + } + + /** + * Method getVref. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the uk.ac.vamsas.objects.core.Vref at + * the given index + */ + public uk.ac.vamsas.objects.core.Vref getVref( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._vrefList.size()) { + throw new IndexOutOfBoundsException("getVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]"); + } + + return (uk.ac.vamsas.objects.core.Vref) _vrefList.get(index); + } + + /** + * Method getVref.Returns the contents of the collection in an + * Array.

Note: Just in case the collection contents are + * changing in another thread, we pass a 0-length Array of the + * correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public uk.ac.vamsas.objects.core.Vref[] getVref( + ) { + uk.ac.vamsas.objects.core.Vref[] array = new uk.ac.vamsas.objects.core.Vref[0]; + return (uk.ac.vamsas.objects.core.Vref[]) this._vrefList.toArray(array); + } + + /** + * Method getVrefAsReference.Returns a reference to + * '_vrefList'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getVrefAsReference( + ) { + return this._vrefList; + } + + /** + * Method getVrefCount. + * + * @return the size of this collection + */ + public int getVrefCount( + ) { + return this._vrefList.size(); + } + + /** + * Overrides the java.lang.Object.hashCode method. + *

+ * The following steps came from Effective Java Programming + * Language Guide by Joshua Bloch, Chapter 3 + * + * @return a hash code value for the object. + */ + public int hashCode( + ) { + int result = super.hashCode(); + + long tmp; + if (_id != null) { + result = 37 * result + _id.hashCode(); + } + if (_modifiable != null) { + result = 37 * result + _modifiable.hashCode(); + } + if (_name != null) { + result = 37 * result + _name.hashCode(); + } + if (_description != null) { + result = 37 * result + _description.hashCode(); + } + if (_vrefList != null) { + result = 37 * result + _vrefList.hashCode(); + } + if (_propertyList != null) { + result = 37 * result + _propertyList.hashCode(); + } + + return result; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllProperty( + ) { + this._propertyList.clear(); + } + + /** + */ + public void removeAllVref( + ) { + this._vrefList.clear(); + } + + /** + * Method removeProperty. + * + * @param vProperty + * @return true if the object was removed from the collection. + */ + public boolean removeProperty( + final uk.ac.vamsas.objects.core.Property vProperty) { + boolean removed = _propertyList.remove(vProperty); + return removed; + } + + /** + * Method removePropertyAt. + * + * @param index + * @return the element removed from the collection + */ + public uk.ac.vamsas.objects.core.Property removePropertyAt( + final int index) { + java.lang.Object obj = this._propertyList.remove(index); + return (uk.ac.vamsas.objects.core.Property) obj; + } + + /** + * Method removeVref. + * + * @param vVref + * @return true if the object was removed from the collection. + */ + public boolean removeVref( + final uk.ac.vamsas.objects.core.Vref vVref) { + boolean removed = _vrefList.remove(vVref); + return removed; + } + + /** + * Method removeVrefAt. + * + * @param index + * @return the element removed from the collection + */ + public uk.ac.vamsas.objects.core.Vref removeVrefAt( + final int index) { + java.lang.Object obj = this._vrefList.remove(index); + return (uk.ac.vamsas.objects.core.Vref) obj; + } + + /** + * Sets the value of field 'description'. The field + * 'description' has the following description: Descriptive + * text for this node + * + * @param description the value of field 'description'. + */ + public void setDescription( + final java.lang.String description) { + this._description = description; + } + + /** + * Sets the value of field 'id'. The field 'id' has the + * following description: Primary Key for vamsas object + * referencing + * + * @param id the value of field 'id'. + */ + public void setId( + final java.lang.String id) { + this._id = id; + } + + /** + * Sets the value of field 'modifiable'. + * + * @param modifiable the value of field 'modifiable'. + */ + public void setModifiable( + final java.lang.String modifiable) { + this._modifiable = modifiable; + } + + /** + * Sets the value of field 'name'. The field 'name' has the + * following description: Short name for this node + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * + * + * @param index + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setProperty( + final int index, + final uk.ac.vamsas.objects.core.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._propertyList.size()) { + throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]"); + } + + this._propertyList.set(index, vProperty); + } + + /** + * + * + * @param vPropertyArray + */ + public void setProperty( + final uk.ac.vamsas.objects.core.Property[] vPropertyArray) { + //-- copy array + _propertyList.clear(); + + for (int i = 0; i < vPropertyArray.length; i++) { + this._propertyList.add(vPropertyArray[i]); + } + } + + /** + * Sets the value of '_propertyList' by copying the given + * Vector. All elements will be checked for type safety. + * + * @param vPropertyList the Vector to copy. + */ + public void setProperty( + final java.util.Vector vPropertyList) { + // copy vector + this._propertyList.clear(); + + this._propertyList.addAll(vPropertyList); + } + + /** + * Sets the value of '_propertyList' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param propertyVector the Vector to set. + */ + public void setPropertyAsReference( + final java.util.Vector propertyVector) { + this._propertyList = propertyVector; + } + + /** + * + * + * @param index + * @param vVref + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setVref( + final int index, + final uk.ac.vamsas.objects.core.Vref vVref) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._vrefList.size()) { + throw new IndexOutOfBoundsException("setVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]"); + } + + this._vrefList.set(index, vVref); + } + + /** + * + * + * @param vVrefArray + */ + public void setVref( + final uk.ac.vamsas.objects.core.Vref[] vVrefArray) { + //-- copy array + _vrefList.clear(); + + for (int i = 0; i < vVrefArray.length; i++) { + this._vrefList.add(vVrefArray[i]); + } + } + + /** + * Sets the value of '_vrefList' by copying the given Vector. + * All elements will be checked for type safety. + * + * @param vVrefList the Vector to copy. + */ + public void setVref( + final java.util.Vector vVrefList) { + // copy vector + this._vrefList.clear(); + + this._vrefList.addAll(vVrefList); + } + + /** + * Sets the value of '_vrefList' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param vrefVector the Vector to set. + */ + public void setVrefAsReference( + final java.util.Vector vrefVector) { + this._vrefList = vrefVector; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType + */ + public static uk.ac.vamsas.objects.core.NodeType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.NodeType.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/uk/ac/vamsas/objects/core/ReferenceType.java b/src/uk/ac/vamsas/objects/core/ReferenceType.java new file mode 100644 index 0000000..d25aea9 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/ReferenceType.java @@ -0,0 +1,443 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * base type for citing arbitrary links between vamsas objects + * + * Optional human readable description of the relationship + * + * + * @version $Revision$ $Date$ + */ +public class ReferenceType extends uk.ac.vamsas.client.Vobject +implements java.io.Serializable +{ + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * internal content storage + */ + private java.lang.String _content = ""; + + /** + * Primary Key for vamsas object referencing + */ + private java.lang.String _id; + + /** + * List of one or more vamsas object references + */ + private java.util.Vector _refs; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public ReferenceType() { + super(); + setContent(""); + this._refs = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vRefs + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addRefs( + final java.lang.Object vRefs) + throws java.lang.IndexOutOfBoundsException { + this._refs.addElement(vRefs); + } + + /** + * + * + * @param index + * @param vRefs + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addRefs( + final int index, + final java.lang.Object vRefs) + throws java.lang.IndexOutOfBoundsException { + this._refs.add(index, vRefs); + } + + /** + * Method enumerateRefs. + * + * @return an Enumeration over all java.lang.Object elements + */ + public java.util.Enumeration enumerateRefs( + ) { + return this._refs.elements(); + } + + /** + * Overrides the java.lang.Object.equals method. + * + * @param obj + * @return true if the objects are equal. + */ + public boolean equals( + final java.lang.Object obj) { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof ReferenceType) { + + ReferenceType temp = (ReferenceType)obj; + if (this._content != null) { + if (temp._content == null) return false; + else if (!(this._content.equals(temp._content))) + return false; + } + else if (temp._content != null) + return false; + if (this._id != null) { + if (temp._id == null) return false; + else if (!(this._id.equals(temp._id))) + return false; + } + else if (temp._id != null) + return false; + if (this._refs != null) { + if (temp._refs == null) return false; + else if (!(this._refs.equals(temp._refs))) + return false; + } + else if (temp._refs != null) + return false; + return true; + } + return false; + } + + /** + * Returns the value of field 'content'. The field 'content' + * has the following description: internal content storage + * + * @return the value of field 'Content'. + */ + public java.lang.String getContent( + ) { + return this._content; + } + + /** + * Returns the value of field 'id'. The field 'id' has the + * following description: Primary Key for vamsas object + * referencing + * + * @return the value of field 'Id'. + */ + public java.lang.String getId( + ) { + return this._id; + } + + /** + * Method getRefs. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.Object at the given index + */ + public java.lang.Object getRefs( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._refs.size()) { + throw new IndexOutOfBoundsException("getRefs: Index value '" + index + "' not in range [0.." + (this._refs.size() - 1) + "]"); + } + + return _refs.get(index); + } + + /** + * Method getRefs.Returns the contents of the collection in an + * Array.

Note: Just in case the collection contents are + * changing in another thread, we pass a 0-length Array of the + * correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.Object[] getRefs( + ) { + java.lang.Object[] array = new java.lang.Object[0]; + return (java.lang.Object[]) this._refs.toArray(array); + } + + /** + * Method getRefsAsReference.Returns a reference to '_refs'. No + * type checking is performed on any modifications to the + * Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getRefsAsReference( + ) { + return this._refs; + } + + /** + * Method getRefsCount. + * + * @return the size of this collection + */ + public int getRefsCount( + ) { + return this._refs.size(); + } + + /** + * Overrides the java.lang.Object.hashCode method. + *

+ * The following steps came from Effective Java Programming + * Language Guide by Joshua Bloch, Chapter 3 + * + * @return a hash code value for the object. + */ + public int hashCode( + ) { + int result = super.hashCode(); + + long tmp; + if (_content != null) { + result = 37 * result + _content.hashCode(); + } + if (_id != null) { + result = 37 * result + _id.hashCode(); + } + if (_refs != null) { + result = 37 * result + _refs.hashCode(); + } + + return result; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllRefs( + ) { + this._refs.clear(); + } + + /** + * Method removeRefs. + * + * @param vRefs + * @return true if the object was removed from the collection. + */ + public boolean removeRefs( + final java.lang.Object vRefs) { + boolean removed = _refs.remove(vRefs); + return removed; + } + + /** + * Method removeRefsAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.Object removeRefsAt( + final int index) { + java.lang.Object obj = this._refs.remove(index); + return obj; + } + + /** + * Sets the value of field 'content'. The field 'content' has + * the following description: internal content storage + * + * @param content the value of field 'content'. + */ + public void setContent( + final java.lang.String content) { + this._content = content; + } + + /** + * Sets the value of field 'id'. The field 'id' has the + * following description: Primary Key for vamsas object + * referencing + * + * @param id the value of field 'id'. + */ + public void setId( + final java.lang.String id) { + this._id = id; + } + + /** + * + * + * @param index + * @param vRefs + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setRefs( + final int index, + final java.lang.Object vRefs) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._refs.size()) { + throw new IndexOutOfBoundsException("setRefs: Index value '" + index + "' not in range [0.." + (this._refs.size() - 1) + "]"); + } + + this._refs.set(index, vRefs); + } + + /** + * + * + * @param vRefsArray + */ + public void setRefs( + final java.lang.Object[] vRefsArray) { + //-- copy array + _refs.clear(); + + for (int i = 0; i < vRefsArray.length; i++) { + this._refs.add(vRefsArray[i]); + } + } + + /** + * Sets the value of '_refs' by copying the given Vector. All + * elements will be checked for type safety. + * + * @param vRefsList the Vector to copy. + */ + public void setRefs( + final java.util.Vector vRefsList) { + // copy vector + this._refs.clear(); + + this._refs.addAll(vRefsList); + } + + /** + * Sets the value of '_refs' by setting it to the given Vector. + * No type checking is performed. + * @deprecated + * + * @param refsVector the Vector to set. + */ + public void setRefsAsReference( + final java.util.Vector refsVector) { + this._refs = refsVector; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * uk.ac.vamsas.objects.core.ReferenceType + */ + public static uk.ac.vamsas.objects.core.ReferenceType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.ReferenceType.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/uk/ac/vamsas/objects/core/Sequence.java b/src/uk/ac/vamsas/objects/core/Sequence.java index d4ff049..03ea13a 100644 --- a/src/uk/ac/vamsas/objects/core/Sequence.java +++ b/src/uk/ac/vamsas/objects/core/Sequence.java @@ -47,6 +47,13 @@ implements java.io.Serializable */ private java.util.Vector _dbRefList; + /** + * explicitly named cross reference to other objects in the + * document. + * + */ + private java.util.Vector _vxrefList; + //----------------/ //- Constructors -/ @@ -55,6 +62,7 @@ implements java.io.Serializable public Sequence() { super(); this._dbRefList = new java.util.Vector(); + this._vxrefList = new java.util.Vector(); } @@ -91,6 +99,34 @@ implements java.io.Serializable } /** + * + * + * @param vVxref + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addVxref( + final uk.ac.vamsas.objects.core.Vxref vVxref) + throws java.lang.IndexOutOfBoundsException { + this._vxrefList.addElement(vVxref); + } + + /** + * + * + * @param index + * @param vVxref + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addVxref( + final int index, + final uk.ac.vamsas.objects.core.Vxref vVxref) + throws java.lang.IndexOutOfBoundsException { + this._vxrefList.add(index, vVxref); + } + + /** * Method enumerateDbRef. * * @return an Enumeration over all @@ -102,6 +138,17 @@ implements java.io.Serializable } /** + * Method enumerateVxref. + * + * @return an Enumeration over all + * uk.ac.vamsas.objects.core.Vxref elements + */ + public java.util.Enumeration enumerateVxref( + ) { + return this._vxrefList.elements(); + } + + /** * Overrides the java.lang.Object.equals method. * * @param obj @@ -139,6 +186,13 @@ implements java.io.Serializable } else if (temp._dbRefList != null) return false; + if (this._vxrefList != null) { + if (temp._vxrefList == null) return false; + else if (!(this._vxrefList.equals(temp._vxrefList))) + return false; + } + else if (temp._vxrefList != null) + return false; return true; } return false; @@ -228,6 +282,63 @@ implements java.io.Serializable } /** + * Method getVxref. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the uk.ac.vamsas.objects.core.Vxref at + * the given index + */ + public uk.ac.vamsas.objects.core.Vxref getVxref( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._vxrefList.size()) { + throw new IndexOutOfBoundsException("getVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]"); + } + + return (uk.ac.vamsas.objects.core.Vxref) _vxrefList.get(index); + } + + /** + * Method getVxref.Returns the contents of the collection in an + * Array.

Note: Just in case the collection contents are + * changing in another thread, we pass a 0-length Array of the + * correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public uk.ac.vamsas.objects.core.Vxref[] getVxref( + ) { + uk.ac.vamsas.objects.core.Vxref[] array = new uk.ac.vamsas.objects.core.Vxref[0]; + return (uk.ac.vamsas.objects.core.Vxref[]) this._vxrefList.toArray(array); + } + + /** + * Method getVxrefAsReference.Returns a reference to + * '_vxrefList'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getVxrefAsReference( + ) { + return this._vxrefList; + } + + /** + * Method getVxrefCount. + * + * @return the size of this collection + */ + public int getVxrefCount( + ) { + return this._vxrefList.size(); + } + + /** * Overrides the java.lang.Object.hashCode method. *

* The following steps came from Effective Java Programming @@ -249,6 +360,9 @@ implements java.io.Serializable if (_dbRefList != null) { result = 37 * result + _dbRefList.hashCode(); } + if (_vxrefList != null) { + result = 37 * result + _vxrefList.hashCode(); + } return result; } @@ -308,6 +422,13 @@ implements java.io.Serializable } /** + */ + public void removeAllVxref( + ) { + this._vxrefList.clear(); + } + + /** * Method removeDbRef. * * @param vDbRef @@ -332,6 +453,30 @@ implements java.io.Serializable } /** + * Method removeVxref. + * + * @param vVxref + * @return true if the object was removed from the collection. + */ + public boolean removeVxref( + final uk.ac.vamsas.objects.core.Vxref vVxref) { + boolean removed = _vxrefList.remove(vVxref); + return removed; + } + + /** + * Method removeVxrefAt. + * + * @param index + * @return the element removed from the collection + */ + public uk.ac.vamsas.objects.core.Vxref removeVxrefAt( + final int index) { + java.lang.Object obj = this._vxrefList.remove(index); + return (uk.ac.vamsas.objects.core.Vxref) obj; + } + + /** * * * @param index @@ -418,6 +563,67 @@ implements java.io.Serializable } /** + * + * + * @param index + * @param vVxref + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setVxref( + final int index, + final uk.ac.vamsas.objects.core.Vxref vVxref) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._vxrefList.size()) { + throw new IndexOutOfBoundsException("setVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]"); + } + + this._vxrefList.set(index, vVxref); + } + + /** + * + * + * @param vVxrefArray + */ + public void setVxref( + final uk.ac.vamsas.objects.core.Vxref[] vVxrefArray) { + //-- copy array + _vxrefList.clear(); + + for (int i = 0; i < vVxrefArray.length; i++) { + this._vxrefList.add(vVxrefArray[i]); + } + } + + /** + * Sets the value of '_vxrefList' by copying the given Vector. + * All elements will be checked for type safety. + * + * @param vVxrefList the Vector to copy. + */ + public void setVxref( + final java.util.Vector vVxrefList) { + // copy vector + this._vxrefList.clear(); + + this._vxrefList.addAll(vVxrefList); + } + + /** + * Sets the value of '_vxrefList' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param vxrefVector the Vector to set. + */ + public void setVxrefAsReference( + final java.util.Vector vxrefVector) { + this._vxrefList = vxrefVector; + } + + /** * Method unmarshal. * * @param reader diff --git a/src/uk/ac/vamsas/objects/core/Tree.java b/src/uk/ac/vamsas/objects/core/Tree.java index 5019ad2..5c0e72a 100644 --- a/src/uk/ac/vamsas/objects/core/Tree.java +++ b/src/uk/ac/vamsas/objects/core/Tree.java @@ -49,6 +49,13 @@ implements java.io.Serializable private java.util.Vector _newickList; /** + * node identity and mapping data between tree representations + * and vamsas document objects + * + */ + private java.util.Vector _treenodeList; + + /** * Field _propertyList. */ private java.util.Vector _propertyList; @@ -66,6 +73,7 @@ implements java.io.Serializable public Tree() { super(); this._newickList = new java.util.Vector(); + this._treenodeList = new java.util.Vector(); this._propertyList = new java.util.Vector(); } @@ -131,6 +139,34 @@ implements java.io.Serializable } /** + * + * + * @param vTreenode + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTreenode( + final uk.ac.vamsas.objects.core.Treenode vTreenode) + throws java.lang.IndexOutOfBoundsException { + this._treenodeList.addElement(vTreenode); + } + + /** + * + * + * @param index + * @param vTreenode + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTreenode( + final int index, + final uk.ac.vamsas.objects.core.Treenode vTreenode) + throws java.lang.IndexOutOfBoundsException { + this._treenodeList.add(index, vTreenode); + } + + /** * Method enumerateNewick. * * @return an Enumeration over all @@ -153,6 +189,17 @@ implements java.io.Serializable } /** + * Method enumerateTreenode. + * + * @return an Enumeration over all + * uk.ac.vamsas.objects.core.Treenode elements + */ + public java.util.Enumeration enumerateTreenode( + ) { + return this._treenodeList.elements(); + } + + /** * Overrides the java.lang.Object.equals method. * * @param obj @@ -197,6 +244,13 @@ implements java.io.Serializable } else if (temp._newickList != null) return false; + if (this._treenodeList != null) { + if (temp._treenodeList == null) return false; + else if (!(this._treenodeList.equals(temp._treenodeList))) + return false; + } + else if (temp._treenodeList != null) + return false; if (this._propertyList != null) { if (temp._propertyList == null) return false; else if (!(this._propertyList.equals(temp._propertyList))) @@ -373,6 +427,63 @@ implements java.io.Serializable } /** + * Method getTreenode. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the uk.ac.vamsas.objects.core.Treenode + * at the given index + */ + public uk.ac.vamsas.objects.core.Treenode getTreenode( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treenodeList.size()) { + throw new IndexOutOfBoundsException("getTreenode: Index value '" + index + "' not in range [0.." + (this._treenodeList.size() - 1) + "]"); + } + + return (uk.ac.vamsas.objects.core.Treenode) _treenodeList.get(index); + } + + /** + * Method getTreenode.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public uk.ac.vamsas.objects.core.Treenode[] getTreenode( + ) { + uk.ac.vamsas.objects.core.Treenode[] array = new uk.ac.vamsas.objects.core.Treenode[0]; + return (uk.ac.vamsas.objects.core.Treenode[]) this._treenodeList.toArray(array); + } + + /** + * Method getTreenodeAsReference.Returns a reference to + * '_treenodeList'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getTreenodeAsReference( + ) { + return this._treenodeList; + } + + /** + * Method getTreenodeCount. + * + * @return the size of this collection + */ + public int getTreenodeCount( + ) { + return this._treenodeList.size(); + } + + /** * Overrides the java.lang.Object.hashCode method. *

* The following steps came from Effective Java Programming @@ -397,6 +508,9 @@ implements java.io.Serializable if (_newickList != null) { result = 37 * result + _newickList.hashCode(); } + if (_treenodeList != null) { + result = 37 * result + _treenodeList.hashCode(); + } if (_propertyList != null) { result = 37 * result + _propertyList.hashCode(); } @@ -469,6 +583,13 @@ implements java.io.Serializable } /** + */ + public void removeAllTreenode( + ) { + this._treenodeList.clear(); + } + + /** * Method removeNewick. * * @param vNewick @@ -517,6 +638,30 @@ implements java.io.Serializable } /** + * Method removeTreenode. + * + * @param vTreenode + * @return true if the object was removed from the collection. + */ + public boolean removeTreenode( + final uk.ac.vamsas.objects.core.Treenode vTreenode) { + boolean removed = _treenodeList.remove(vTreenode); + return removed; + } + + /** + * Method removeTreenodeAt. + * + * @param index + * @return the element removed from the collection + */ + public uk.ac.vamsas.objects.core.Treenode removeTreenodeAt( + final int index) { + java.lang.Object obj = this._treenodeList.remove(index); + return (uk.ac.vamsas.objects.core.Treenode) obj; + } + + /** * Sets the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object * referencing @@ -681,6 +826,67 @@ implements java.io.Serializable } /** + * + * + * @param index + * @param vTreenode + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setTreenode( + final int index, + final uk.ac.vamsas.objects.core.Treenode vTreenode) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treenodeList.size()) { + throw new IndexOutOfBoundsException("setTreenode: Index value '" + index + "' not in range [0.." + (this._treenodeList.size() - 1) + "]"); + } + + this._treenodeList.set(index, vTreenode); + } + + /** + * + * + * @param vTreenodeArray + */ + public void setTreenode( + final uk.ac.vamsas.objects.core.Treenode[] vTreenodeArray) { + //-- copy array + _treenodeList.clear(); + + for (int i = 0; i < vTreenodeArray.length; i++) { + this._treenodeList.add(vTreenodeArray[i]); + } + } + + /** + * Sets the value of '_treenodeList' by copying the given + * Vector. All elements will be checked for type safety. + * + * @param vTreenodeList the Vector to copy. + */ + public void setTreenode( + final java.util.Vector vTreenodeList) { + // copy vector + this._treenodeList.clear(); + + this._treenodeList.addAll(vTreenodeList); + } + + /** + * Sets the value of '_treenodeList' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param treenodeVector the Vector to set. + */ + public void setTreenodeAsReference( + final java.util.Vector treenodeVector) { + this._treenodeList = treenodeVector; + } + + /** * Method unmarshal. * * @param reader diff --git a/src/uk/ac/vamsas/objects/core/Treenode.java b/src/uk/ac/vamsas/objects/core/Treenode.java new file mode 100644 index 0000000..320f7de --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/Treenode.java @@ -0,0 +1,412 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * node identity and mapping data between tree representations and + * vamsas document objects + * + * + * @version $Revision$ $Date$ + */ +public class Treenode extends uk.ac.vamsas.objects.core.NodeType +implements java.io.Serializable +{ + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * reference to one or more trees containing the node being + * described. + * + */ + private java.util.Vector _treeId; + + /** + * String uniquely identifying a particular node in the + * referenced tree according to the format of the tree + * representation that is referenced. + * + */ + private java.lang.String _nodespec; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Treenode() { + super(); + this._treeId = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vTreeId + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTreeId( + final java.lang.Object vTreeId) + throws java.lang.IndexOutOfBoundsException { + this._treeId.addElement(vTreeId); + } + + /** + * + * + * @param index + * @param vTreeId + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTreeId( + final int index, + final java.lang.Object vTreeId) + throws java.lang.IndexOutOfBoundsException { + this._treeId.add(index, vTreeId); + } + + /** + * Method enumerateTreeId. + * + * @return an Enumeration over all java.lang.Object elements + */ + public java.util.Enumeration enumerateTreeId( + ) { + return this._treeId.elements(); + } + + /** + * Overrides the java.lang.Object.equals method. + * + * @param obj + * @return true if the objects are equal. + */ + public boolean equals( + final java.lang.Object obj) { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof Treenode) { + + Treenode temp = (Treenode)obj; + if (this._treeId != null) { + if (temp._treeId == null) return false; + else if (!(this._treeId.equals(temp._treeId))) + return false; + } + else if (temp._treeId != null) + return false; + if (this._nodespec != null) { + if (temp._nodespec == null) return false; + else if (!(this._nodespec.equals(temp._nodespec))) + return false; + } + else if (temp._nodespec != null) + return false; + return true; + } + return false; + } + + /** + * Returns the value of field 'nodespec'. The field 'nodespec' + * has the following description: String uniquely identifying a + * particular node in the referenced tree according to the + * format of the tree representation that is referenced. + * + * + * @return the value of field 'Nodespec'. + */ + public java.lang.String getNodespec( + ) { + return this._nodespec; + } + + /** + * Method getTreeId. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.Object at the given index + */ + public java.lang.Object getTreeId( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treeId.size()) { + throw new IndexOutOfBoundsException("getTreeId: Index value '" + index + "' not in range [0.." + (this._treeId.size() - 1) + "]"); + } + + return _treeId.get(index); + } + + /** + * Method getTreeId.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.Object[] getTreeId( + ) { + java.lang.Object[] array = new java.lang.Object[0]; + return (java.lang.Object[]) this._treeId.toArray(array); + } + + /** + * Method getTreeIdAsReference.Returns a reference to + * '_treeId'. No type checking is performed on any + * modifications to the Vector. + * + * @return a reference to the Vector backing this class + */ + public java.util.Vector getTreeIdAsReference( + ) { + return this._treeId; + } + + /** + * Method getTreeIdCount. + * + * @return the size of this collection + */ + public int getTreeIdCount( + ) { + return this._treeId.size(); + } + + /** + * Overrides the java.lang.Object.hashCode method. + *

+ * The following steps came from Effective Java Programming + * Language Guide by Joshua Bloch, Chapter 3 + * + * @return a hash code value for the object. + */ + public int hashCode( + ) { + int result = super.hashCode(); + + long tmp; + if (_treeId != null) { + result = 37 * result + _treeId.hashCode(); + } + if (_nodespec != null) { + result = 37 * result + _nodespec.hashCode(); + } + + return result; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllTreeId( + ) { + this._treeId.clear(); + } + + /** + * Method removeTreeId. + * + * @param vTreeId + * @return true if the object was removed from the collection. + */ + public boolean removeTreeId( + final java.lang.Object vTreeId) { + boolean removed = _treeId.remove(vTreeId); + return removed; + } + + /** + * Method removeTreeIdAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.Object removeTreeIdAt( + final int index) { + java.lang.Object obj = this._treeId.remove(index); + return obj; + } + + /** + * Sets the value of field 'nodespec'. The field 'nodespec' has + * the following description: String uniquely identifying a + * particular node in the referenced tree according to the + * format of the tree representation that is referenced. + * + * + * @param nodespec the value of field 'nodespec'. + */ + public void setNodespec( + final java.lang.String nodespec) { + this._nodespec = nodespec; + } + + /** + * + * + * @param index + * @param vTreeId + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setTreeId( + final int index, + final java.lang.Object vTreeId) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treeId.size()) { + throw new IndexOutOfBoundsException("setTreeId: Index value '" + index + "' not in range [0.." + (this._treeId.size() - 1) + "]"); + } + + this._treeId.set(index, vTreeId); + } + + /** + * + * + * @param vTreeIdArray + */ + public void setTreeId( + final java.lang.Object[] vTreeIdArray) { + //-- copy array + _treeId.clear(); + + for (int i = 0; i < vTreeIdArray.length; i++) { + this._treeId.add(vTreeIdArray[i]); + } + } + + /** + * Sets the value of '_treeId' by copying the given Vector. All + * elements will be checked for type safety. + * + * @param vTreeIdList the Vector to copy. + */ + public void setTreeId( + final java.util.Vector vTreeIdList) { + // copy vector + this._treeId.clear(); + + this._treeId.addAll(vTreeIdList); + } + + /** + * Sets the value of '_treeId' by setting it to the given + * Vector. No type checking is performed. + * @deprecated + * + * @param treeIdVector the Vector to set. + */ + public void setTreeIdAsReference( + final java.util.Vector treeIdVector) { + this._treeId = treeIdVector; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType + */ + public static uk.ac.vamsas.objects.core.NodeType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Treenode.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/uk/ac/vamsas/objects/core/Vref.java b/src/uk/ac/vamsas/objects/core/Vref.java new file mode 100644 index 0000000..3c79e83 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/Vref.java @@ -0,0 +1,155 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Direct associations between this node and any vamsas objects + * + * @version $Revision$ $Date$ + */ +public class Vref extends ReferenceType +implements java.io.Serializable +{ + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Vref() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Overrides the java.lang.Object.equals method. + * + * @param obj + * @return true if the objects are equal. + */ + public boolean equals( + final java.lang.Object obj) { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof Vref) { + + return true; + } + return false; + } + + /** + * Overrides the java.lang.Object.hashCode method. + *

+ * The following steps came from Effective Java Programming + * Language Guide by Joshua Bloch, Chapter 3 + * + * @return a hash code value for the object. + */ + public int hashCode( + ) { + int result = super.hashCode(); + + long tmp; + + return result; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * uk.ac.vamsas.objects.core.ReferenceType + */ + public static uk.ac.vamsas.objects.core.ReferenceType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Vref.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/uk/ac/vamsas/objects/core/Vxref.java b/src/uk/ac/vamsas/objects/core/Vxref.java new file mode 100644 index 0000000..e8e55b9 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/Vxref.java @@ -0,0 +1,157 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * explicitly named cross reference to other objects in the + * document. + * + * + * @version $Revision$ $Date$ + */ +public class Vxref extends ReferenceType +implements java.io.Serializable +{ + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Vxref() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Overrides the java.lang.Object.equals method. + * + * @param obj + * @return true if the objects are equal. + */ + public boolean equals( + final java.lang.Object obj) { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof Vxref) { + + return true; + } + return false; + } + + /** + * Overrides the java.lang.Object.hashCode method. + *

+ * The following steps came from Effective Java Programming + * Language Guide by Joshua Bloch, Chapter 3 + * + * @return a hash code value for the object. + */ + public int hashCode( + ) { + int result = super.hashCode(); + + long tmp; + + return result; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * uk.ac.vamsas.objects.core.ReferenceType + */ + public static uk.ac.vamsas.objects.core.ReferenceType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Vxref.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/uk/ac/vamsas/objects/core/descriptors/AlignmentAnnotationDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/AlignmentAnnotationDescriptor.java index f1d89d8..e7c8e9a 100644 --- a/src/uk/ac/vamsas/objects/core/descriptors/AlignmentAnnotationDescriptor.java +++ b/src/uk/ac/vamsas/objects/core/descriptors/AlignmentAnnotationDescriptor.java @@ -110,6 +110,52 @@ public class AlignmentAnnotationDescriptor extends uk.ac.vamsas.objects.core.des fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); + //-- _seqrefs + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_seqrefs", "seqrefs", org.exolab.castor.xml.NodeType.Attribute); + desc.setReference(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + AlignmentAnnotation target = (AlignmentAnnotation) object; + return target.getSeqrefs(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + AlignmentAnnotation target = (AlignmentAnnotation) object; + target.addSeqrefs( (java.lang.Object) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + AlignmentAnnotation target = (AlignmentAnnotation) object; + target.removeAllSeqrefs(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new java.lang.Object(); + } + }; + desc.setMultivalued(true); + desc.setHandler(handler); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _seqrefs + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator(); + fieldValidator.setValidator(typeValidator); + desc.setValidator(fieldValidator); + } + desc.setValidator(fieldValidator); //-- initialize element descriptors //-- _provenance diff --git a/src/uk/ac/vamsas/objects/core/descriptors/DataSetAnnotationsDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/DataSetAnnotationsDescriptor.java index 9207d74..44090ca 100644 --- a/src/uk/ac/vamsas/objects/core/descriptors/DataSetAnnotationsDescriptor.java +++ b/src/uk/ac/vamsas/objects/core/descriptors/DataSetAnnotationsDescriptor.java @@ -84,7 +84,15 @@ public class DataSetAnnotationsDescriptor extends uk.ac.vamsas.objects.core.desc { try { DataSetAnnotations target = (DataSetAnnotations) object; - target.setSeqRef( (java.lang.Object) value); + target.addSeqRef( (java.lang.Object) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + DataSetAnnotations target = (DataSetAnnotations) object; + target.removeAllSeqRef(); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } @@ -93,18 +101,19 @@ public class DataSetAnnotationsDescriptor extends uk.ac.vamsas.objects.core.desc return new java.lang.Object(); } }; + desc.setMultivalued(true); desc.setHandler(handler); desc.setRequired(true); - desc.setMultivalued(false); + desc.setMultivalued(true); addFieldDescriptor(desc); //-- validation code for: _seqRef fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); + fieldValidator.setMinOccurs(0); { //-- local scope - org.exolab.castor.xml.validators.IdRefValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.IdRefValidator(); + org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator(); fieldValidator.setValidator(typeValidator); + desc.setValidator(fieldValidator); } desc.setValidator(fieldValidator); //-- initialize element descriptors diff --git a/src/uk/ac/vamsas/objects/core/descriptors/EntryDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/EntryDescriptor.java index d6175c1..0dcf72b 100644 --- a/src/uk/ac/vamsas/objects/core/descriptors/EntryDescriptor.java +++ b/src/uk/ac/vamsas/objects/core/descriptors/EntryDescriptor.java @@ -227,7 +227,7 @@ public class EntryDescriptor extends org.exolab.castor.xml.util.XMLClassDescript } desc.setValidator(fieldValidator); //-- _date - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.types.Date.class, "_date", "Date", org.exolab.castor.xml.NodeType.Element); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.util.Date.class, "_date", "Date", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException @@ -240,15 +240,17 @@ public class EntryDescriptor extends org.exolab.castor.xml.util.XMLClassDescript { try { Entry target = (Entry) object; - target.setDate( (org.exolab.castor.types.Date) value); + target.setDate( (java.util.Date) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } public java.lang.Object newInstance(java.lang.Object parent) { - return new org.exolab.castor.types.Date(); + return new java.util.Date(); } }; + handler = new org.exolab.castor.xml.handlers.DateFieldHandler(handler); + desc.setImmutable(true); desc.setHandler(handler); desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); desc.setRequired(true); diff --git a/src/uk/ac/vamsas/objects/core/descriptors/InputDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/InputDescriptor.java index b477deb..6c30b35 100644 --- a/src/uk/ac/vamsas/objects/core/descriptors/InputDescriptor.java +++ b/src/uk/ac/vamsas/objects/core/descriptors/InputDescriptor.java @@ -120,7 +120,15 @@ public class InputDescriptor extends uk.ac.vamsas.objects.core.descriptors.Range { try { Input target = (Input) object; - target.setObjRef( (java.lang.Object) value); + target.addObjRef( (java.lang.Object) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + Input target = (Input) object; + target.removeAllObjRef(); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } @@ -129,16 +137,18 @@ public class InputDescriptor extends uk.ac.vamsas.objects.core.descriptors.Range return new java.lang.Object(); } }; + desc.setMultivalued(true); desc.setHandler(handler); - desc.setMultivalued(false); + desc.setMultivalued(true); addFieldDescriptor(desc); //-- validation code for: _objRef fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); { //-- local scope - org.exolab.castor.xml.validators.IdRefValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.IdRefValidator(); + org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator(); fieldValidator.setValidator(typeValidator); + desc.setValidator(fieldValidator); } desc.setValidator(fieldValidator); //-- initialize element descriptors diff --git a/src/uk/ac/vamsas/objects/core/descriptors/NodeTypeDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/NodeTypeDescriptor.java new file mode 100644 index 0000000..5594c98 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/descriptors/NodeTypeDescriptor.java @@ -0,0 +1,398 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import uk.ac.vamsas.objects.core.NodeType; + +/** + * Class NodeTypeDescriptor. + * + * @version $Revision$ $Date$ + */ +public class NodeTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + /** + * Field _identity. + */ + private org.exolab.castor.xml.XMLFieldDescriptor _identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public NodeTypeDescriptor() { + super(); + _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"; + _xmlName = "nodeType"; + _elementDefinition = false; + + //-- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _id + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute); + this._identity = desc; + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NodeType target = (NodeType) object; + return target.getId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NodeType target = (NodeType) object; + target.setId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new java.lang.String(); + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _id + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IdValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IdValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _modifiable + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NodeType target = (NodeType) object; + return target.getModifiable(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NodeType target = (NodeType) object; + target.setModifiable( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _modifiable + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + //-- _name + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NodeType target = (NodeType) object; + return target.getName(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NodeType target = (NodeType) object; + target.setName( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _name + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _description + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NodeType target = (NodeType) object; + return target.getDescription(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NodeType target = (NodeType) object; + target.setDescription( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _description + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _vrefList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Vref.class, "_vrefList", "vref", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NodeType target = (NodeType) object; + return target.getVref(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NodeType target = (NodeType) object; + target.addVref( (uk.ac.vamsas.objects.core.Vref) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + NodeType target = (NodeType) object; + target.removeAllVref(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new uk.ac.vamsas.objects.core.Vref(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _vrefList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); + //-- _propertyList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NodeType target = (NodeType) object; + return target.getProperty(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NodeType target = (NodeType) object; + target.addProperty( (uk.ac.vamsas.objects.core.Property) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + NodeType target = (NodeType) object; + target.removeAllProperty(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new uk.ac.vamsas.objects.core.Property(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _propertyList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return _identity; + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return uk.ac.vamsas.objects.core.NodeType.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/uk/ac/vamsas/objects/core/descriptors/ReferenceTypeDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/ReferenceTypeDescriptor.java new file mode 100644 index 0000000..762e3c2 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/descriptors/ReferenceTypeDescriptor.java @@ -0,0 +1,280 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import uk.ac.vamsas.objects.core.ReferenceType; + +/** + * Class ReferenceTypeDescriptor. + * + * @version $Revision$ $Date$ + */ +public class ReferenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + /** + * Field _identity. + */ + private org.exolab.castor.xml.XMLFieldDescriptor _identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public ReferenceTypeDescriptor() { + super(); + _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"; + _xmlName = "referenceType"; + _elementDefinition = false; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- _content + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + ReferenceType target = (ReferenceType) object; + return target.getContent(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + ReferenceType target = (ReferenceType) object; + target.setContent( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + addFieldDescriptor(desc); + + //-- validation code for: _content + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- initialize attribute descriptors + + //-- _id + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute); + this._identity = desc; + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + ReferenceType target = (ReferenceType) object; + return target.getId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + ReferenceType target = (ReferenceType) object; + target.setId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new java.lang.String(); + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _id + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IdValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IdValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _refs + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_refs", "refs", org.exolab.castor.xml.NodeType.Attribute); + desc.setReference(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + ReferenceType target = (ReferenceType) object; + return target.getRefs(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + ReferenceType target = (ReferenceType) object; + target.addRefs( (java.lang.Object) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + ReferenceType target = (ReferenceType) object; + target.removeAllRefs(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new java.lang.Object(); + } + }; + desc.setMultivalued(true); + desc.setHandler(handler); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _refs + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator(); + fieldValidator.setValidator(typeValidator); + desc.setValidator(fieldValidator); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return _identity; + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return uk.ac.vamsas.objects.core.ReferenceType.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/uk/ac/vamsas/objects/core/descriptors/SequenceDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/SequenceDescriptor.java index 2cf4e01..047ea50 100644 --- a/src/uk/ac/vamsas/objects/core/descriptors/SequenceDescriptor.java +++ b/src/uk/ac/vamsas/objects/core/descriptors/SequenceDescriptor.java @@ -188,6 +188,48 @@ public class SequenceDescriptor extends uk.ac.vamsas.objects.core.descriptors.Se { //-- local scope } desc.setValidator(fieldValidator); + //-- _vxrefList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Vxref.class, "_vxrefList", "vxref", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Sequence target = (Sequence) object; + return target.getVxref(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Sequence target = (Sequence) object; + target.addVxref( (uk.ac.vamsas.objects.core.Vxref) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + Sequence target = (Sequence) object; + target.removeAllVxref(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new uk.ac.vamsas.objects.core.Vxref(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _vxrefList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); } diff --git a/src/uk/ac/vamsas/objects/core/descriptors/TreeDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/TreeDescriptor.java index 364fdfe..e05b6da 100644 --- a/src/uk/ac/vamsas/objects/core/descriptors/TreeDescriptor.java +++ b/src/uk/ac/vamsas/objects/core/descriptors/TreeDescriptor.java @@ -224,6 +224,48 @@ public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescripto { //-- local scope } desc.setValidator(fieldValidator); + //-- _treenodeList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Treenode.class, "_treenodeList", "treenode", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Tree target = (Tree) object; + return target.getTreenode(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Tree target = (Tree) object; + target.addTreenode( (uk.ac.vamsas.objects.core.Treenode) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + Tree target = (Tree) object; + target.removeAllTreenode(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new uk.ac.vamsas.objects.core.Treenode(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _treenodeList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); //-- _propertyList desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { diff --git a/src/uk/ac/vamsas/objects/core/descriptors/TreenodeDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/TreenodeDescriptor.java new file mode 100644 index 0000000..d113459 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/descriptors/TreenodeDescriptor.java @@ -0,0 +1,249 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import uk.ac.vamsas.objects.core.Treenode; + +/** + * Class TreenodeDescriptor. + * + * @version $Revision$ $Date$ + */ +public class TreenodeDescriptor extends uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + /** + * Field _identity. + */ + private org.exolab.castor.xml.XMLFieldDescriptor _identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public TreenodeDescriptor() { + super(); + setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor()); + _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"; + _xmlName = "treenode"; + _elementDefinition = true; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _treeId + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_treeId", "treeId", org.exolab.castor.xml.NodeType.Attribute); + desc.setReference(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Treenode target = (Treenode) object; + return target.getTreeId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Treenode target = (Treenode) object; + target.addTreeId( (java.lang.Object) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + Treenode target = (Treenode) object; + target.removeAllTreeId(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new java.lang.Object(); + } + }; + desc.setMultivalued(true); + desc.setHandler(handler); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _treeId + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator(); + fieldValidator.setValidator(typeValidator); + desc.setValidator(fieldValidator); + } + desc.setValidator(fieldValidator); + //-- _nodespec + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_nodespec", "nodespec", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Treenode target = (Treenode) object; + return target.getNodespec(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Treenode target = (Treenode) object; + target.setNodespec( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _nodespec + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + if (_identity == null) { + return super.getIdentity(); + } + return _identity; + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return uk.ac.vamsas.objects.core.Treenode.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/uk/ac/vamsas/objects/core/descriptors/VrefDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/VrefDescriptor.java new file mode 100644 index 0000000..b150b93 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/descriptors/VrefDescriptor.java @@ -0,0 +1,159 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import uk.ac.vamsas.objects.core.Vref; + +/** + * Class VrefDescriptor. + * + * @version $Revision$ $Date$ + */ +public class VrefDescriptor extends uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + /** + * Field _identity. + */ + private org.exolab.castor.xml.XMLFieldDescriptor _identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public VrefDescriptor() { + super(); + setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor()); + _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"; + _xmlName = "vref"; + _elementDefinition = true; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + if (_identity == null) { + return super.getIdentity(); + } + return _identity; + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return uk.ac.vamsas.objects.core.Vref.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/uk/ac/vamsas/objects/core/descriptors/VxrefDescriptor.java b/src/uk/ac/vamsas/objects/core/descriptors/VxrefDescriptor.java new file mode 100644 index 0000000..aa83139 --- /dev/null +++ b/src/uk/ac/vamsas/objects/core/descriptors/VxrefDescriptor.java @@ -0,0 +1,159 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package uk.ac.vamsas.objects.core.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import uk.ac.vamsas.objects.core.Vxref; + +/** + * Class VxrefDescriptor. + * + * @version $Revision$ $Date$ + */ +public class VxrefDescriptor extends uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + /** + * Field _identity. + */ + private org.exolab.castor.xml.XMLFieldDescriptor _identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public VxrefDescriptor() { + super(); + setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor()); + _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes"; + _xmlName = "vxref"; + _elementDefinition = true; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + if (_identity == null) { + return super.getIdentity(); + } + return _identity; + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return uk.ac.vamsas.objects.core.Vxref.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/uk/ac/vamsas/objects/utils/ProvenanceStuff.java b/src/uk/ac/vamsas/objects/utils/ProvenanceStuff.java index f9cebb4..3c675dc 100644 --- a/src/uk/ac/vamsas/objects/utils/ProvenanceStuff.java +++ b/src/uk/ac/vamsas/objects/utils/ProvenanceStuff.java @@ -28,7 +28,7 @@ public class ProvenanceStuff { e.setApp(app); e.setAction(action); e.setUser(user); - e.setDate(new org.exolab.castor.types.Date(new Date())); + e.setDate(new Date()); return e; } public static Provenance newProvenance(Entry entry) { diff --git a/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasClient.java b/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasClient.java index 860f3af..d4b9ec0 100644 --- a/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasClient.java +++ b/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasClient.java @@ -122,7 +122,7 @@ public class VamsasClient extends ArchiveClient { uk.ac.vamsas.objects.core.Entry pentry = new uk.ac.vamsas.objects.core.Entry(); pentry.setUser(this.getProvenanceUser()); pentry.setApp(this.getClientHandle().getClientName()); - pentry.setDate(new org.exolab.castor.types.Date(new java.util.Date())); + pentry.setDate(new java.util.Date()); pentry.setAction("created"); return pentry; } diff --git a/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java b/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java index 3f82af2..aecf14f 100644 --- a/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java +++ b/src/uk/ac/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java @@ -316,7 +316,7 @@ public class VamsasDatastore { entry.setAction(action); else entry.setAction("created."); - entry.setDate(new org.exolab.castor.types.Date(new java.util.Date())); + entry.setDate(new java.util.Date()); entry.setUser(this.provEntry.getUser()); return entry; } -- 1.7.10.2