reorganising vamsasArchive (write to temp file, rather than write to original filename)
[vamsas.git] / src / org / vamsas / objects / core / Alignment.java
index 68cf78b..be0f142 100644 (file)
@@ -58,9 +58,9 @@ implements java.io.Serializable
     private java.lang.String _id;
 
     /**
-     * Field _alignmentAnnotations
+     * Field _alignmentAnnotationsList
      */
-    private org.vamsas.objects.core.AlignmentAnnotations _alignmentAnnotations;
+    private java.util.Vector _alignmentAnnotationsList;
 
     /**
      * Field _treeList
@@ -85,6 +85,7 @@ implements java.io.Serializable
     public Alignment() 
      {
         super();
+        _alignmentAnnotationsList = new Vector();
         _treeList = new Vector();
         _alignmentSequenceList = new Vector();
     } //-- org.vamsas.objects.core.Alignment()
@@ -95,6 +96,33 @@ implements java.io.Serializable
     //-----------/
 
     /**
+     * Method addAlignmentAnnotations
+     * 
+     * 
+     * 
+     * @param vAlignmentAnnotations
+     */
+    public void addAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations vAlignmentAnnotations)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentAnnotationsList.addElement(vAlignmentAnnotations);
+    } //-- void addAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
+
+    /**
+     * Method addAlignmentAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentAnnotations
+     */
+    public void addAlignmentAnnotations(int index, org.vamsas.objects.core.AlignmentAnnotations vAlignmentAnnotations)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentAnnotationsList.insertElementAt(vAlignmentAnnotations, index);
+    } //-- void addAlignmentAnnotations(int, org.vamsas.objects.core.AlignmentAnnotations) 
+
+    /**
      * Method addAlignmentSequence
      * 
      * 
@@ -158,6 +186,18 @@ implements java.io.Serializable
     } //-- void deleteAligned() 
 
     /**
+     * Method enumerateAlignmentAnnotations
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAlignmentAnnotations()
+    {
+        return _alignmentAnnotationsList.elements();
+    } //-- java.util.Enumeration enumerateAlignmentAnnotations() 
+
+    /**
      * Method enumerateAlignmentSequence
      * 
      * 
@@ -216,12 +256,12 @@ implements java.io.Serializable
             }
             else if (temp._id != null)
                 return false;
-            if (this._alignmentAnnotations != null) {
-                if (temp._alignmentAnnotations == null) return false;
-                else if (!(this._alignmentAnnotations.equals(temp._alignmentAnnotations))) 
+            if (this._alignmentAnnotationsList != null) {
+                if (temp._alignmentAnnotationsList == null) return false;
+                else if (!(this._alignmentAnnotationsList.equals(temp._alignmentAnnotationsList))) 
                     return false;
             }
-            else if (temp._alignmentAnnotations != null)
+            else if (temp._alignmentAnnotationsList != null)
                 return false;
             if (this._treeList != null) {
                 if (temp._treeList == null) return false;
@@ -261,15 +301,52 @@ implements java.io.Serializable
     } //-- boolean getAligned() 
 
     /**
-     * Returns the value of field 'alignmentAnnotations'.
+     * Method getAlignmentAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentAnnotations
+     */
+    public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentAnnotationsList.size())) {
+            throw new IndexOutOfBoundsException("getAlignmentAnnotations: Index value '"+index+"' not in range [0.."+_alignmentAnnotationsList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.AlignmentAnnotations) _alignmentAnnotationsList.elementAt(index);
+    } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations(int) 
+
+    /**
+     * Method getAlignmentAnnotations
+     * 
+     * 
      * 
      * @return AlignmentAnnotations
-     * @return the value of field 'alignmentAnnotations'.
      */
-    public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations()
+    public org.vamsas.objects.core.AlignmentAnnotations[] getAlignmentAnnotations()
     {
-        return this._alignmentAnnotations;
-    } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() 
+        int size = _alignmentAnnotationsList.size();
+        org.vamsas.objects.core.AlignmentAnnotations[] mArray = new org.vamsas.objects.core.AlignmentAnnotations[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.AlignmentAnnotations) _alignmentAnnotationsList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.AlignmentAnnotations[] getAlignmentAnnotations() 
+
+    /**
+     * Method getAlignmentAnnotationsCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAlignmentAnnotationsCount()
+    {
+        return _alignmentAnnotationsList.size();
+    } //-- int getAlignmentAnnotationsCount() 
 
     /**
      * Method getAlignmentSequence
@@ -459,6 +536,21 @@ implements java.io.Serializable
     } //-- void marshal(org.xml.sax.ContentHandler) 
 
     /**
+     * Method removeAlignmentAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentAnnotations
+     */
+    public org.vamsas.objects.core.AlignmentAnnotations removeAlignmentAnnotations(int index)
+    {
+        java.lang.Object obj = _alignmentAnnotationsList.elementAt(index);
+        _alignmentAnnotationsList.removeElementAt(index);
+        return (org.vamsas.objects.core.AlignmentAnnotations) obj;
+    } //-- org.vamsas.objects.core.AlignmentAnnotations removeAlignmentAnnotations(int) 
+
+    /**
      * Method removeAlignmentSequence
      * 
      * 
@@ -474,6 +566,15 @@ implements java.io.Serializable
     } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) 
 
     /**
+     * Method removeAllAlignmentAnnotations
+     * 
+     */
+    public void removeAllAlignmentAnnotations()
+    {
+        _alignmentAnnotationsList.removeAllElements();
+    } //-- void removeAllAlignmentAnnotations() 
+
+    /**
      * Method removeAllAlignmentSequence
      * 
      */
@@ -518,14 +619,37 @@ implements java.io.Serializable
     } //-- void setAligned(boolean) 
 
     /**
-     * Sets the value of field 'alignmentAnnotations'.
+     * Method setAlignmentAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentAnnotations
+     */
+    public void setAlignmentAnnotations(int index, org.vamsas.objects.core.AlignmentAnnotations vAlignmentAnnotations)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentAnnotationsList.size())) {
+            throw new IndexOutOfBoundsException("setAlignmentAnnotations: Index value '"+index+"' not in range [0.."+_alignmentAnnotationsList.size()+ "]");
+        }
+        _alignmentAnnotationsList.setElementAt(vAlignmentAnnotations, index);
+    } //-- void setAlignmentAnnotations(int, org.vamsas.objects.core.AlignmentAnnotations) 
+
+    /**
+     * Method setAlignmentAnnotations
+     * 
+     * 
      * 
-     * @param alignmentAnnotations the value of field
-     * 'alignmentAnnotations'.
+     * @param alignmentAnnotationsArray
      */
-    public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations alignmentAnnotations)
+    public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations[] alignmentAnnotationsArray)
     {
-        this._alignmentAnnotations = alignmentAnnotations;
+        //-- copy array
+        _alignmentAnnotationsList.removeAllElements();
+        for (int i = 0; i < alignmentAnnotationsArray.length; i++) {
+            _alignmentAnnotationsList.addElement(alignmentAnnotationsArray[i]);
+        }
     } //-- void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
 
     /**