2 * This file is part of the Vamsas Client version 0.1.
3 * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
4 * Andrew Waterhouse and Dominik Lindner.
6 * Earlier versions have also been incorporated into Jalview version 2.4
7 * since 2008, and TOPALi version 2 since 2007.
9 * The Vamsas Client is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * The Vamsas Client is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
22 package uk.ac.vamsas.objects.core;
24 //---------------------------------/
25 //- Imported classes and packages -/
26 //---------------------------------/
28 import org.exolab.castor.xml.Marshaller;
29 import org.exolab.castor.xml.Unmarshaller;
34 * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
37 public class Alignment extends uk.ac.vamsas.client.Vobject implements
38 java.io.Serializable {
40 // --------------------------/
41 // - Class/Member Variables -/
42 // --------------------------/
47 private java.lang.String _gapChar;
52 private boolean _aligned;
55 * keeps track of state for field: _aligned
57 private boolean _has_aligned;
60 * Primary Key for vamsas object referencing
63 private java.lang.String _id;
68 private java.lang.String _modifiable;
71 * This is annotation over the coordinate frame defined by all the columns in
75 private java.util.Vector _alignmentAnnotationList;
80 private java.util.Vector _treeList;
83 * Field _alignmentSequenceList.
85 private java.util.Vector _alignmentSequenceList;
88 * typical properties may be additional alignment score objects
90 private java.util.Vector _propertyList;
95 private uk.ac.vamsas.objects.core.Provenance _provenance;
103 this._alignmentAnnotationList = new java.util.Vector();
104 this._treeList = new java.util.Vector();
105 this._alignmentSequenceList = new java.util.Vector();
106 this._propertyList = new java.util.Vector();
116 * @param vAlignmentAnnotation
117 * @throws java.lang.IndexOutOfBoundsException
118 * if the index given is outside the bounds of the collection
120 public void addAlignmentAnnotation(
121 final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
122 throws java.lang.IndexOutOfBoundsException {
123 this._alignmentAnnotationList.addElement(vAlignmentAnnotation);
130 * @param vAlignmentAnnotation
131 * @throws java.lang.IndexOutOfBoundsException
132 * if the index given is outside the bounds of the collection
134 public void addAlignmentAnnotation(final int index,
135 final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
136 throws java.lang.IndexOutOfBoundsException {
137 this._alignmentAnnotationList.add(index, vAlignmentAnnotation);
143 * @param vAlignmentSequence
144 * @throws java.lang.IndexOutOfBoundsException
145 * if the index given is outside the bounds of the collection
147 public void addAlignmentSequence(
148 final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
149 throws java.lang.IndexOutOfBoundsException {
150 this._alignmentSequenceList.addElement(vAlignmentSequence);
157 * @param vAlignmentSequence
158 * @throws java.lang.IndexOutOfBoundsException
159 * if the index given is outside the bounds of the collection
161 public void addAlignmentSequence(final int index,
162 final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
163 throws java.lang.IndexOutOfBoundsException {
164 this._alignmentSequenceList.add(index, vAlignmentSequence);
171 * @throws java.lang.IndexOutOfBoundsException
172 * if the index given is outside the bounds of the collection
174 public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
175 throws java.lang.IndexOutOfBoundsException {
176 this._propertyList.addElement(vProperty);
184 * @throws java.lang.IndexOutOfBoundsException
185 * if the index given is outside the bounds of the collection
187 public void addProperty(final int index,
188 final uk.ac.vamsas.objects.core.Property vProperty)
189 throws java.lang.IndexOutOfBoundsException {
190 this._propertyList.add(index, vProperty);
197 * @throws java.lang.IndexOutOfBoundsException
198 * if the index given is outside the bounds of the collection
200 public void addTree(final uk.ac.vamsas.objects.core.Tree vTree)
201 throws java.lang.IndexOutOfBoundsException {
202 this._treeList.addElement(vTree);
210 * @throws java.lang.IndexOutOfBoundsException
211 * if the index given is outside the bounds of the collection
213 public void addTree(final int index,
214 final uk.ac.vamsas.objects.core.Tree vTree)
215 throws java.lang.IndexOutOfBoundsException {
216 this._treeList.add(index, vTree);
221 public void deleteAligned() {
222 this._has_aligned = false;
226 * Method enumerateAlignmentAnnotation.
228 * @return an Enumeration over all
229 * uk.ac.vamsas.objects.core.AlignmentAnnotation elements
231 public java.util.Enumeration enumerateAlignmentAnnotation() {
232 return this._alignmentAnnotationList.elements();
236 * Method enumerateAlignmentSequence.
238 * @return an Enumeration over all uk.ac.vamsas.objects.core.AlignmentSequence
241 public java.util.Enumeration enumerateAlignmentSequence() {
242 return this._alignmentSequenceList.elements();
246 * Method enumerateProperty.
248 * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
250 public java.util.Enumeration enumerateProperty() {
251 return this._propertyList.elements();
255 * Method enumerateTree.
257 * @return an Enumeration over all uk.ac.vamsas.objects.core.Tree elements
259 public java.util.Enumeration enumerateTree() {
260 return this._treeList.elements();
264 * Overrides the java.lang.Object.equals method.
267 * @return true if the objects are equal.
269 public boolean equals(final java.lang.Object obj) {
273 if (super.equals(obj) == false)
276 if (obj instanceof Alignment) {
278 Alignment temp = (Alignment) obj;
281 if (this._gapChar != null) {
282 if (temp._gapChar == null)
284 if (this._gapChar != temp._gapChar) {
285 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._gapChar);
286 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._gapChar);
287 if (thcycle != tmcycle) {
289 org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
293 org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
299 if (!this._gapChar.equals(temp._gapChar)) {
300 org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
301 org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
304 org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
305 org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
308 } else if (temp._gapChar != null)
310 if (this._aligned != temp._aligned)
312 if (this._has_aligned != temp._has_aligned)
314 if (this._id != null) {
315 if (temp._id == null)
317 if (this._id != temp._id) {
318 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
319 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
320 if (thcycle != tmcycle) {
322 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
326 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
332 if (!this._id.equals(temp._id)) {
333 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
334 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
337 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
338 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
341 } else if (temp._id != null)
343 if (this._modifiable != null) {
344 if (temp._modifiable == null)
346 if (this._modifiable != temp._modifiable) {
347 thcycle = org.castor.util.CycleBreaker
348 .startingToCycle(this._modifiable);
349 tmcycle = org.castor.util.CycleBreaker
350 .startingToCycle(temp._modifiable);
351 if (thcycle != tmcycle) {
353 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
357 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
363 if (!this._modifiable.equals(temp._modifiable)) {
364 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
365 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
368 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
369 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
372 } else if (temp._modifiable != null)
374 if (this._alignmentAnnotationList != null) {
375 if (temp._alignmentAnnotationList == null)
377 if (this._alignmentAnnotationList != temp._alignmentAnnotationList) {
378 thcycle = org.castor.util.CycleBreaker
379 .startingToCycle(this._alignmentAnnotationList);
380 tmcycle = org.castor.util.CycleBreaker
381 .startingToCycle(temp._alignmentAnnotationList);
382 if (thcycle != tmcycle) {
384 org.castor.util.CycleBreaker
385 .releaseCycleHandle(this._alignmentAnnotationList);
389 org.castor.util.CycleBreaker
390 .releaseCycleHandle(temp._alignmentAnnotationList);
396 if (!this._alignmentAnnotationList
397 .equals(temp._alignmentAnnotationList)) {
398 org.castor.util.CycleBreaker
399 .releaseCycleHandle(this._alignmentAnnotationList);
400 org.castor.util.CycleBreaker
401 .releaseCycleHandle(temp._alignmentAnnotationList);
404 org.castor.util.CycleBreaker
405 .releaseCycleHandle(this._alignmentAnnotationList);
406 org.castor.util.CycleBreaker
407 .releaseCycleHandle(temp._alignmentAnnotationList);
410 } else if (temp._alignmentAnnotationList != null)
412 if (this._treeList != null) {
413 if (temp._treeList == null)
415 if (this._treeList != temp._treeList) {
416 thcycle = org.castor.util.CycleBreaker
417 .startingToCycle(this._treeList);
418 tmcycle = org.castor.util.CycleBreaker
419 .startingToCycle(temp._treeList);
420 if (thcycle != tmcycle) {
422 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
426 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
432 if (!this._treeList.equals(temp._treeList)) {
433 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
434 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
437 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
438 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
441 } else if (temp._treeList != null)
443 if (this._alignmentSequenceList != null) {
444 if (temp._alignmentSequenceList == null)
446 if (this._alignmentSequenceList != temp._alignmentSequenceList) {
447 thcycle = org.castor.util.CycleBreaker
448 .startingToCycle(this._alignmentSequenceList);
449 tmcycle = org.castor.util.CycleBreaker
450 .startingToCycle(temp._alignmentSequenceList);
451 if (thcycle != tmcycle) {
453 org.castor.util.CycleBreaker
454 .releaseCycleHandle(this._alignmentSequenceList);
458 org.castor.util.CycleBreaker
459 .releaseCycleHandle(temp._alignmentSequenceList);
465 if (!this._alignmentSequenceList
466 .equals(temp._alignmentSequenceList)) {
467 org.castor.util.CycleBreaker
468 .releaseCycleHandle(this._alignmentSequenceList);
469 org.castor.util.CycleBreaker
470 .releaseCycleHandle(temp._alignmentSequenceList);
473 org.castor.util.CycleBreaker
474 .releaseCycleHandle(this._alignmentSequenceList);
475 org.castor.util.CycleBreaker
476 .releaseCycleHandle(temp._alignmentSequenceList);
479 } else if (temp._alignmentSequenceList != null)
481 if (this._propertyList != null) {
482 if (temp._propertyList == null)
484 if (this._propertyList != temp._propertyList) {
485 thcycle = org.castor.util.CycleBreaker
486 .startingToCycle(this._propertyList);
487 tmcycle = org.castor.util.CycleBreaker
488 .startingToCycle(temp._propertyList);
489 if (thcycle != tmcycle) {
491 org.castor.util.CycleBreaker
492 .releaseCycleHandle(this._propertyList);
496 org.castor.util.CycleBreaker
497 .releaseCycleHandle(temp._propertyList);
503 if (!this._propertyList.equals(temp._propertyList)) {
504 org.castor.util.CycleBreaker
505 .releaseCycleHandle(this._propertyList);
506 org.castor.util.CycleBreaker
507 .releaseCycleHandle(temp._propertyList);
510 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
511 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
514 } else if (temp._propertyList != null)
516 if (this._provenance != null) {
517 if (temp._provenance == null)
519 if (this._provenance != temp._provenance) {
520 thcycle = org.castor.util.CycleBreaker
521 .startingToCycle(this._provenance);
522 tmcycle = org.castor.util.CycleBreaker
523 .startingToCycle(temp._provenance);
524 if (thcycle != tmcycle) {
526 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
530 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
536 if (!this._provenance.equals(temp._provenance)) {
537 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
538 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
541 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
542 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
545 } else if (temp._provenance != null)
553 * Returns the value of field 'aligned'.
555 * @return the value of field 'Aligned'.
557 public boolean getAligned() {
558 return this._aligned;
562 * Method getAlignmentAnnotation.
565 * @throws java.lang.IndexOutOfBoundsException
566 * if the index given is outside the bounds of the collection
567 * @return the value of the uk.ac.vamsas.objects.core.AlignmentAnnotation at
570 public uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(
571 final int index) throws java.lang.IndexOutOfBoundsException {
572 // check bounds for index
573 if (index < 0 || index >= this._alignmentAnnotationList.size()) {
574 throw new IndexOutOfBoundsException(
575 "getAlignmentAnnotation: Index value '" + index
576 + "' not in range [0.."
577 + (this._alignmentAnnotationList.size() - 1) + "]");
580 return (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList
585 * Method getAlignmentAnnotation.Returns the contents of the collection in an
588 * Note: Just in case the collection contents are changing in another thread,
589 * we pass a 0-length Array of the correct type into the API call. This way we
590 * <i>know</i> that the Array returned is of exactly the correct length.
592 * @return this collection as an Array
594 public uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation() {
595 uk.ac.vamsas.objects.core.AlignmentAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentAnnotation[0];
596 return (uk.ac.vamsas.objects.core.AlignmentAnnotation[]) this._alignmentAnnotationList
601 * Method getAlignmentAnnotationAsReference.Returns a reference to
602 * '_alignmentAnnotationList'. No type checking is performed on any
603 * modifications to the Vector.
605 * @return a reference to the Vector backing this class
607 public java.util.Vector getAlignmentAnnotationAsReference() {
608 return this._alignmentAnnotationList;
612 * Method getAlignmentAnnotationCount.
614 * @return the size of this collection
616 public int getAlignmentAnnotationCount() {
617 return this._alignmentAnnotationList.size();
621 * Method getAlignmentSequence.
624 * @throws java.lang.IndexOutOfBoundsException
625 * if the index given is outside the bounds of the collection
626 * @return the value of the uk.ac.vamsas.objects.core.AlignmentSequence at the
629 public uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(
630 final int index) throws java.lang.IndexOutOfBoundsException {
631 // check bounds for index
632 if (index < 0 || index >= this._alignmentSequenceList.size()) {
633 throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"
634 + index + "' not in range [0.."
635 + (this._alignmentSequenceList.size() - 1) + "]");
638 return (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList
643 * Method getAlignmentSequence.Returns the contents of the collection in an
646 * Note: Just in case the collection contents are changing in another thread,
647 * we pass a 0-length Array of the correct type into the API call. This way we
648 * <i>know</i> that the Array returned is of exactly the correct length.
650 * @return this collection as an Array
652 public uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() {
653 uk.ac.vamsas.objects.core.AlignmentSequence[] array = new uk.ac.vamsas.objects.core.AlignmentSequence[0];
654 return (uk.ac.vamsas.objects.core.AlignmentSequence[]) this._alignmentSequenceList
659 * Method getAlignmentSequenceAsReference.Returns a reference to
660 * '_alignmentSequenceList'. No type checking is performed on any
661 * modifications to the Vector.
663 * @return a reference to the Vector backing this class
665 public java.util.Vector getAlignmentSequenceAsReference() {
666 return this._alignmentSequenceList;
670 * Method getAlignmentSequenceCount.
672 * @return the size of this collection
674 public int getAlignmentSequenceCount() {
675 return this._alignmentSequenceList.size();
679 * Returns the value of field 'gapChar'.
681 * @return the value of field 'GapChar'.
683 public java.lang.String getGapChar() {
684 return this._gapChar;
688 * Returns the value of field 'id'. The field 'id' has the following
689 * description: Primary Key for vamsas object referencing
692 * @return the value of field 'Id'.
694 public java.lang.String getId() {
699 * Returns the value of field 'modifiable'.
701 * @return the value of field 'Modifiable'.
703 public java.lang.String getModifiable() {
704 return this._modifiable;
708 * Method getProperty.
711 * @throws java.lang.IndexOutOfBoundsException
712 * if the index given is outside the bounds of the collection
713 * @return the value of the uk.ac.vamsas.objects.core.Property at the given
716 public uk.ac.vamsas.objects.core.Property getProperty(final int index)
717 throws java.lang.IndexOutOfBoundsException {
718 // check bounds for index
719 if (index < 0 || index >= this._propertyList.size()) {
720 throw new IndexOutOfBoundsException("getProperty: Index value '" + index
721 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
724 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
728 * Method getProperty.Returns the contents of the collection in an Array.
730 * Note: Just in case the collection contents are changing in another thread,
731 * we pass a 0-length Array of the correct type into the API call. This way we
732 * <i>know</i> that the Array returned is of exactly the correct length.
734 * @return this collection as an Array
736 public uk.ac.vamsas.objects.core.Property[] getProperty() {
737 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
738 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
743 * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
744 * type checking is performed on any modifications to the Vector.
746 * @return a reference to the Vector backing this class
748 public java.util.Vector getPropertyAsReference() {
749 return this._propertyList;
753 * Method getPropertyCount.
755 * @return the size of this collection
757 public int getPropertyCount() {
758 return this._propertyList.size();
762 * Returns the value of field 'provenance'.
764 * @return the value of field 'Provenance'.
766 public uk.ac.vamsas.objects.core.Provenance getProvenance() {
767 return this._provenance;
774 * @throws java.lang.IndexOutOfBoundsException
775 * if the index given is outside the bounds of the collection
776 * @return the value of the uk.ac.vamsas.objects.core.Tree at the given index
778 public uk.ac.vamsas.objects.core.Tree getTree(final int index)
779 throws java.lang.IndexOutOfBoundsException {
780 // check bounds for index
781 if (index < 0 || index >= this._treeList.size()) {
782 throw new IndexOutOfBoundsException("getTree: Index value '" + index
783 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
786 return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
790 * Method getTree.Returns the contents of the collection in an Array.
792 * Note: Just in case the collection contents are changing in another thread,
793 * we pass a 0-length Array of the correct type into the API call. This way we
794 * <i>know</i> that the Array returned is of exactly the correct length.
796 * @return this collection as an Array
798 public uk.ac.vamsas.objects.core.Tree[] getTree() {
799 uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
800 return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
804 * Method getTreeAsReference.Returns a reference to '_treeList'. No type
805 * checking is performed on any modifications to the Vector.
807 * @return a reference to the Vector backing this class
809 public java.util.Vector getTreeAsReference() {
810 return this._treeList;
814 * Method getTreeCount.
816 * @return the size of this collection
818 public int getTreeCount() {
819 return this._treeList.size();
825 * @return true if at least one Aligned has been added
827 public boolean hasAligned() {
828 return this._has_aligned;
832 * Overrides the java.lang.Object.hashCode method.
834 * The following steps came from <b>Effective Java Programming Language
835 * Guide</b> by Joshua Bloch, Chapter 3
837 * @return a hash code value for the object.
839 public int hashCode() {
840 int result = super.hashCode();
844 && !org.castor.util.CycleBreaker.startingToCycle(_gapChar)) {
845 result = 37 * result + _gapChar.hashCode();
846 org.castor.util.CycleBreaker.releaseCycleHandle(_gapChar);
848 result = 37 * result + (_aligned ? 0 : 1);
849 if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
850 result = 37 * result + _id.hashCode();
851 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
853 if (_modifiable != null
854 && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
855 result = 37 * result + _modifiable.hashCode();
856 org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
858 if (_alignmentAnnotationList != null
859 && !org.castor.util.CycleBreaker
860 .startingToCycle(_alignmentAnnotationList)) {
861 result = 37 * result + _alignmentAnnotationList.hashCode();
862 org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentAnnotationList);
864 if (_treeList != null
865 && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
866 result = 37 * result + _treeList.hashCode();
867 org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
869 if (_alignmentSequenceList != null
870 && !org.castor.util.CycleBreaker
871 .startingToCycle(_alignmentSequenceList)) {
872 result = 37 * result + _alignmentSequenceList.hashCode();
873 org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentSequenceList);
875 if (_propertyList != null
876 && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
877 result = 37 * result + _propertyList.hashCode();
878 org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
880 if (_provenance != null
881 && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
882 result = 37 * result + _provenance.hashCode();
883 org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
890 * Returns the value of field 'aligned'.
892 * @return the value of field 'Aligned'.
894 public boolean isAligned() {
895 return this._aligned;
901 * @return true if this object is valid according to the schema
903 public boolean isValid() {
906 } catch (org.exolab.castor.xml.ValidationException vex) {
916 * @throws org.exolab.castor.xml.MarshalException
917 * if object is null or if any SAXException is thrown during
919 * @throws org.exolab.castor.xml.ValidationException
920 * if this object is an invalid instance according to the schema
922 public void marshal(final java.io.Writer out)
923 throws org.exolab.castor.xml.MarshalException,
924 org.exolab.castor.xml.ValidationException {
925 Marshaller.marshal(this, out);
932 * @throws java.io.IOException
933 * if an IOException occurs during marshaling
934 * @throws org.exolab.castor.xml.ValidationException
935 * if this object is an invalid instance according to the schema
936 * @throws org.exolab.castor.xml.MarshalException
937 * if object is null or if any SAXException is thrown during
940 public void marshal(final org.xml.sax.ContentHandler handler)
941 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
942 org.exolab.castor.xml.ValidationException {
943 Marshaller.marshal(this, handler);
947 * Method removeAlignmentAnnotation.
949 * @param vAlignmentAnnotation
950 * @return true if the object was removed from the collection.
952 public boolean removeAlignmentAnnotation(
953 final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation) {
954 boolean removed = _alignmentAnnotationList.remove(vAlignmentAnnotation);
959 * Method removeAlignmentAnnotationAt.
962 * @return the element removed from the collection
964 public uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotationAt(
966 java.lang.Object obj = this._alignmentAnnotationList.remove(index);
967 return (uk.ac.vamsas.objects.core.AlignmentAnnotation) obj;
971 * Method removeAlignmentSequence.
973 * @param vAlignmentSequence
974 * @return true if the object was removed from the collection.
976 public boolean removeAlignmentSequence(
977 final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence) {
978 boolean removed = _alignmentSequenceList.remove(vAlignmentSequence);
983 * Method removeAlignmentSequenceAt.
986 * @return the element removed from the collection
988 public uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequenceAt(
990 java.lang.Object obj = this._alignmentSequenceList.remove(index);
991 return (uk.ac.vamsas.objects.core.AlignmentSequence) obj;
996 public void removeAllAlignmentAnnotation() {
997 this._alignmentAnnotationList.clear();
1002 public void removeAllAlignmentSequence() {
1003 this._alignmentSequenceList.clear();
1008 public void removeAllProperty() {
1009 this._propertyList.clear();
1014 public void removeAllTree() {
1015 this._treeList.clear();
1019 * Method removeProperty.
1022 * @return true if the object was removed from the collection.
1024 public boolean removeProperty(
1025 final uk.ac.vamsas.objects.core.Property vProperty) {
1026 boolean removed = _propertyList.remove(vProperty);
1031 * Method removePropertyAt.
1034 * @return the element removed from the collection
1036 public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
1037 java.lang.Object obj = this._propertyList.remove(index);
1038 return (uk.ac.vamsas.objects.core.Property) obj;
1042 * Method removeTree.
1045 * @return true if the object was removed from the collection.
1047 public boolean removeTree(final uk.ac.vamsas.objects.core.Tree vTree) {
1048 boolean removed = _treeList.remove(vTree);
1053 * Method removeTreeAt.
1056 * @return the element removed from the collection
1058 public uk.ac.vamsas.objects.core.Tree removeTreeAt(final int index) {
1059 java.lang.Object obj = this._treeList.remove(index);
1060 return (uk.ac.vamsas.objects.core.Tree) obj;
1064 * Sets the value of field 'aligned'.
1067 * the value of field 'aligned'.
1069 public void setAligned(final boolean aligned) {
1070 this._aligned = aligned;
1071 this._has_aligned = true;
1078 * @param vAlignmentAnnotation
1079 * @throws java.lang.IndexOutOfBoundsException
1080 * if the index given is outside the bounds of the collection
1082 public void setAlignmentAnnotation(final int index,
1083 final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
1084 throws java.lang.IndexOutOfBoundsException {
1085 // check bounds for index
1086 if (index < 0 || index >= this._alignmentAnnotationList.size()) {
1087 throw new IndexOutOfBoundsException(
1088 "setAlignmentAnnotation: Index value '" + index
1089 + "' not in range [0.."
1090 + (this._alignmentAnnotationList.size() - 1) + "]");
1093 this._alignmentAnnotationList.set(index, vAlignmentAnnotation);
1099 * @param vAlignmentAnnotationArray
1101 public void setAlignmentAnnotation(
1102 final uk.ac.vamsas.objects.core.AlignmentAnnotation[] vAlignmentAnnotationArray) {
1104 _alignmentAnnotationList.clear();
1106 for (int i = 0; i < vAlignmentAnnotationArray.length; i++) {
1107 this._alignmentAnnotationList.add(vAlignmentAnnotationArray[i]);
1112 * Sets the value of '_alignmentAnnotationList' by copying the given Vector.
1113 * All elements will be checked for type safety.
1115 * @param vAlignmentAnnotationList
1116 * the Vector to copy.
1118 public void setAlignmentAnnotation(
1119 final java.util.Vector vAlignmentAnnotationList) {
1121 this._alignmentAnnotationList.clear();
1123 this._alignmentAnnotationList.addAll(vAlignmentAnnotationList);
1127 * Sets the value of '_alignmentAnnotationList' by setting it to the given
1128 * Vector. No type checking is performed.
1132 * @param alignmentAnnotationVector
1133 * the Vector to set.
1135 public void setAlignmentAnnotationAsReference(
1136 final java.util.Vector alignmentAnnotationVector) {
1137 this._alignmentAnnotationList = alignmentAnnotationVector;
1144 * @param vAlignmentSequence
1145 * @throws java.lang.IndexOutOfBoundsException
1146 * if the index given is outside the bounds of the collection
1148 public void setAlignmentSequence(final int index,
1149 final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
1150 throws java.lang.IndexOutOfBoundsException {
1151 // check bounds for index
1152 if (index < 0 || index >= this._alignmentSequenceList.size()) {
1153 throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"
1154 + index + "' not in range [0.."
1155 + (this._alignmentSequenceList.size() - 1) + "]");
1158 this._alignmentSequenceList.set(index, vAlignmentSequence);
1164 * @param vAlignmentSequenceArray
1166 public void setAlignmentSequence(
1167 final uk.ac.vamsas.objects.core.AlignmentSequence[] vAlignmentSequenceArray) {
1169 _alignmentSequenceList.clear();
1171 for (int i = 0; i < vAlignmentSequenceArray.length; i++) {
1172 this._alignmentSequenceList.add(vAlignmentSequenceArray[i]);
1177 * Sets the value of '_alignmentSequenceList' by copying the given Vector. All
1178 * elements will be checked for type safety.
1180 * @param vAlignmentSequenceList
1181 * the Vector to copy.
1183 public void setAlignmentSequence(final java.util.Vector vAlignmentSequenceList) {
1185 this._alignmentSequenceList.clear();
1187 this._alignmentSequenceList.addAll(vAlignmentSequenceList);
1191 * Sets the value of '_alignmentSequenceList' by setting it to the given
1192 * Vector. No type checking is performed.
1196 * @param alignmentSequenceVector
1197 * the Vector to set.
1199 public void setAlignmentSequenceAsReference(
1200 final java.util.Vector alignmentSequenceVector) {
1201 this._alignmentSequenceList = alignmentSequenceVector;
1205 * Sets the value of field 'gapChar'.
1208 * the value of field 'gapChar'.
1210 public void setGapChar(final java.lang.String gapChar) {
1211 this._gapChar = gapChar;
1215 * Sets the value of field 'id'. The field 'id' has the following description:
1216 * Primary Key for vamsas object referencing
1220 * the value of field 'id'.
1222 public void setId(final java.lang.String id) {
1227 * Sets the value of field 'modifiable'.
1230 * the value of field 'modifiable'.
1232 public void setModifiable(final java.lang.String modifiable) {
1233 this._modifiable = modifiable;
1241 * @throws java.lang.IndexOutOfBoundsException
1242 * if the index given is outside the bounds of the collection
1244 public void setProperty(final int index,
1245 final uk.ac.vamsas.objects.core.Property vProperty)
1246 throws java.lang.IndexOutOfBoundsException {
1247 // check bounds for index
1248 if (index < 0 || index >= this._propertyList.size()) {
1249 throw new IndexOutOfBoundsException("setProperty: Index value '" + index
1250 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
1253 this._propertyList.set(index, vProperty);
1259 * @param vPropertyArray
1261 public void setProperty(
1262 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
1264 _propertyList.clear();
1266 for (int i = 0; i < vPropertyArray.length; i++) {
1267 this._propertyList.add(vPropertyArray[i]);
1272 * Sets the value of '_propertyList' by copying the given Vector. All elements
1273 * will be checked for type safety.
1275 * @param vPropertyList
1276 * the Vector to copy.
1278 public void setProperty(final java.util.Vector vPropertyList) {
1280 this._propertyList.clear();
1282 this._propertyList.addAll(vPropertyList);
1286 * Sets the value of '_propertyList' by setting it to the given Vector. No
1287 * type checking is performed.
1291 * @param propertyVector
1292 * the Vector to set.
1294 public void setPropertyAsReference(final java.util.Vector propertyVector) {
1295 this._propertyList = propertyVector;
1299 * Sets the value of field 'provenance'.
1302 * the value of field 'provenance'.
1304 public void setProvenance(
1305 final uk.ac.vamsas.objects.core.Provenance provenance) {
1306 this._provenance = provenance;
1314 * @throws java.lang.IndexOutOfBoundsException
1315 * if the index given is outside the bounds of the collection
1317 public void setTree(final int index,
1318 final uk.ac.vamsas.objects.core.Tree vTree)
1319 throws java.lang.IndexOutOfBoundsException {
1320 // check bounds for index
1321 if (index < 0 || index >= this._treeList.size()) {
1322 throw new IndexOutOfBoundsException("setTree: Index value '" + index
1323 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
1326 this._treeList.set(index, vTree);
1334 public void setTree(final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
1338 for (int i = 0; i < vTreeArray.length; i++) {
1339 this._treeList.add(vTreeArray[i]);
1344 * Sets the value of '_treeList' by copying the given Vector. All elements
1345 * will be checked for type safety.
1348 * the Vector to copy.
1350 public void setTree(final java.util.Vector vTreeList) {
1352 this._treeList.clear();
1354 this._treeList.addAll(vTreeList);
1358 * Sets the value of '_treeList' by setting it to the given Vector. No type
1359 * checking is performed.
1364 * the Vector to set.
1366 public void setTreeAsReference(final java.util.Vector treeVector) {
1367 this._treeList = treeVector;
1374 * @throws org.exolab.castor.xml.MarshalException
1375 * if object is null or if any SAXException is thrown during
1377 * @throws org.exolab.castor.xml.ValidationException
1378 * if this object is an invalid instance according to the schema
1379 * @return the unmarshaled uk.ac.vamsas.objects.core.Alignment
1381 public static uk.ac.vamsas.objects.core.Alignment unmarshal(
1382 final java.io.Reader reader)
1383 throws org.exolab.castor.xml.MarshalException,
1384 org.exolab.castor.xml.ValidationException {
1385 return (uk.ac.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(
1386 uk.ac.vamsas.objects.core.Alignment.class, reader);
1392 * @throws org.exolab.castor.xml.ValidationException
1393 * if this object is an invalid instance according to the schema
1395 public void validate() throws org.exolab.castor.xml.ValidationException {
1396 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1397 validator.validate(this);