/* * 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 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; import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** * Class Tree. * * @version $Revision$ $Date$ */ 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 -/ //----------------/ public Tree() { super(); _newickFormatList = new Vector(); } //-- org.vamsas.objects.core.Tree() //-----------/ //- Methods -/ //-----------/ /** * 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 * @return boolean */ public boolean equals(java.lang.Object obj) { if ( this == obj ) return true; if (super.equals(obj)==false) return false; 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 * * * * @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 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 * * * * @param reader * @return Tree */ public static org.vamsas.objects.core.Tree unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.vamsas.objects.core.Tree) Unmarshaller.unmarshal(org.vamsas.objects.core.Tree.class, reader); } //-- org.vamsas.objects.core.Tree 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() }