/* * This class was automatically generated with * Castor 0.9.9M2, using an XML * Schema. * $Id:Tree.java 264 2006-12-14 17:42:54Z JimP $ */ package uk.ac.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:264 $ $Date:2006-12-14 17:42:54 +0000 (Thu, 14 Dec 2006) $ */ public class Tree 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; /** * Field _title */ private java.lang.String _title; /** * Field _newickList */ private java.util.Vector _newickList; /** * Field _propertyList */ private java.util.Vector _propertyList; /** * Field _provenance */ private uk.ac.vamsas.objects.core.Provenance _provenance; //----------------/ //- Constructors -/ //----------------/ public Tree() { super(); _newickList = new Vector(); _propertyList = new Vector(); } //-- uk.ac.vamsas.objects.core.Tree() //-----------/ //- Methods -/ //-----------/ /** * Method addNewick * * * * @param vNewick */ public void addNewick(uk.ac.vamsas.objects.core.Newick vNewick) throws java.lang.IndexOutOfBoundsException { _newickList.addElement(vNewick); } //-- void addNewick(uk.ac.vamsas.objects.core.Newick) /** * Method addNewick * * * * @param index * @param vNewick */ public void addNewick(int index, uk.ac.vamsas.objects.core.Newick vNewick) throws java.lang.IndexOutOfBoundsException { _newickList.insertElementAt(vNewick, index); } //-- void addNewick(int, uk.ac.vamsas.objects.core.Newick) /** * Method addProperty * * * * @param vProperty */ public void addProperty(uk.ac.vamsas.objects.core.Property vProperty) throws java.lang.IndexOutOfBoundsException { _propertyList.addElement(vProperty); } //-- void addProperty(uk.ac.vamsas.objects.core.Property) /** * Method addProperty * * * * @param index * @param vProperty */ public void addProperty(int index, uk.ac.vamsas.objects.core.Property vProperty) throws java.lang.IndexOutOfBoundsException { _propertyList.insertElementAt(vProperty, index); } //-- void addProperty(int, uk.ac.vamsas.objects.core.Property) /** * Method enumerateNewick * * * * @return Enumeration */ public java.util.Enumeration enumerateNewick() { return _newickList.elements(); } //-- java.util.Enumeration enumerateNewick() /** * Method enumerateProperty * * * * @return Enumeration */ public java.util.Enumeration enumerateProperty() { return _propertyList.elements(); } //-- java.util.Enumeration enumerateProperty() /** * 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._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._title != null) { if (temp._title == null) return false; else if (!(this._title.equals(temp._title))) return false; } else if (temp._title != null) return false; if (this._newickList != null) { if (temp._newickList == null) return false; else if (!(this._newickList.equals(temp._newickList))) return false; } else if (temp._newickList != 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; 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'. The field 'id' has the * following description: Primary Key for vamsas object * referencing * * @return String * @return the value of field 'id'. */ public java.lang.String getId() { return this._id; } //-- java.lang.String getId() /** * Returns the value of field 'modifiable'. * * @return String * @return the value of field 'modifiable'. */ public java.lang.String getModifiable() { return this._modifiable; } //-- java.lang.String getModifiable() /** * Method getNewick * * * * @param index * @return Newick */ public uk.ac.vamsas.objects.core.Newick getNewick(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _newickList.size())) { throw new IndexOutOfBoundsException("getNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Newick) _newickList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Newick getNewick(int) /** * Method getNewick * * * * @return Newick */ public uk.ac.vamsas.objects.core.Newick[] getNewick() { int size = _newickList.size(); uk.ac.vamsas.objects.core.Newick[] mArray = new uk.ac.vamsas.objects.core.Newick[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Newick) _newickList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Newick[] getNewick() /** * Method getNewickCount * * * * @return int */ public int getNewickCount() { return _newickList.size(); } //-- int getNewickCount() /** * Method getProperty * * * * @param index * @return Property */ public uk.ac.vamsas.objects.core.Property getProperty(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _propertyList.size())) { throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Property getProperty(int) /** * Method getProperty * * * * @return Property */ public uk.ac.vamsas.objects.core.Property[] getProperty() { int size = _propertyList.size(); uk.ac.vamsas.objects.core.Property[] mArray = new uk.ac.vamsas.objects.core.Property[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Property[] getProperty() /** * Method getPropertyCount * * * * @return int */ public int getPropertyCount() { return _propertyList.size(); } //-- int getPropertyCount() /** * Returns the value of field 'provenance'. * * @return Provenance * @return the value of field 'provenance'. */ public uk.ac.vamsas.objects.core.Provenance getProvenance() { return this._provenance; } //-- uk.ac.vamsas.objects.core.Provenance getProvenance() /** * Returns the value of field 'title'. * * @return String * @return the value of field 'title'. */ public java.lang.String getTitle() { return this._title; } //-- java.lang.String getTitle() /** * 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 removeAllNewick * */ public void removeAllNewick() { _newickList.removeAllElements(); } //-- void removeAllNewick() /** * Method removeAllProperty * */ public void removeAllProperty() { _propertyList.removeAllElements(); } //-- void removeAllProperty() /** * Method removeNewick * * * * @param index * @return Newick */ public uk.ac.vamsas.objects.core.Newick removeNewick(int index) { java.lang.Object obj = _newickList.elementAt(index); _newickList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Newick) obj; } //-- uk.ac.vamsas.objects.core.Newick removeNewick(int) /** * Method removeProperty * * * * @param index * @return Property */ public uk.ac.vamsas.objects.core.Property removeProperty(int index) { java.lang.Object obj = _propertyList.elementAt(index); _propertyList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Property) obj; } //-- uk.ac.vamsas.objects.core.Property removeProperty(int) /** * 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(java.lang.String id) { this._id = id; } //-- void setId(java.lang.String) /** * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; } //-- void setModifiable(java.lang.String) /** * Method setNewick * * * * @param index * @param vNewick */ public void setNewick(int index, uk.ac.vamsas.objects.core.Newick vNewick) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _newickList.size())) { throw new IndexOutOfBoundsException("setNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]"); } _newickList.setElementAt(vNewick, index); } //-- void setNewick(int, uk.ac.vamsas.objects.core.Newick) /** * Method setNewick * * * * @param newickArray */ public void setNewick(uk.ac.vamsas.objects.core.Newick[] newickArray) { //-- copy array _newickList.removeAllElements(); for (int i = 0; i < newickArray.length; i++) { _newickList.addElement(newickArray[i]); } } //-- void setNewick(uk.ac.vamsas.objects.core.Newick) /** * Method setProperty * * * * @param index * @param vProperty */ public void setProperty(int index, uk.ac.vamsas.objects.core.Property vProperty) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _propertyList.size())) { throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]"); } _propertyList.setElementAt(vProperty, index); } //-- void setProperty(int, uk.ac.vamsas.objects.core.Property) /** * Method setProperty * * * * @param propertyArray */ public void setProperty(uk.ac.vamsas.objects.core.Property[] propertyArray) { //-- copy array _propertyList.removeAllElements(); for (int i = 0; i < propertyArray.length; i++) { _propertyList.addElement(propertyArray[i]); } } //-- void setProperty(uk.ac.vamsas.objects.core.Property) /** * Sets the value of field 'provenance'. * * @param provenance the value of field 'provenance'. */ public void setProvenance(uk.ac.vamsas.objects.core.Provenance provenance) { this._provenance = provenance; } //-- void setProvenance(uk.ac.vamsas.objects.core.Provenance) /** * Sets the value of field 'title'. * * @param title the value of field 'title'. */ public void setTitle(java.lang.String title) { this._title = title; } //-- void setTitle(java.lang.String) /** * Method unmarshal * * * * @param reader * @return Tree */ public static uk.ac.vamsas.objects.core.Tree unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.Tree) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Tree.class, reader); } //-- uk.ac.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() }