made vamsas a proper root element in schema and added example document.
[vamsas.git] / src / org / vamsas / objects / core / SequenceSet.java
index f41fdc0..5bef63a 100644 (file)
@@ -38,21 +38,6 @@ implements java.io.Serializable
     //--------------------------/
 
     /**
-     * Field _gapChar
-     */
-    private java.lang.String _gapChar;
-
-    /**
-     * Field _aligned
-     */
-    private boolean _aligned;
-
-    /**
-     * keeps track of state for field: _aligned
-     */
-    private boolean _has_aligned;
-
-    /**
      * Field _id
      */
     private java.lang.String _id;
@@ -73,9 +58,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 +78,7 @@ implements java.io.Serializable
         _sequenceList = new Vector();
         _sequenceSetAnnotationsList = new Vector();
         _alignmentList = new Vector();
+        _treeList = new Vector();
     } //-- org.vamsas.objects.core.SequenceSet()
 
 
@@ -182,13 +168,31 @@ implements java.io.Serializable
     } //-- void addSequenceSetAnnotations(int, org.vamsas.objects.core.SequenceSetAnnotations) 
 
     /**
-     * Method deleteAligned
+     * 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 deleteAligned()
+    public void addTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
     {
-        this._has_aligned= false;
-    } //-- void deleteAligned() 
+        _treeList.insertElementAt(vTree, index);
+    } //-- void addTree(int, org.vamsas.objects.core.Tree) 
 
     /**
      * Method enumerateAlignment
@@ -227,6 +231,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
@@ -243,17 +259,6 @@ implements java.io.Serializable
         if (obj instanceof SequenceSet) {
         
             SequenceSet temp = (SequenceSet)obj;
-            if (this._gapChar != null) {
-                if (temp._gapChar == null) return false;
-                else if (!(this._gapChar.equals(temp._gapChar))) 
-                    return false;
-            }
-            else if (temp._gapChar != null)
-                return false;
-            if (this._aligned != temp._aligned)
-                return false;
-            if (this._has_aligned != temp._has_aligned)
-                return false;
             if (this._id != null) {
                 if (temp._id == null) return false;
                 else if (!(this._id.equals(temp._id))) 
@@ -282,12 +287,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;
@@ -302,17 +307,6 @@ implements java.io.Serializable
     } //-- boolean equals(java.lang.Object) 
 
     /**
-     * Returns the value of field 'aligned'.
-     * 
-     * @return boolean
-     * @return the value of field 'aligned'.
-     */
-    public boolean getAligned()
-    {
-        return this._aligned;
-    } //-- boolean getAligned() 
-
-    /**
      * Method getAlignment
      * 
      * 
@@ -361,17 +355,6 @@ implements java.io.Serializable
     } //-- int getAlignmentCount() 
 
     /**
-     * Returns the value of field 'gapChar'.
-     * 
-     * @return String
-     * @return the value of field 'gapChar'.
-     */
-    public java.lang.String getGapChar()
-    {
-        return this._gapChar;
-    } //-- java.lang.String getGapChar() 
-
-    /**
      * Returns the value of field 'id'.
      * 
      * @return String
@@ -490,27 +473,52 @@ implements java.io.Serializable
     } //-- int getSequenceSetAnnotationsCount() 
 
     /**
-     * Returns the value of field 'tree'.
+     * Method getTree
+     * 
+     * 
      * 
+     * @param index
      * @return Tree
-     * @return the value of field 'tree'.
      */
-    public org.vamsas.objects.core.Tree getTree()
+    public org.vamsas.objects.core.Tree getTree(int index)
+        throws java.lang.IndexOutOfBoundsException
     {
-        return this._tree;
-    } //-- org.vamsas.objects.core.Tree getTree() 
+        //-- 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 hasAligned
+     * Method getTree
      * 
      * 
      * 
-     * @return boolean
+     * @return Tree
+     */
+    public 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 boolean hasAligned()
+    public int getTreeCount()
     {
-        return this._has_aligned;
-    } //-- boolean hasAligned() 
+        return _treeList.size();
+    } //-- int getTreeCount() 
 
     /**
      * Method isValid
@@ -601,6 +609,15 @@ implements java.io.Serializable
     } //-- void removeAllSequenceSetAnnotations() 
 
     /**
+     * Method removeAllTree
+     * 
+     */
+    public void removeAllTree()
+    {
+        _treeList.removeAllElements();
+    } //-- void removeAllTree() 
+
+    /**
      * Method removeSequence
      * 
      * 
@@ -631,15 +648,19 @@ implements java.io.Serializable
     } //-- org.vamsas.objects.core.SequenceSetAnnotations removeSequenceSetAnnotations(int) 
 
     /**
-     * Sets the value of field 'aligned'.
+     * Method removeTree
+     * 
      * 
-     * @param aligned the value of field 'aligned'.
+     * 
+     * @param index
+     * @return Tree
      */
-    public void setAligned(boolean aligned)
+    public org.vamsas.objects.core.Tree removeTree(int index)
     {
-        this._aligned = aligned;
-        this._has_aligned = true;
-    } //-- void setAligned(boolean) 
+        java.lang.Object obj = _treeList.elementAt(index);
+        _treeList.removeElementAt(index);
+        return (org.vamsas.objects.core.Tree) obj;
+    } //-- org.vamsas.objects.core.Tree removeTree(int) 
 
     /**
      * Method setAlignment
@@ -676,16 +697,6 @@ implements java.io.Serializable
     } //-- void setAlignment(org.vamsas.objects.core.Alignment) 
 
     /**
-     * Sets the value of field 'gapChar'.
-     * 
-     * @param gapChar the value of field 'gapChar'.
-     */
-    public void setGapChar(java.lang.String gapChar)
-    {
-        this._gapChar = gapChar;
-    } //-- void setGapChar(java.lang.String) 
-
-    /**
      * Sets the value of field 'id'.
      * 
      * @param id the value of field 'id'.
@@ -774,13 +785,37 @@ implements java.io.Serializable
     } //-- void setSequenceSetAnnotations(org.vamsas.objects.core.SequenceSetAnnotations) 
 
     /**
-     * Sets the value of field 'tree'.
+     * Method setTree
+     * 
      * 
-     * @param tree the value of field 'tree'.
+     * 
+     * @param index
+     * @param vTree
      */
-    public void setTree(org.vamsas.objects.core.Tree tree)
+    public void setTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
     {
-        this._tree = tree;
+        //-- 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) 
 
     /**