backtrack
[vamsas.git] / src / org / vamsas / objects / core / Alignment.java
index 9a6d432..bf70f4e 100644 (file)
@@ -28,7 +28,7 @@ import org.xml.sax.ContentHandler;
  * 
  * @version $Revision$ $Date$
  */
-public class Alignment extends org.vamsas.client.object 
+public class Alignment extends org.vamsas.client.Vobject 
 implements java.io.Serializable
 {
 
@@ -38,14 +38,37 @@ implements java.io.Serializable
     //--------------------------/
 
     /**
-     * Field _id
+     * Field _gapChar
+     */
+    private java.lang.String _gapChar;
+
+    /**
+     * Field _aligned
+     */
+    private boolean _aligned;
+
+    /**
+     * keeps track of state for field: _aligned
+     */
+    private boolean _has_aligned;
+
+    /**
+     * Primary Key for vamsas object referencing
+     *  
      */
     private java.lang.String _id;
 
     /**
-     * Field _alignmentAnnotations
+     * Field _modifiable
+     */
+    private java.lang.String _modifiable;
+
+    /**
+     * This is annotation over the coordinate frame
+     *  defined by all the columns in the alignment.
+     *  
      */
-    private org.vamsas.objects.core.AlignmentAnnotations _alignmentAnnotations;
+    private java.util.Vector _alignmentAnnotationList;
 
     /**
      * Field _treeList
@@ -58,6 +81,12 @@ implements java.io.Serializable
     private java.util.Vector _alignmentSequenceList;
 
     /**
+     * typical properties may be additional
+     *  alignment score objects 
+     */
+    private java.util.Vector _propertyList;
+
+    /**
      * Field _provenance
      */
     private org.vamsas.objects.core.Provenance _provenance;
@@ -70,8 +99,10 @@ implements java.io.Serializable
     public Alignment() 
      {
         super();
+        _alignmentAnnotationList = new Vector();
         _treeList = new Vector();
         _alignmentSequenceList = new Vector();
+        _propertyList = new Vector();
     } //-- org.vamsas.objects.core.Alignment()
 
 
@@ -80,6 +111,33 @@ implements java.io.Serializable
     //-----------/
 
     /**
+     * Method addAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param vAlignmentAnnotation
+     */
+    public void addAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentAnnotationList.addElement(vAlignmentAnnotation);
+    } //-- void addAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
+     * Method addAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentAnnotation
+     */
+    public void addAlignmentAnnotation(int index, org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentAnnotationList.insertElementAt(vAlignmentAnnotation, index);
+    } //-- void addAlignmentAnnotation(int, org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
      * Method addAlignmentSequence
      * 
      * 
@@ -107,6 +165,33 @@ implements java.io.Serializable
     } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
 
     /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param vProperty
+     */
+    public void addProperty(org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.addElement(vProperty);
+    } //-- void addProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.insertElementAt(vProperty, index);
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
      * Method addTree
      * 
      * 
@@ -134,6 +219,27 @@ implements java.io.Serializable
     } //-- void addTree(int, org.vamsas.objects.core.Tree) 
 
     /**
+     * Method deleteAligned
+     * 
+     */
+    public void deleteAligned()
+    {
+        this._has_aligned= false;
+    } //-- void deleteAligned() 
+
+    /**
+     * Method enumerateAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAlignmentAnnotation()
+    {
+        return _alignmentAnnotationList.elements();
+    } //-- java.util.Enumeration enumerateAlignmentAnnotation() 
+
+    /**
      * Method enumerateAlignmentSequence
      * 
      * 
@@ -146,6 +252,18 @@ implements java.io.Serializable
     } //-- java.util.Enumeration enumerateAlignmentSequence() 
 
     /**
+     * Method enumerateProperty
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateProperty()
+    {
+        return _propertyList.elements();
+    } //-- java.util.Enumeration enumerateProperty() 
+
+    /**
      * Method enumerateTree
      * 
      * 
@@ -174,6 +292,17 @@ implements java.io.Serializable
         if (obj instanceof Alignment) {
         
             Alignment temp = (Alignment)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))) 
@@ -181,12 +310,19 @@ 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._modifiable != null) {
+                if (temp._modifiable == null) return false;
+                else if (!(this._modifiable.equals(temp._modifiable))) 
                     return false;
             }
-            else if (temp._alignmentAnnotations != null)
+            else if (temp._modifiable != null)
+                return false;
+            if (this._alignmentAnnotationList != null) {
+                if (temp._alignmentAnnotationList == null) return false;
+                else if (!(this._alignmentAnnotationList.equals(temp._alignmentAnnotationList))) 
+                    return false;
+            }
+            else if (temp._alignmentAnnotationList != null)
                 return false;
             if (this._treeList != null) {
                 if (temp._treeList == null) return false;
@@ -202,6 +338,13 @@ implements java.io.Serializable
             }
             else if (temp._alignmentSequenceList != 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))) 
@@ -215,15 +358,63 @@ implements java.io.Serializable
     } //-- boolean equals(java.lang.Object) 
 
     /**
-     * Returns the value of field 'alignmentAnnotations'.
+     * Returns the value of field 'aligned'.
      * 
-     * @return AlignmentAnnotations
-     * @return the value of field 'alignmentAnnotations'.
+     * @return boolean
+     * @return the value of field 'aligned'.
      */
-    public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations()
+    public boolean getAligned()
     {
-        return this._alignmentAnnotations;
-    } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() 
+        return this._aligned;
+    } //-- boolean getAligned() 
+
+    /**
+     * Method getAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentAnnotationList.size())) {
+            throw new IndexOutOfBoundsException("getAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
+    } //-- org.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int) 
+
+    /**
+     * Method getAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @return AlignmentAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation()
+    {
+        int size = _alignmentAnnotationList.size();
+        org.vamsas.objects.core.AlignmentAnnotation[] mArray = new org.vamsas.objects.core.AlignmentAnnotation[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation() 
+
+    /**
+     * Method getAlignmentAnnotationCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAlignmentAnnotationCount()
+    {
+        return _alignmentAnnotationList.size();
+    } //-- int getAlignmentAnnotationCount() 
 
     /**
      * Method getAlignmentSequence
@@ -274,7 +465,21 @@ implements java.io.Serializable
     } //-- int getAlignmentSequenceCount() 
 
     /**
-     * Returns the value of field 'id'.
+     * 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'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
      * 
      * @return String
      * @return the value of field 'id'.
@@ -285,6 +490,65 @@ implements java.io.Serializable
     } //-- 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 getProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.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 (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+    } //-- org.vamsas.objects.core.Property getProperty(int) 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property[] getProperty()
+    {
+        int size = _propertyList.size();
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.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
@@ -344,6 +608,18 @@ implements java.io.Serializable
     } //-- int getTreeCount() 
 
     /**
+     * Method hasAligned
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasAligned()
+    {
+        return this._has_aligned;
+    } //-- boolean hasAligned() 
+
+    /**
      * Method isValid
      * 
      * 
@@ -390,6 +666,21 @@ implements java.io.Serializable
     } //-- void marshal(org.xml.sax.ContentHandler) 
 
     /**
+     * Method removeAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int index)
+    {
+        java.lang.Object obj = _alignmentAnnotationList.elementAt(index);
+        _alignmentAnnotationList.removeElementAt(index);
+        return (org.vamsas.objects.core.AlignmentAnnotation) obj;
+    } //-- org.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int) 
+
+    /**
      * Method removeAlignmentSequence
      * 
      * 
@@ -405,6 +696,15 @@ implements java.io.Serializable
     } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) 
 
     /**
+     * Method removeAllAlignmentAnnotation
+     * 
+     */
+    public void removeAllAlignmentAnnotation()
+    {
+        _alignmentAnnotationList.removeAllElements();
+    } //-- void removeAllAlignmentAnnotation() 
+
+    /**
      * Method removeAllAlignmentSequence
      * 
      */
@@ -414,6 +714,15 @@ implements java.io.Serializable
     } //-- void removeAllAlignmentSequence() 
 
     /**
+     * Method removeAllProperty
+     * 
+     */
+    public void removeAllProperty()
+    {
+        _propertyList.removeAllElements();
+    } //-- void removeAllProperty() 
+
+    /**
      * Method removeAllTree
      * 
      */
@@ -423,6 +732,21 @@ implements java.io.Serializable
     } //-- void removeAllTree() 
 
     /**
+     * Method removeProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property removeProperty(int index)
+    {
+        java.lang.Object obj = _propertyList.elementAt(index);
+        _propertyList.removeElementAt(index);
+        return (org.vamsas.objects.core.Property) obj;
+    } //-- org.vamsas.objects.core.Property removeProperty(int) 
+
+    /**
      * Method removeTree
      * 
      * 
@@ -438,15 +762,49 @@ implements java.io.Serializable
     } //-- org.vamsas.objects.core.Tree removeTree(int) 
 
     /**
-     * Sets the value of field 'alignmentAnnotations'.
+     * Sets the value of field 'aligned'.
+     * 
+     * @param aligned the value of field 'aligned'.
+     */
+    public void setAligned(boolean aligned)
+    {
+        this._aligned = aligned;
+        this._has_aligned = true;
+    } //-- void setAligned(boolean) 
+
+    /**
+     * Method setAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentAnnotation
+     */
+    public void setAlignmentAnnotation(int index, org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentAnnotationList.size())) {
+            throw new IndexOutOfBoundsException("setAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
+        }
+        _alignmentAnnotationList.setElementAt(vAlignmentAnnotation, index);
+    } //-- void setAlignmentAnnotation(int, org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
+     * Method setAlignmentAnnotation
+     * 
+     * 
      * 
-     * @param alignmentAnnotations the value of field
-     * 'alignmentAnnotations'.
+     * @param alignmentAnnotationArray
      */
-    public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations alignmentAnnotations)
+    public void setAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation[] alignmentAnnotationArray)
     {
-        this._alignmentAnnotations = alignmentAnnotations;
-    } //-- void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
+        //-- copy array
+        _alignmentAnnotationList.removeAllElements();
+        for (int i = 0; i < alignmentAnnotationArray.length; i++) {
+            _alignmentAnnotationList.addElement(alignmentAnnotationArray[i]);
+        }
+    } //-- void setAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation) 
 
     /**
      * Method setAlignmentSequence
@@ -483,7 +841,20 @@ implements java.io.Serializable
     } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
 
     /**
-     * Sets the value of field 'id'.
+     * 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'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
      * 
      * @param id the value of field 'id'.
      */
@@ -493,6 +864,50 @@ implements java.io.Serializable
     } //-- 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 setProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void setProperty(int index, org.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, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param propertyArray
+     */
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
+    {
+        //-- copy array
+        _propertyList.removeAllElements();
+        for (int i = 0; i < propertyArray.length; i++) {
+            _propertyList.addElement(propertyArray[i]);
+        }
+    } //-- void setProperty(org.vamsas.objects.core.Property) 
+
+    /**
      * Sets the value of field 'provenance'.
      * 
      * @param provenance the value of field 'provenance'.