fixed a slight bug in AppData entry searching, and introduced generic AppData entry...
[vamsas.git] / src / org / vamsas / objects / core / Tree.java
index 8290635..a6cbad3 100644 (file)
@@ -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,36 @@ 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 _title
+     */
+    private java.lang.String _title;
+
+    /**
+     * Field _newickList
+     */
+    private java.util.Vector _newickList;
+
+    /**
+     * Field _provenance
+     */
+    private org.vamsas.objects.core.Provenance _provenance;
+
+
       //----------------/
      //- Constructors -/
     //----------------/
@@ -38,6 +65,7 @@ implements java.io.Serializable
     public Tree() 
      {
         super();
+        _newickList = new Vector();
     } //-- org.vamsas.objects.core.Tree()
 
 
@@ -46,6 +74,45 @@ implements java.io.Serializable
     //-----------/
 
     /**
+     * Method addNewick
+     * 
+     * 
+     * 
+     * @param vNewick
+     */
+    public void addNewick(org.vamsas.objects.core.Newick vNewick)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _newickList.addElement(vNewick);
+    } //-- void addNewick(org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method addNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @param vNewick
+     */
+    public void addNewick(int index, org.vamsas.objects.core.Newick vNewick)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _newickList.insertElementAt(vNewick, index);
+    } //-- void addNewick(int, org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method enumerateNewick
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateNewick()
+    {
+        return _newickList.elements();
+    } //-- java.util.Enumeration enumerateNewick() 
+
+    /**
      * Note: hashCode() has not been overriden
      * 
      * @param obj
@@ -62,12 +129,121 @@ 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._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._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 getNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @return Newick
+     */
+    public org.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 (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
+    } //-- org.vamsas.objects.core.Newick getNewick(int) 
+
+    /**
+     * Method getNewick
+     * 
+     * 
+     * 
+     * @return Newick
+     */
+    public org.vamsas.objects.core.Newick[] getNewick()
+    {
+        int size = _newickList.size();
+        org.vamsas.objects.core.Newick[] mArray = new org.vamsas.objects.core.Newick[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Newick[] getNewick() 
+
+    /**
+     * Method getNewickCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getNewickCount()
+    {
+        return _newickList.size();
+    } //-- int getNewickCount() 
+
+    /**
+     * 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() 
+
+    /**
+     * 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
      * 
      * 
@@ -114,6 +290,94 @@ implements java.io.Serializable
     } //-- void marshal(org.xml.sax.ContentHandler) 
 
     /**
+     * Method removeAllNewick
+     * 
+     */
+    public void removeAllNewick()
+    {
+        _newickList.removeAllElements();
+    } //-- void removeAllNewick() 
+
+    /**
+     * Method removeNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @return Newick
+     */
+    public org.vamsas.objects.core.Newick removeNewick(int index)
+    {
+        java.lang.Object obj = _newickList.elementAt(index);
+        _newickList.removeElementAt(index);
+        return (org.vamsas.objects.core.Newick) obj;
+    } //-- org.vamsas.objects.core.Newick removeNewick(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 setNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @param vNewick
+     */
+    public void setNewick(int index, org.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, org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method setNewick
+     * 
+     * 
+     * 
+     * @param newickArray
+     */
+    public void setNewick(org.vamsas.objects.core.Newick[] newickArray)
+    {
+        //-- copy array
+        _newickList.removeAllElements();
+        for (int i = 0; i < newickArray.length; i++) {
+            _newickList.addElement(newickArray[i]);
+        }
+    } //-- void setNewick(org.vamsas.objects.core.Newick) 
+
+    /**
+     * 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) 
+
+    /**
+     * 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
      * 
      *