From: jprocter Date: Tue, 20 Sep 2005 10:13:56 +0000 (+0000) Subject: objects from refactored schema. X-Git-Tag: Release_0.2~483 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c062fe4c183d567877484f0229631dc555ddc9f5;p=vamsas.git objects from refactored schema. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@37 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/org/vamsas/objects/core/.castor.cdr b/src/org/vamsas/objects/core/.castor.cdr index 415b24d..ce4c376 100644 --- a/src/org/vamsas/objects/core/.castor.cdr +++ b/src/org/vamsas/objects/core/.castor.cdr @@ -1,20 +1,18 @@ -- listing properties -- -org.vamsas.objects.core.Tree=org.vamsas.objects.core.TreeDescriptor -org.vamsas.objects.core.Provenance=org.vamsas.objects.core.ProvenanceDes... -org.vamsas.objects.core.SequenceType=org.vamsas.objects.core.SequenceTypeD... org.vamsas.objects.core.ProvenanceItem=org.vamsas.objects.core.ProvenanceIte... -org.vamsas.objects.core.TreeType=org.vamsas.objects.core.TreeTypeDescr... -org.vamsas.objects.core.AnnotationElement=org.vamsas.objects.core.AnnotationEle... -org.vamsas.objects.core.AlignmentSequence=org.vamsas.objects.core.AlignmentSequ... -org.vamsas.objects.core.Alignment=org.vamsas.objects.core.AlignmentDesc... -org.vamsas.objects.core.DbRef=org.vamsas.objects.core.DbRefDescriptor -org.vamsas.objects.core.SequenceSetAnnotations=org.vamsas.objects.core.SequenceSetAn... -org.vamsas.objects.core.Application=org.vamsas.objects.core.ApplicationDe... -org.vamsas.objects.core.VAMSAS=org.vamsas.objects.core.VAMSASDescriptor +org.vamsas.objects.core.AlignmentAnnotations=org.vamsas.objects.core.AlignmentAnno... +org.vamsas.objects.core.Tree=org.vamsas.objects.core.TreeDescriptor org.vamsas.objects.core.Sequence=org.vamsas.objects.core.SequenceDescr... +org.vamsas.objects.core.AnnotationElement=org.vamsas.objects.core.AnnotationEle... org.vamsas.objects.core.LockFile=org.vamsas.objects.core.LockFileDescr... org.vamsas.objects.core.Entry=org.vamsas.objects.core.EntryDescriptor +org.vamsas.objects.core.SequenceType=org.vamsas.objects.core.SequenceTypeD... +org.vamsas.objects.core.VAMSAS=org.vamsas.objects.core.VAMSASDescriptor org.vamsas.objects.core.SequenceSet=org.vamsas.objects.core.SequenceSetDe... +org.vamsas.objects.core.DbRef=org.vamsas.objects.core.DbRefDescriptor org.vamsas.objects.core.ApplicationData=org.vamsas.objects.core.ApplicationDa... -org.vamsas.objects.core.AlignmentAnnotations=org.vamsas.objects.core.AlignmentAnno... -org.vamsas.objects.core.Dendro=org.vamsas.objects.core.DendroDescriptor +org.vamsas.objects.core.Application=org.vamsas.objects.core.ApplicationDe... +org.vamsas.objects.core.Provenance=org.vamsas.objects.core.ProvenanceDes... +org.vamsas.objects.core.AlignmentSequence=org.vamsas.objects.core.AlignmentSequ... +org.vamsas.objects.core.Alignment=org.vamsas.objects.core.AlignmentDesc... +org.vamsas.objects.core.SequenceSetAnnotations=org.vamsas.objects.core.SequenceSetAn... diff --git a/src/org/vamsas/objects/core/AlignmentDescriptor.java b/src/org/vamsas/objects/core/AlignmentDescriptor.java index 8e20b93..684f619 100644 --- a/src/org/vamsas/objects/core/AlignmentDescriptor.java +++ b/src/org/vamsas/objects/core/AlignmentDescriptor.java @@ -103,7 +103,7 @@ public class AlignmentDescriptor extends org.exolab.castor.xml.util.XMLClassDesc } desc.setValidator(fieldValidator); //-- _treeList - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "tree", org.exolab.castor.xml.NodeType.Element); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException diff --git a/src/org/vamsas/objects/core/Dendro.java b/src/org/vamsas/objects/core/Dendro.java deleted file mode 100644 index eb04f13..0000000 --- a/src/org/vamsas/objects/core/Dendro.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This class was automatically generated with - * Castor 0.9.9M2, using an XML - * Schema. - * $Id$ - */ - -package org.vamsas.objects.core; - - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; - -/** - * Class Dendro. - * - * @version $Revision$ $Date$ - */ -public class Dendro extends TreeType -implements java.io.Serializable -{ - - - //----------------/ - //- Constructors -/ - //----------------/ - - public Dendro() - { - super(); - } //-- org.vamsas.objects.core.Dendro() - - - //-----------/ - //- Methods -/ - //-----------/ - - /** - * Note: hashCode() has not been overriden - * - * @param obj - * @return boolean - */ - public boolean equals(java.lang.Object obj) - { - if ( this == obj ) - return true; - - if (super.equals(obj)==false) - return false; - - if (obj instanceof Dendro) { - - Dendro temp = (Dendro)obj; - return true; - } - return false; - } //-- boolean equals(java.lang.Object) - - /** - * Method isValid - * - * - * - * @return boolean - */ - public boolean isValid() - { - try { - validate(); - } - catch (org.exolab.castor.xml.ValidationException vex) { - return false; - } - return true; - } //-- boolean isValid() - - /** - * Method marshal - * - * - * - * @param out - */ - public void marshal(java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException - { - - Marshaller.marshal(this, out); - } //-- void marshal(java.io.Writer) - - /** - * Method marshal - * - * - * - * @param handler - */ - public void marshal(org.xml.sax.ContentHandler handler) - throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException - { - - Marshaller.marshal(this, handler); - } //-- void marshal(org.xml.sax.ContentHandler) - - /** - * Method unmarshal - * - * - * - * @param reader - * @return Dendro - */ - public static org.vamsas.objects.core.Dendro unmarshal(java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException - { - return (org.vamsas.objects.core.Dendro) Unmarshaller.unmarshal(org.vamsas.objects.core.Dendro.class, reader); - } //-- org.vamsas.objects.core.Dendro unmarshal(java.io.Reader) - - /** - * Method validate - * - */ - public void validate() - throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } //-- void validate() - -} diff --git a/src/org/vamsas/objects/core/DendroDescriptor.java b/src/org/vamsas/objects/core/DendroDescriptor.java deleted file mode 100644 index 1b3cc2f..0000000 --- a/src/org/vamsas/objects/core/DendroDescriptor.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * This class was automatically generated with - * Castor 0.9.9M2, using an XML - * Schema. - * $Id$ - */ - -package org.vamsas.objects.core; - - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - -/** - * Class DendroDescriptor. - * - * @version $Revision$ $Date$ - */ -public class DendroDescriptor extends TreeTypeDescriptor { - - - //--------------------------/ - //- Class/Member Variables -/ - //--------------------------/ - - /** - * 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 DendroDescriptor() - { - super(); - setExtendsWithoutFlatten(new TreeTypeDescriptor()); - nsURI = "http://www.vamsas.org"; - xmlName = "Dendro"; - } //-- org.vamsas.objects.core.DendroDescriptor() - - - //-----------/ - //- Methods -/ - //-----------/ - - /** - * Method getAccessMode - * - * - * - * @return AccessMode - */ - public org.exolab.castor.mapping.AccessMode getAccessMode() - { - return null; - } //-- org.exolab.castor.mapping.AccessMode getAccessMode() - - /** - * Method getExtends - * - * - * - * @return ClassDescriptor - */ - public org.exolab.castor.mapping.ClassDescriptor getExtends() - { - return super.getExtends(); - } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() - - /** - * Method getIdentity - * - * - * - * @return FieldDescriptor - */ - public org.exolab.castor.mapping.FieldDescriptor getIdentity() - { - if (identity == null) - return super.getIdentity(); - return identity; - } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() - - /** - * Method getJavaClass - * - * - * - * @return Class - */ - public java.lang.Class getJavaClass() - { - return org.vamsas.objects.core.Dendro.class; - } //-- java.lang.Class getJavaClass() - - /** - * Method getNameSpacePrefix - * - * - * - * @return String - */ - public java.lang.String getNameSpacePrefix() - { - return nsPrefix; - } //-- java.lang.String getNameSpacePrefix() - - /** - * Method getNameSpaceURI - * - * - * - * @return String - */ - public java.lang.String getNameSpaceURI() - { - return nsURI; - } //-- java.lang.String getNameSpaceURI() - - /** - * Method getValidator - * - * - * - * @return TypeValidator - */ - public org.exolab.castor.xml.TypeValidator getValidator() - { - return this; - } //-- org.exolab.castor.xml.TypeValidator getValidator() - - /** - * Method getXMLName - * - * - * - * @return String - */ - public java.lang.String getXMLName() - { - return xmlName; - } //-- java.lang.String getXMLName() - -} diff --git a/src/org/vamsas/objects/core/SequenceSet.java b/src/org/vamsas/objects/core/SequenceSet.java index f41fdc0..816da66 100644 --- a/src/org/vamsas/objects/core/SequenceSet.java +++ b/src/org/vamsas/objects/core/SequenceSet.java @@ -73,9 +73,9 @@ implements java.io.Serializable private java.util.Vector _alignmentList; /** - * Field _tree + * Field _treeList */ - private org.vamsas.objects.core.Tree _tree; + private java.util.Vector _treeList; /** * Field _provenance @@ -93,6 +93,7 @@ implements java.io.Serializable _sequenceList = new Vector(); _sequenceSetAnnotationsList = new Vector(); _alignmentList = new Vector(); + _treeList = new Vector(); } //-- org.vamsas.objects.core.SequenceSet() @@ -182,6 +183,33 @@ implements java.io.Serializable } //-- void addSequenceSetAnnotations(int, org.vamsas.objects.core.SequenceSetAnnotations) /** + * Method addTree + * + * + * + * @param vTree + */ + public void addTree(org.vamsas.objects.core.Tree vTree) + throws java.lang.IndexOutOfBoundsException + { + _treeList.addElement(vTree); + } //-- void addTree(org.vamsas.objects.core.Tree) + + /** + * Method addTree + * + * + * + * @param index + * @param vTree + */ + public void addTree(int index, org.vamsas.objects.core.Tree vTree) + throws java.lang.IndexOutOfBoundsException + { + _treeList.insertElementAt(vTree, index); + } //-- void addTree(int, org.vamsas.objects.core.Tree) + + /** * Method deleteAligned * */ @@ -227,6 +255,18 @@ implements java.io.Serializable } //-- java.util.Enumeration enumerateSequenceSetAnnotations() /** + * Method enumerateTree + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateTree() + { + return _treeList.elements(); + } //-- java.util.Enumeration enumerateTree() + + /** * Note: hashCode() has not been overriden * * @param obj @@ -282,12 +322,12 @@ implements java.io.Serializable } else if (temp._alignmentList != null) return false; - if (this._tree != null) { - if (temp._tree == null) return false; - else if (!(this._tree.equals(temp._tree))) + if (this._treeList != null) { + if (temp._treeList == null) return false; + else if (!(this._treeList.equals(temp._treeList))) return false; } - else if (temp._tree != null) + else if (temp._treeList != null) return false; if (this._provenance != null) { if (temp._provenance == null) return false; @@ -490,15 +530,52 @@ implements java.io.Serializable } //-- int getSequenceSetAnnotationsCount() /** - * Returns the value of field 'tree'. + * Method getTree + * + * + * + * @param index + * @return Tree + */ + public org.vamsas.objects.core.Tree getTree(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _treeList.size())) { + throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]"); + } + + return (org.vamsas.objects.core.Tree) _treeList.elementAt(index); + } //-- org.vamsas.objects.core.Tree getTree(int) + + /** + * Method getTree + * + * * * @return Tree - * @return the value of field 'tree'. */ - public org.vamsas.objects.core.Tree getTree() + public org.vamsas.objects.core.Tree[] getTree() { - return this._tree; - } //-- org.vamsas.objects.core.Tree getTree() + int size = _treeList.size(); + org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index); + } + return mArray; + } //-- org.vamsas.objects.core.Tree[] getTree() + + /** + * Method getTreeCount + * + * + * + * @return int + */ + public int getTreeCount() + { + return _treeList.size(); + } //-- int getTreeCount() /** * Method hasAligned @@ -601,6 +678,15 @@ implements java.io.Serializable } //-- void removeAllSequenceSetAnnotations() /** + * Method removeAllTree + * + */ + public void removeAllTree() + { + _treeList.removeAllElements(); + } //-- void removeAllTree() + + /** * Method removeSequence * * @@ -631,6 +717,21 @@ implements java.io.Serializable } //-- org.vamsas.objects.core.SequenceSetAnnotations removeSequenceSetAnnotations(int) /** + * Method removeTree + * + * + * + * @param index + * @return Tree + */ + public org.vamsas.objects.core.Tree removeTree(int index) + { + java.lang.Object obj = _treeList.elementAt(index); + _treeList.removeElementAt(index); + return (org.vamsas.objects.core.Tree) obj; + } //-- org.vamsas.objects.core.Tree removeTree(int) + + /** * Sets the value of field 'aligned'. * * @param aligned the value of field 'aligned'. @@ -774,13 +875,37 @@ implements java.io.Serializable } //-- void setSequenceSetAnnotations(org.vamsas.objects.core.SequenceSetAnnotations) /** - * Sets the value of field 'tree'. + * Method setTree + * + * + * + * @param index + * @param vTree + */ + public void setTree(int index, org.vamsas.objects.core.Tree vTree) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _treeList.size())) { + throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]"); + } + _treeList.setElementAt(vTree, index); + } //-- void setTree(int, org.vamsas.objects.core.Tree) + + /** + * Method setTree + * + * * - * @param tree the value of field 'tree'. + * @param treeArray */ - public void setTree(org.vamsas.objects.core.Tree tree) + public void setTree(org.vamsas.objects.core.Tree[] treeArray) { - this._tree = tree; + //-- copy array + _treeList.removeAllElements(); + for (int i = 0; i < treeArray.length; i++) { + _treeList.addElement(treeArray[i]); + } } //-- void setTree(org.vamsas.objects.core.Tree) /** diff --git a/src/org/vamsas/objects/core/SequenceSetDescriptor.java b/src/org/vamsas/objects/core/SequenceSetDescriptor.java index 0f05d2a..5c4242a 100644 --- a/src/org/vamsas/objects/core/SequenceSetDescriptor.java +++ b/src/org/vamsas/objects/core/SequenceSetDescriptor.java @@ -289,8 +289,8 @@ public class SequenceSetDescriptor extends org.exolab.castor.xml.util.XMLClassDe { //-- local scope } desc.setValidator(fieldValidator); - //-- _tree - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_tree", "tree", org.exolab.castor.xml.NodeType.Element); + //-- _treeList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException @@ -303,7 +303,7 @@ public class SequenceSetDescriptor extends org.exolab.castor.xml.util.XMLClassDe { try { SequenceSet target = (SequenceSet) object; - target.setTree( (org.vamsas.objects.core.Tree) value); + target.addTree( (org.vamsas.objects.core.Tree) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -315,13 +315,12 @@ public class SequenceSetDescriptor extends org.exolab.castor.xml.util.XMLClassDe }; desc.setHandler(handler); desc.setNameSpaceURI("http://www.vamsas.org"); - desc.setRequired(true); - desc.setMultivalued(false); + desc.setMultivalued(true); addFieldDescriptor(desc); - //-- validation code for: _tree + //-- validation code for: _treeList fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); + fieldValidator.setMinOccurs(0); { //-- local scope } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/Tree.java b/src/org/vamsas/objects/core/Tree.java index 8290635..ddb22b8 100644 --- a/src/org/vamsas/objects/core/Tree.java +++ b/src/org/vamsas/objects/core/Tree.java @@ -15,6 +15,8 @@ import java.io.IOException; import java.io.Reader; import java.io.Serializable; import java.io.Writer; +import java.util.Enumeration; +import java.util.Vector; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -26,11 +28,31 @@ import org.xml.sax.ContentHandler; * * @version $Revision$ $Date$ */ -public class Tree extends TreeType +public class Tree extends org.vamsas.client.object implements java.io.Serializable { + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _id + */ + private java.lang.String _id; + + /** + * Field _newickFormatList + */ + private java.util.Vector _newickFormatList; + + /** + * Field _provenance + */ + private org.vamsas.objects.core.Provenance _provenance; + + //----------------/ //- Constructors -/ //----------------/ @@ -38,6 +60,7 @@ implements java.io.Serializable public Tree() { super(); + _newickFormatList = new Vector(); } //-- org.vamsas.objects.core.Tree() @@ -46,6 +69,45 @@ implements java.io.Serializable //-----------/ /** + * Method addNewickFormat + * + * + * + * @param vNewickFormat + */ + public void addNewickFormat(java.lang.String vNewickFormat) + throws java.lang.IndexOutOfBoundsException + { + _newickFormatList.addElement(vNewickFormat); + } //-- void addNewickFormat(java.lang.String) + + /** + * Method addNewickFormat + * + * + * + * @param index + * @param vNewickFormat + */ + public void addNewickFormat(int index, java.lang.String vNewickFormat) + throws java.lang.IndexOutOfBoundsException + { + _newickFormatList.insertElementAt(vNewickFormat, index); + } //-- void addNewickFormat(int, java.lang.String) + + /** + * Method enumerateNewickFormat + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateNewickFormat() + { + return _newickFormatList.elements(); + } //-- java.util.Enumeration enumerateNewickFormat() + + /** * Note: hashCode() has not been overriden * * @param obj @@ -62,12 +124,103 @@ implements java.io.Serializable if (obj instanceof Tree) { Tree temp = (Tree)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._newickFormatList != null) { + if (temp._newickFormatList == null) return false; + else if (!(this._newickFormatList.equals(temp._newickFormatList))) + return false; + } + else if (temp._newickFormatList != null) + return false; + if (this._provenance != null) { + if (temp._provenance == null) return false; + else if (!(this._provenance.equals(temp._provenance))) + return false; + } + else if (temp._provenance != null) + return false; return true; } return false; } //-- boolean equals(java.lang.Object) /** + * Returns the value of field 'id'. + * + * @return String + * @return the value of field 'id'. + */ + public java.lang.String getId() + { + return this._id; + } //-- java.lang.String getId() + + /** + * Method getNewickFormat + * + * + * + * @param index + * @return String + */ + public java.lang.String getNewickFormat(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _newickFormatList.size())) { + throw new IndexOutOfBoundsException("getNewickFormat: Index value '"+index+"' not in range [0.."+_newickFormatList.size()+ "]"); + } + + return (String)_newickFormatList.elementAt(index); + } //-- java.lang.String getNewickFormat(int) + + /** + * Method getNewickFormat + * + * + * + * @return String + */ + public java.lang.String[] getNewickFormat() + { + int size = _newickFormatList.size(); + java.lang.String[] mArray = new java.lang.String[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (String)_newickFormatList.elementAt(index); + } + return mArray; + } //-- java.lang.String[] getNewickFormat() + + /** + * Method getNewickFormatCount + * + * + * + * @return int + */ + public int getNewickFormatCount() + { + return _newickFormatList.size(); + } //-- int getNewickFormatCount() + + /** + * Returns the value of field 'provenance'. + * + * @return Provenance + * @return the value of field 'provenance'. + */ + public org.vamsas.objects.core.Provenance getProvenance() + { + return this._provenance; + } //-- org.vamsas.objects.core.Provenance getProvenance() + + /** * Method isValid * * @@ -114,6 +267,84 @@ implements java.io.Serializable } //-- void marshal(org.xml.sax.ContentHandler) /** + * Method removeAllNewickFormat + * + */ + public void removeAllNewickFormat() + { + _newickFormatList.removeAllElements(); + } //-- void removeAllNewickFormat() + + /** + * Method removeNewickFormat + * + * + * + * @param index + * @return String + */ + public java.lang.String removeNewickFormat(int index) + { + java.lang.Object obj = _newickFormatList.elementAt(index); + _newickFormatList.removeElementAt(index); + return (String)obj; + } //-- java.lang.String removeNewickFormat(int) + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId(java.lang.String id) + { + this._id = id; + } //-- void setId(java.lang.String) + + /** + * Method setNewickFormat + * + * + * + * @param index + * @param vNewickFormat + */ + public void setNewickFormat(int index, java.lang.String vNewickFormat) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _newickFormatList.size())) { + throw new IndexOutOfBoundsException("setNewickFormat: Index value '"+index+"' not in range [0.."+_newickFormatList.size()+ "]"); + } + _newickFormatList.setElementAt(vNewickFormat, index); + } //-- void setNewickFormat(int, java.lang.String) + + /** + * Method setNewickFormat + * + * + * + * @param newickFormatArray + */ + public void setNewickFormat(java.lang.String[] newickFormatArray) + { + //-- copy array + _newickFormatList.removeAllElements(); + for (int i = 0; i < newickFormatArray.length; i++) { + _newickFormatList.addElement(newickFormatArray[i]); + } + } //-- void setNewickFormat(java.lang.String) + + /** + * Sets the value of field 'provenance'. + * + * @param provenance the value of field 'provenance'. + */ + public void setProvenance(org.vamsas.objects.core.Provenance provenance) + { + this._provenance = provenance; + } //-- void setProvenance(org.vamsas.objects.core.Provenance) + + /** * Method unmarshal * * diff --git a/src/org/vamsas/objects/core/TreeDescriptor.java b/src/org/vamsas/objects/core/TreeDescriptor.java index b0012ef..af3b115 100644 --- a/src/org/vamsas/objects/core/TreeDescriptor.java +++ b/src/org/vamsas/objects/core/TreeDescriptor.java @@ -21,7 +21,7 @@ import org.exolab.castor.xml.validators.*; * * @version $Revision$ $Date$ */ -public class TreeDescriptor extends TreeTypeDescriptor { +public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { //--------------------------/ @@ -56,9 +56,128 @@ public class TreeDescriptor extends TreeTypeDescriptor { public TreeDescriptor() { super(); - setExtendsWithoutFlatten(new TreeTypeDescriptor()); nsURI = "http://www.vamsas.org"; - xmlName = "tree"; + xmlName = "Tree"; + + //-- 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 + { + Tree target = (Tree) object; + return target.getId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Tree target = (Tree) 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 + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + //-- _newickFormatList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_newickFormatList", "newickFormat", 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 + { + Tree target = (Tree) object; + return target.getNewickFormat(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Tree target = (Tree) object; + target.addNewickFormat( (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.org"); + desc.setRequired(true); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _newickFormatList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + StringValidator typeValidator = new StringValidator(); + typeValidator.setWhiteSpace("preserve"); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _provenance + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Tree target = (Tree) object; + return target.getProvenance(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Tree target = (Tree) object; + target.setProvenance( (org.vamsas.objects.core.Provenance) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return new org.vamsas.objects.core.Provenance(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.org"); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _provenance + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + } + desc.setValidator(fieldValidator); } //-- org.vamsas.objects.core.TreeDescriptor() @@ -87,7 +206,7 @@ public class TreeDescriptor extends TreeTypeDescriptor { */ public org.exolab.castor.mapping.ClassDescriptor getExtends() { - return super.getExtends(); + return null; } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() /** @@ -99,8 +218,6 @@ public class TreeDescriptor extends TreeTypeDescriptor { */ public org.exolab.castor.mapping.FieldDescriptor getIdentity() { - if (identity == null) - return super.getIdentity(); return identity; } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() diff --git a/src/org/vamsas/objects/core/VAMSAS.java b/src/org/vamsas/objects/core/VAMSAS.java index 12a81f2..0cd3f56 100644 --- a/src/org/vamsas/objects/core/VAMSAS.java +++ b/src/org/vamsas/objects/core/VAMSAS.java @@ -43,9 +43,9 @@ implements java.io.Serializable private java.lang.String _id; /** - * Field _dendroList + * Field _treeList */ - private java.util.Vector _dendroList; + private java.util.Vector _treeList; /** * Field _sequenceSetList @@ -60,7 +60,7 @@ implements java.io.Serializable public VAMSAS() { super(); - _dendroList = new Vector(); + _treeList = new Vector(); _sequenceSetList = new Vector(); } //-- org.vamsas.objects.core.VAMSAS() @@ -70,82 +70,82 @@ implements java.io.Serializable //-----------/ /** - * Method addDendro + * Method addSequenceSet * * * - * @param vDendro + * @param vSequenceSet */ - public void addDendro(org.vamsas.objects.core.Dendro vDendro) + public void addSequenceSet(org.vamsas.objects.core.SequenceSet vSequenceSet) throws java.lang.IndexOutOfBoundsException { - _dendroList.addElement(vDendro); - } //-- void addDendro(org.vamsas.objects.core.Dendro) + _sequenceSetList.addElement(vSequenceSet); + } //-- void addSequenceSet(org.vamsas.objects.core.SequenceSet) /** - * Method addDendro + * Method addSequenceSet * * * * @param index - * @param vDendro + * @param vSequenceSet */ - public void addDendro(int index, org.vamsas.objects.core.Dendro vDendro) + public void addSequenceSet(int index, org.vamsas.objects.core.SequenceSet vSequenceSet) throws java.lang.IndexOutOfBoundsException { - _dendroList.insertElementAt(vDendro, index); - } //-- void addDendro(int, org.vamsas.objects.core.Dendro) + _sequenceSetList.insertElementAt(vSequenceSet, index); + } //-- void addSequenceSet(int, org.vamsas.objects.core.SequenceSet) /** - * Method addSequenceSet + * Method addTree * * * - * @param vSequenceSet + * @param vTree */ - public void addSequenceSet(org.vamsas.objects.core.SequenceSet vSequenceSet) + public void addTree(org.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { - _sequenceSetList.addElement(vSequenceSet); - } //-- void addSequenceSet(org.vamsas.objects.core.SequenceSet) + _treeList.addElement(vTree); + } //-- void addTree(org.vamsas.objects.core.Tree) /** - * Method addSequenceSet + * Method addTree * * * * @param index - * @param vSequenceSet + * @param vTree */ - public void addSequenceSet(int index, org.vamsas.objects.core.SequenceSet vSequenceSet) + public void addTree(int index, org.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { - _sequenceSetList.insertElementAt(vSequenceSet, index); - } //-- void addSequenceSet(int, org.vamsas.objects.core.SequenceSet) + _treeList.insertElementAt(vTree, index); + } //-- void addTree(int, org.vamsas.objects.core.Tree) /** - * Method enumerateDendro + * Method enumerateSequenceSet * * * * @return Enumeration */ - public java.util.Enumeration enumerateDendro() + public java.util.Enumeration enumerateSequenceSet() { - return _dendroList.elements(); - } //-- java.util.Enumeration enumerateDendro() + return _sequenceSetList.elements(); + } //-- java.util.Enumeration enumerateSequenceSet() /** - * Method enumerateSequenceSet + * Method enumerateTree * * * * @return Enumeration */ - public java.util.Enumeration enumerateSequenceSet() + public java.util.Enumeration enumerateTree() { - return _sequenceSetList.elements(); - } //-- java.util.Enumeration enumerateSequenceSet() + return _treeList.elements(); + } //-- java.util.Enumeration enumerateTree() /** * Note: hashCode() has not been overriden @@ -171,12 +171,12 @@ implements java.io.Serializable } else if (temp._id != null) return false; - if (this._dendroList != null) { - if (temp._dendroList == null) return false; - else if (!(this._dendroList.equals(temp._dendroList))) + if (this._treeList != null) { + if (temp._treeList == null) return false; + else if (!(this._treeList.equals(temp._treeList))) return false; } - else if (temp._dendroList != null) + else if (temp._treeList != null) return false; if (this._sequenceSetList != null) { if (temp._sequenceSetList == null) return false; @@ -191,111 +191,111 @@ implements java.io.Serializable } //-- boolean equals(java.lang.Object) /** - * Method getDendro + * Returns the value of field 'id'. + * + * @return String + * @return the value of field 'id'. + */ + public java.lang.String getId() + { + return this._id; + } //-- java.lang.String getId() + + /** + * Method getSequenceSet * * * * @param index - * @return Dendro + * @return SequenceSet */ - public org.vamsas.objects.core.Dendro getDendro(int index) + public org.vamsas.objects.core.SequenceSet getSequenceSet(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _dendroList.size())) { - throw new IndexOutOfBoundsException("getDendro: Index value '"+index+"' not in range [0.."+_dendroList.size()+ "]"); + if ((index < 0) || (index > _sequenceSetList.size())) { + throw new IndexOutOfBoundsException("getSequenceSet: Index value '"+index+"' not in range [0.."+_sequenceSetList.size()+ "]"); } - return (org.vamsas.objects.core.Dendro) _dendroList.elementAt(index); - } //-- org.vamsas.objects.core.Dendro getDendro(int) + return (org.vamsas.objects.core.SequenceSet) _sequenceSetList.elementAt(index); + } //-- org.vamsas.objects.core.SequenceSet getSequenceSet(int) /** - * Method getDendro + * Method getSequenceSet * * * - * @return Dendro + * @return SequenceSet */ - public org.vamsas.objects.core.Dendro[] getDendro() + public org.vamsas.objects.core.SequenceSet[] getSequenceSet() { - int size = _dendroList.size(); - org.vamsas.objects.core.Dendro[] mArray = new org.vamsas.objects.core.Dendro[size]; + int size = _sequenceSetList.size(); + org.vamsas.objects.core.SequenceSet[] mArray = new org.vamsas.objects.core.SequenceSet[size]; for (int index = 0; index < size; index++) { - mArray[index] = (org.vamsas.objects.core.Dendro) _dendroList.elementAt(index); + mArray[index] = (org.vamsas.objects.core.SequenceSet) _sequenceSetList.elementAt(index); } return mArray; - } //-- org.vamsas.objects.core.Dendro[] getDendro() + } //-- org.vamsas.objects.core.SequenceSet[] getSequenceSet() /** - * Method getDendroCount + * Method getSequenceSetCount * * * * @return int */ - public int getDendroCount() - { - return _dendroList.size(); - } //-- int getDendroCount() - - /** - * Returns the value of field 'id'. - * - * @return String - * @return the value of field 'id'. - */ - public java.lang.String getId() + public int getSequenceSetCount() { - return this._id; - } //-- java.lang.String getId() + return _sequenceSetList.size(); + } //-- int getSequenceSetCount() /** - * Method getSequenceSet + * Method getTree * * * * @param index - * @return SequenceSet + * @return Tree */ - public org.vamsas.objects.core.SequenceSet getSequenceSet(int index) + public org.vamsas.objects.core.Tree getTree(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _sequenceSetList.size())) { - throw new IndexOutOfBoundsException("getSequenceSet: Index value '"+index+"' not in range [0.."+_sequenceSetList.size()+ "]"); + if ((index < 0) || (index > _treeList.size())) { + throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]"); } - return (org.vamsas.objects.core.SequenceSet) _sequenceSetList.elementAt(index); - } //-- org.vamsas.objects.core.SequenceSet getSequenceSet(int) + return (org.vamsas.objects.core.Tree) _treeList.elementAt(index); + } //-- org.vamsas.objects.core.Tree getTree(int) /** - * Method getSequenceSet + * Method getTree * * * - * @return SequenceSet + * @return Tree */ - public org.vamsas.objects.core.SequenceSet[] getSequenceSet() + public org.vamsas.objects.core.Tree[] getTree() { - int size = _sequenceSetList.size(); - org.vamsas.objects.core.SequenceSet[] mArray = new org.vamsas.objects.core.SequenceSet[size]; + int size = _treeList.size(); + org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size]; for (int index = 0; index < size; index++) { - mArray[index] = (org.vamsas.objects.core.SequenceSet) _sequenceSetList.elementAt(index); + mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index); } return mArray; - } //-- org.vamsas.objects.core.SequenceSet[] getSequenceSet() + } //-- org.vamsas.objects.core.Tree[] getTree() /** - * Method getSequenceSetCount + * Method getTreeCount * * * * @return int */ - public int getSequenceSetCount() + public int getTreeCount() { - return _sequenceSetList.size(); - } //-- int getSequenceSetCount() + return _treeList.size(); + } //-- int getTreeCount() /** * Method isValid @@ -344,15 +344,6 @@ implements java.io.Serializable } //-- void marshal(org.xml.sax.ContentHandler) /** - * Method removeAllDendro - * - */ - public void removeAllDendro() - { - _dendroList.removeAllElements(); - } //-- void removeAllDendro() - - /** * Method removeAllSequenceSet * */ @@ -362,19 +353,13 @@ implements java.io.Serializable } //-- void removeAllSequenceSet() /** - * Method removeDendro + * Method removeAllTree * - * - * - * @param index - * @return Dendro */ - public org.vamsas.objects.core.Dendro removeDendro(int index) + public void removeAllTree() { - java.lang.Object obj = _dendroList.elementAt(index); - _dendroList.removeElementAt(index); - return (org.vamsas.objects.core.Dendro) obj; - } //-- org.vamsas.objects.core.Dendro removeDendro(int) + _treeList.removeAllElements(); + } //-- void removeAllTree() /** * Method removeSequenceSet @@ -392,38 +377,19 @@ implements java.io.Serializable } //-- org.vamsas.objects.core.SequenceSet removeSequenceSet(int) /** - * Method setDendro + * Method removeTree * * * * @param index - * @param vDendro + * @return Tree */ - public void setDendro(int index, org.vamsas.objects.core.Dendro vDendro) - throws java.lang.IndexOutOfBoundsException + public org.vamsas.objects.core.Tree removeTree(int index) { - //-- check bounds for index - if ((index < 0) || (index > _dendroList.size())) { - throw new IndexOutOfBoundsException("setDendro: Index value '"+index+"' not in range [0.."+_dendroList.size()+ "]"); - } - _dendroList.setElementAt(vDendro, index); - } //-- void setDendro(int, org.vamsas.objects.core.Dendro) - - /** - * Method setDendro - * - * - * - * @param dendroArray - */ - public void setDendro(org.vamsas.objects.core.Dendro[] dendroArray) - { - //-- copy array - _dendroList.removeAllElements(); - for (int i = 0; i < dendroArray.length; i++) { - _dendroList.addElement(dendroArray[i]); - } - } //-- void setDendro(org.vamsas.objects.core.Dendro) + java.lang.Object obj = _treeList.elementAt(index); + _treeList.removeElementAt(index); + return (org.vamsas.objects.core.Tree) obj; + } //-- org.vamsas.objects.core.Tree removeTree(int) /** * Sets the value of field 'id'. @@ -470,6 +436,40 @@ implements java.io.Serializable } //-- void setSequenceSet(org.vamsas.objects.core.SequenceSet) /** + * Method setTree + * + * + * + * @param index + * @param vTree + */ + public void setTree(int index, org.vamsas.objects.core.Tree vTree) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _treeList.size())) { + throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]"); + } + _treeList.setElementAt(vTree, index); + } //-- void setTree(int, org.vamsas.objects.core.Tree) + + /** + * Method setTree + * + * + * + * @param treeArray + */ + public void setTree(org.vamsas.objects.core.Tree[] treeArray) + { + //-- copy array + _treeList.removeAllElements(); + for (int i = 0; i < treeArray.length; i++) { + _treeList.addElement(treeArray[i]); + } + } //-- void setTree(org.vamsas.objects.core.Tree) + + /** * Method unmarshal * * diff --git a/src/org/vamsas/objects/core/VAMSASDescriptor.java b/src/org/vamsas/objects/core/VAMSASDescriptor.java index e46ddd0..a691eda 100644 --- a/src/org/vamsas/objects/core/VAMSASDescriptor.java +++ b/src/org/vamsas/objects/core/VAMSASDescriptor.java @@ -102,28 +102,28 @@ public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescrip desc.setValidator(fieldValidator); //-- initialize element descriptors - //-- _dendroList - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Dendro.class, "_dendroList", "Dendro", org.exolab.castor.xml.NodeType.Element); + //-- _treeList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { VAMSAS target = (VAMSAS) object; - return target.getDendro(); + return target.getTree(); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { VAMSAS target = (VAMSAS) object; - target.addDendro( (org.vamsas.objects.core.Dendro) value); + target.addTree( (org.vamsas.objects.core.Tree) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } public java.lang.Object newInstance( java.lang.Object parent ) { - return new org.vamsas.objects.core.Dendro(); + return new org.vamsas.objects.core.Tree(); } }; desc.setHandler(handler); @@ -131,7 +131,7 @@ public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescrip desc.setMultivalued(true); addFieldDescriptor(desc); - //-- validation code for: _dendroList + //-- validation code for: _treeList fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(0); { //-- local scope