X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Forg%2Fvamsas%2Fobjects%2Fcore%2FAlignment.java;h=be0f142f5dabb0c484a3f8ec1825769825545966;hb=de5c431d734c37ef35afb58a849a321010df1a99;hp=b9fa81cfd0d617a062d5c5e0238622f0054f3611;hpb=a54f7d71affe4e9cd7a7b0f6137e44f5b82b7a9d;p=vamsas.git diff --git a/src/org/vamsas/objects/core/Alignment.java b/src/org/vamsas/objects/core/Alignment.java index b9fa81c..be0f142 100644 --- a/src/org/vamsas/objects/core/Alignment.java +++ b/src/org/vamsas/objects/core/Alignment.java @@ -38,9 +38,29 @@ implements java.io.Serializable //--------------------------/ /** - * Field _alignmentAnnotations + * Field _gapChar */ - private org.vamsas.objects.core.AlignmentAnnotations _alignmentAnnotations; + 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; + + /** + * Field _alignmentAnnotationsList + */ + private java.util.Vector _alignmentAnnotationsList; /** * Field _treeList @@ -65,6 +85,7 @@ implements java.io.Serializable public Alignment() { super(); + _alignmentAnnotationsList = new Vector(); _treeList = new Vector(); _alignmentSequenceList = new Vector(); } //-- org.vamsas.objects.core.Alignment() @@ -75,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 * * @@ -129,6 +177,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 enumerateAlignmentAnnotations + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateAlignmentAnnotations() + { + return _alignmentAnnotationsList.elements(); + } //-- java.util.Enumeration enumerateAlignmentAnnotations() + + /** * Method enumerateAlignmentSequence * * @@ -169,12 +238,30 @@ implements java.io.Serializable if (obj instanceof Alignment) { Alignment temp = (Alignment)obj; - if (this._alignmentAnnotations != null) { - if (temp._alignmentAnnotations == null) return false; - else if (!(this._alignmentAnnotations.equals(temp._alignmentAnnotations))) + 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))) + return false; + } + else if (temp._id != null) + return false; + 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; @@ -203,15 +290,63 @@ implements java.io.Serializable } //-- boolean equals(java.lang.Object) /** - * Returns the value of field 'alignmentAnnotations'. + * Returns the value of field 'aligned'. + * + * @return boolean + * @return the value of field 'aligned'. + */ + public boolean getAligned() + { + return this._aligned; + } //-- boolean getAligned() + + /** + * 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() + { + 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 this._alignmentAnnotations; - } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() + return _alignmentAnnotationsList.size(); + } //-- int getAlignmentAnnotationsCount() /** * Method getAlignmentSequence @@ -262,6 +397,28 @@ implements java.io.Serializable } //-- int getAlignmentSequenceCount() /** + * 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 + * @return the value of field 'id'. + */ + public java.lang.String getId() + { + return this._id; + } //-- java.lang.String getId() + + /** * Returns the value of field 'provenance'. * * @return Provenance @@ -321,6 +478,18 @@ implements java.io.Serializable } //-- int getTreeCount() /** + * Method hasAligned + * + * + * + * @return boolean + */ + public boolean hasAligned() + { + return this._has_aligned; + } //-- boolean hasAligned() + + /** * Method isValid * * @@ -367,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 * * @@ -382,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 * */ @@ -415,14 +608,48 @@ 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 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) /** @@ -460,6 +687,26 @@ implements java.io.Serializable } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) /** + * 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'. + */ + public void setId(java.lang.String id) + { + this._id = id; + } //-- void setId(java.lang.String) + + /** * Sets the value of field 'provenance'. * * @param provenance the value of field 'provenance'.