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 DataSet extends uk.ac.vamsas.client.Vobject implements
38 java.io.Serializable {
40 // --------------------------/
41 // - Class/Member Variables -/
42 // --------------------------/
45 * Primary Key for vamsas object referencing
47 private java.lang.String _id;
50 * Field _sequenceList.
52 private java.util.Vector _sequenceList;
55 * Field _sequenceMappingList.
57 private java.util.Vector _sequenceMappingList;
60 * Field _dataSetAnnotationsList.
62 private java.util.Vector _dataSetAnnotationsList;
65 * Field _alignmentList.
67 private java.util.Vector _alignmentList;
72 private java.util.Vector _treeList;
77 private uk.ac.vamsas.objects.core.Provenance _provenance;
85 this._sequenceList = new java.util.Vector();
86 this._sequenceMappingList = new java.util.Vector();
87 this._dataSetAnnotationsList = new java.util.Vector();
88 this._alignmentList = new java.util.Vector();
89 this._treeList = new java.util.Vector();
100 * @throws java.lang.IndexOutOfBoundsException
101 * if the index given is outside the bounds of the collection
103 public void addAlignment(final uk.ac.vamsas.objects.core.Alignment vAlignment)
104 throws java.lang.IndexOutOfBoundsException {
105 this._alignmentList.addElement(vAlignment);
113 * @throws java.lang.IndexOutOfBoundsException
114 * if the index given is outside the bounds of the collection
116 public void addAlignment(final int index,
117 final uk.ac.vamsas.objects.core.Alignment vAlignment)
118 throws java.lang.IndexOutOfBoundsException {
119 this._alignmentList.add(index, vAlignment);
125 * @param vDataSetAnnotations
126 * @throws java.lang.IndexOutOfBoundsException
127 * if the index given is outside the bounds of the collection
129 public void addDataSetAnnotations(
130 final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
131 throws java.lang.IndexOutOfBoundsException {
132 this._dataSetAnnotationsList.addElement(vDataSetAnnotations);
139 * @param vDataSetAnnotations
140 * @throws java.lang.IndexOutOfBoundsException
141 * if the index given is outside the bounds of the collection
143 public void addDataSetAnnotations(final int index,
144 final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
145 throws java.lang.IndexOutOfBoundsException {
146 this._dataSetAnnotationsList.add(index, vDataSetAnnotations);
153 * @throws java.lang.IndexOutOfBoundsException
154 * if the index given is outside the bounds of the collection
156 public void addSequence(final uk.ac.vamsas.objects.core.Sequence vSequence)
157 throws java.lang.IndexOutOfBoundsException {
158 this._sequenceList.addElement(vSequence);
166 * @throws java.lang.IndexOutOfBoundsException
167 * if the index given is outside the bounds of the collection
169 public void addSequence(final int index,
170 final uk.ac.vamsas.objects.core.Sequence vSequence)
171 throws java.lang.IndexOutOfBoundsException {
172 this._sequenceList.add(index, vSequence);
178 * @param vSequenceMapping
179 * @throws java.lang.IndexOutOfBoundsException
180 * if the index given is outside the bounds of the collection
182 public void addSequenceMapping(
183 final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
184 throws java.lang.IndexOutOfBoundsException {
185 this._sequenceMappingList.addElement(vSequenceMapping);
192 * @param vSequenceMapping
193 * @throws java.lang.IndexOutOfBoundsException
194 * if the index given is outside the bounds of the collection
196 public void addSequenceMapping(final int index,
197 final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
198 throws java.lang.IndexOutOfBoundsException {
199 this._sequenceMappingList.add(index, vSequenceMapping);
206 * @throws java.lang.IndexOutOfBoundsException
207 * if the index given is outside the bounds of the collection
209 public void addTree(final uk.ac.vamsas.objects.core.Tree vTree)
210 throws java.lang.IndexOutOfBoundsException {
211 this._treeList.addElement(vTree);
219 * @throws java.lang.IndexOutOfBoundsException
220 * if the index given is outside the bounds of the collection
222 public void addTree(final int index,
223 final uk.ac.vamsas.objects.core.Tree vTree)
224 throws java.lang.IndexOutOfBoundsException {
225 this._treeList.add(index, vTree);
229 * Method enumerateAlignment.
231 * @return an Enumeration over all uk.ac.vamsas.objects.core.Alignment
234 public java.util.Enumeration enumerateAlignment() {
235 return this._alignmentList.elements();
239 * Method enumerateDataSetAnnotations.
241 * @return an Enumeration over all
242 * uk.ac.vamsas.objects.core.DataSetAnnotations elements
244 public java.util.Enumeration enumerateDataSetAnnotations() {
245 return this._dataSetAnnotationsList.elements();
249 * Method enumerateSequence.
251 * @return an Enumeration over all uk.ac.vamsas.objects.core.Sequence elements
253 public java.util.Enumeration enumerateSequence() {
254 return this._sequenceList.elements();
258 * Method enumerateSequenceMapping.
260 * @return an Enumeration over all uk.ac.vamsas.objects.core.SequenceMapping
263 public java.util.Enumeration enumerateSequenceMapping() {
264 return this._sequenceMappingList.elements();
268 * Method enumerateTree.
270 * @return an Enumeration over all uk.ac.vamsas.objects.core.Tree elements
272 public java.util.Enumeration enumerateTree() {
273 return this._treeList.elements();
277 * Overrides the java.lang.Object.equals method.
280 * @return true if the objects are equal.
282 public boolean equals(final java.lang.Object obj) {
286 if (super.equals(obj) == false)
289 if (obj instanceof DataSet) {
291 DataSet temp = (DataSet) obj;
294 if (this._id != null) {
295 if (temp._id == null)
297 if (this._id != temp._id) {
298 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
299 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
300 if (thcycle != tmcycle) {
302 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
306 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
312 if (!this._id.equals(temp._id)) {
313 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
314 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
317 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
318 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
321 } else if (temp._id != null)
323 if (this._sequenceList != null) {
324 if (temp._sequenceList == null)
326 if (this._sequenceList != temp._sequenceList) {
327 thcycle = org.castor.util.CycleBreaker
328 .startingToCycle(this._sequenceList);
329 tmcycle = org.castor.util.CycleBreaker
330 .startingToCycle(temp._sequenceList);
331 if (thcycle != tmcycle) {
333 org.castor.util.CycleBreaker
334 .releaseCycleHandle(this._sequenceList);
338 org.castor.util.CycleBreaker
339 .releaseCycleHandle(temp._sequenceList);
345 if (!this._sequenceList.equals(temp._sequenceList)) {
346 org.castor.util.CycleBreaker
347 .releaseCycleHandle(this._sequenceList);
348 org.castor.util.CycleBreaker
349 .releaseCycleHandle(temp._sequenceList);
352 org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceList);
353 org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceList);
356 } else if (temp._sequenceList != null)
358 if (this._sequenceMappingList != null) {
359 if (temp._sequenceMappingList == null)
361 if (this._sequenceMappingList != temp._sequenceMappingList) {
362 thcycle = org.castor.util.CycleBreaker
363 .startingToCycle(this._sequenceMappingList);
364 tmcycle = org.castor.util.CycleBreaker
365 .startingToCycle(temp._sequenceMappingList);
366 if (thcycle != tmcycle) {
368 org.castor.util.CycleBreaker
369 .releaseCycleHandle(this._sequenceMappingList);
373 org.castor.util.CycleBreaker
374 .releaseCycleHandle(temp._sequenceMappingList);
380 if (!this._sequenceMappingList.equals(temp._sequenceMappingList)) {
381 org.castor.util.CycleBreaker
382 .releaseCycleHandle(this._sequenceMappingList);
383 org.castor.util.CycleBreaker
384 .releaseCycleHandle(temp._sequenceMappingList);
387 org.castor.util.CycleBreaker
388 .releaseCycleHandle(this._sequenceMappingList);
389 org.castor.util.CycleBreaker
390 .releaseCycleHandle(temp._sequenceMappingList);
393 } else if (temp._sequenceMappingList != null)
395 if (this._dataSetAnnotationsList != null) {
396 if (temp._dataSetAnnotationsList == null)
398 if (this._dataSetAnnotationsList != temp._dataSetAnnotationsList) {
399 thcycle = org.castor.util.CycleBreaker
400 .startingToCycle(this._dataSetAnnotationsList);
401 tmcycle = org.castor.util.CycleBreaker
402 .startingToCycle(temp._dataSetAnnotationsList);
403 if (thcycle != tmcycle) {
405 org.castor.util.CycleBreaker
406 .releaseCycleHandle(this._dataSetAnnotationsList);
410 org.castor.util.CycleBreaker
411 .releaseCycleHandle(temp._dataSetAnnotationsList);
417 if (!this._dataSetAnnotationsList
418 .equals(temp._dataSetAnnotationsList)) {
419 org.castor.util.CycleBreaker
420 .releaseCycleHandle(this._dataSetAnnotationsList);
421 org.castor.util.CycleBreaker
422 .releaseCycleHandle(temp._dataSetAnnotationsList);
425 org.castor.util.CycleBreaker
426 .releaseCycleHandle(this._dataSetAnnotationsList);
427 org.castor.util.CycleBreaker
428 .releaseCycleHandle(temp._dataSetAnnotationsList);
431 } else if (temp._dataSetAnnotationsList != null)
433 if (this._alignmentList != null) {
434 if (temp._alignmentList == null)
436 if (this._alignmentList != temp._alignmentList) {
437 thcycle = org.castor.util.CycleBreaker
438 .startingToCycle(this._alignmentList);
439 tmcycle = org.castor.util.CycleBreaker
440 .startingToCycle(temp._alignmentList);
441 if (thcycle != tmcycle) {
443 org.castor.util.CycleBreaker
444 .releaseCycleHandle(this._alignmentList);
448 org.castor.util.CycleBreaker
449 .releaseCycleHandle(temp._alignmentList);
455 if (!this._alignmentList.equals(temp._alignmentList)) {
456 org.castor.util.CycleBreaker
457 .releaseCycleHandle(this._alignmentList);
458 org.castor.util.CycleBreaker
459 .releaseCycleHandle(temp._alignmentList);
462 org.castor.util.CycleBreaker
463 .releaseCycleHandle(this._alignmentList);
464 org.castor.util.CycleBreaker
465 .releaseCycleHandle(temp._alignmentList);
468 } else if (temp._alignmentList != null)
470 if (this._treeList != null) {
471 if (temp._treeList == null)
473 if (this._treeList != temp._treeList) {
474 thcycle = org.castor.util.CycleBreaker
475 .startingToCycle(this._treeList);
476 tmcycle = org.castor.util.CycleBreaker
477 .startingToCycle(temp._treeList);
478 if (thcycle != tmcycle) {
480 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
484 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
490 if (!this._treeList.equals(temp._treeList)) {
491 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
492 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
495 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
496 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
499 } else if (temp._treeList != null)
501 if (this._provenance != null) {
502 if (temp._provenance == null)
504 if (this._provenance != temp._provenance) {
505 thcycle = org.castor.util.CycleBreaker
506 .startingToCycle(this._provenance);
507 tmcycle = org.castor.util.CycleBreaker
508 .startingToCycle(temp._provenance);
509 if (thcycle != tmcycle) {
511 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
515 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
521 if (!this._provenance.equals(temp._provenance)) {
522 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
523 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
526 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
527 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
530 } else if (temp._provenance != null)
538 * Method getAlignment.
541 * @throws java.lang.IndexOutOfBoundsException
542 * if the index given is outside the bounds of the collection
543 * @return the value of the uk.ac.vamsas.objects.core.Alignment at the given
546 public uk.ac.vamsas.objects.core.Alignment getAlignment(final int index)
547 throws java.lang.IndexOutOfBoundsException {
548 // check bounds for index
549 if (index < 0 || index >= this._alignmentList.size()) {
550 throw new IndexOutOfBoundsException("getAlignment: Index value '" + index
551 + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
554 return (uk.ac.vamsas.objects.core.Alignment) _alignmentList.get(index);
558 * Method getAlignment.Returns the contents of the collection in an Array.
560 * Note: Just in case the collection contents are changing in another thread,
561 * we pass a 0-length Array of the correct type into the API call. This way we
562 * <i>know</i> that the Array returned is of exactly the correct length.
564 * @return this collection as an Array
566 public uk.ac.vamsas.objects.core.Alignment[] getAlignment() {
567 uk.ac.vamsas.objects.core.Alignment[] array = new uk.ac.vamsas.objects.core.Alignment[0];
568 return (uk.ac.vamsas.objects.core.Alignment[]) this._alignmentList
573 * Method getAlignmentAsReference.Returns a reference to '_alignmentList'. No
574 * type checking is performed on any modifications to the Vector.
576 * @return a reference to the Vector backing this class
578 public java.util.Vector getAlignmentAsReference() {
579 return this._alignmentList;
583 * Method getAlignmentCount.
585 * @return the size of this collection
587 public int getAlignmentCount() {
588 return this._alignmentList.size();
592 * Method getDataSetAnnotations.
595 * @throws java.lang.IndexOutOfBoundsException
596 * if the index given is outside the bounds of the collection
597 * @return the value of the uk.ac.vamsas.objects.core.DataSetAnnotations at
600 public uk.ac.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(
601 final int index) throws java.lang.IndexOutOfBoundsException {
602 // check bounds for index
603 if (index < 0 || index >= this._dataSetAnnotationsList.size()) {
604 throw new IndexOutOfBoundsException(
605 "getDataSetAnnotations: Index value '" + index
606 + "' not in range [0.."
607 + (this._dataSetAnnotationsList.size() - 1) + "]");
610 return (uk.ac.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList
615 * Method getDataSetAnnotations.Returns the contents of the collection in an
618 * Note: Just in case the collection contents are changing in another thread,
619 * we pass a 0-length Array of the correct type into the API call. This way we
620 * <i>know</i> that the Array returned is of exactly the correct length.
622 * @return this collection as an Array
624 public uk.ac.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations() {
625 uk.ac.vamsas.objects.core.DataSetAnnotations[] array = new uk.ac.vamsas.objects.core.DataSetAnnotations[0];
626 return (uk.ac.vamsas.objects.core.DataSetAnnotations[]) this._dataSetAnnotationsList
631 * Method getDataSetAnnotationsAsReference.Returns a reference to
632 * '_dataSetAnnotationsList'. No type checking is performed on any
633 * modifications to the Vector.
635 * @return a reference to the Vector backing this class
637 public java.util.Vector getDataSetAnnotationsAsReference() {
638 return this._dataSetAnnotationsList;
642 * Method getDataSetAnnotationsCount.
644 * @return the size of this collection
646 public int getDataSetAnnotationsCount() {
647 return this._dataSetAnnotationsList.size();
651 * Returns the value of field 'id'. The field 'id' has the following
652 * description: Primary Key for vamsas object referencing
654 * @return the value of field 'Id'.
656 public java.lang.String getId() {
661 * Returns the value of field 'provenance'.
663 * @return the value of field 'Provenance'.
665 public uk.ac.vamsas.objects.core.Provenance getProvenance() {
666 return this._provenance;
670 * Method getSequence.
673 * @throws java.lang.IndexOutOfBoundsException
674 * if the index given is outside the bounds of the collection
675 * @return the value of the uk.ac.vamsas.objects.core.Sequence at the given
678 public uk.ac.vamsas.objects.core.Sequence getSequence(final int index)
679 throws java.lang.IndexOutOfBoundsException {
680 // check bounds for index
681 if (index < 0 || index >= this._sequenceList.size()) {
682 throw new IndexOutOfBoundsException("getSequence: Index value '" + index
683 + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
686 return (uk.ac.vamsas.objects.core.Sequence) _sequenceList.get(index);
690 * Method getSequence.Returns the contents of the collection in an Array.
692 * Note: Just in case the collection contents are changing in another thread,
693 * we pass a 0-length Array of the correct type into the API call. This way we
694 * <i>know</i> that the Array returned is of exactly the correct length.
696 * @return this collection as an Array
698 public uk.ac.vamsas.objects.core.Sequence[] getSequence() {
699 uk.ac.vamsas.objects.core.Sequence[] array = new uk.ac.vamsas.objects.core.Sequence[0];
700 return (uk.ac.vamsas.objects.core.Sequence[]) this._sequenceList
705 * Method getSequenceAsReference.Returns a reference to '_sequenceList'. No
706 * type checking is performed on any modifications to the Vector.
708 * @return a reference to the Vector backing this class
710 public java.util.Vector getSequenceAsReference() {
711 return this._sequenceList;
715 * Method getSequenceCount.
717 * @return the size of this collection
719 public int getSequenceCount() {
720 return this._sequenceList.size();
724 * Method getSequenceMapping.
727 * @throws java.lang.IndexOutOfBoundsException
728 * if the index given is outside the bounds of the collection
729 * @return the value of the uk.ac.vamsas.objects.core.SequenceMapping at the
732 public uk.ac.vamsas.objects.core.SequenceMapping getSequenceMapping(
733 final int index) throws java.lang.IndexOutOfBoundsException {
734 // check bounds for index
735 if (index < 0 || index >= this._sequenceMappingList.size()) {
736 throw new IndexOutOfBoundsException("getSequenceMapping: Index value '"
737 + index + "' not in range [0.."
738 + (this._sequenceMappingList.size() - 1) + "]");
741 return (uk.ac.vamsas.objects.core.SequenceMapping) _sequenceMappingList
746 * Method getSequenceMapping.Returns the contents of the collection in an
749 * Note: Just in case the collection contents are changing in another thread,
750 * we pass a 0-length Array of the correct type into the API call. This way we
751 * <i>know</i> that the Array returned is of exactly the correct length.
753 * @return this collection as an Array
755 public uk.ac.vamsas.objects.core.SequenceMapping[] getSequenceMapping() {
756 uk.ac.vamsas.objects.core.SequenceMapping[] array = new uk.ac.vamsas.objects.core.SequenceMapping[0];
757 return (uk.ac.vamsas.objects.core.SequenceMapping[]) this._sequenceMappingList
762 * Method getSequenceMappingAsReference.Returns a reference to
763 * '_sequenceMappingList'. No type checking is performed on any modifications
766 * @return a reference to the Vector backing this class
768 public java.util.Vector getSequenceMappingAsReference() {
769 return this._sequenceMappingList;
773 * Method getSequenceMappingCount.
775 * @return the size of this collection
777 public int getSequenceMappingCount() {
778 return this._sequenceMappingList.size();
785 * @throws java.lang.IndexOutOfBoundsException
786 * if the index given is outside the bounds of the collection
787 * @return the value of the uk.ac.vamsas.objects.core.Tree at the given index
789 public uk.ac.vamsas.objects.core.Tree getTree(final int index)
790 throws java.lang.IndexOutOfBoundsException {
791 // check bounds for index
792 if (index < 0 || index >= this._treeList.size()) {
793 throw new IndexOutOfBoundsException("getTree: Index value '" + index
794 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
797 return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
801 * Method getTree.Returns the contents of the collection in an Array.
803 * Note: Just in case the collection contents are changing in another thread,
804 * we pass a 0-length Array of the correct type into the API call. This way we
805 * <i>know</i> that the Array returned is of exactly the correct length.
807 * @return this collection as an Array
809 public uk.ac.vamsas.objects.core.Tree[] getTree() {
810 uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
811 return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
815 * Method getTreeAsReference.Returns a reference to '_treeList'. No type
816 * checking is performed on any modifications to the Vector.
818 * @return a reference to the Vector backing this class
820 public java.util.Vector getTreeAsReference() {
821 return this._treeList;
825 * Method getTreeCount.
827 * @return the size of this collection
829 public int getTreeCount() {
830 return this._treeList.size();
834 * Overrides the java.lang.Object.hashCode method.
836 * The following steps came from <b>Effective Java Programming Language
837 * Guide</b> by Joshua Bloch, Chapter 3
839 * @return a hash code value for the object.
841 public int hashCode() {
842 int result = super.hashCode();
845 if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
846 result = 37 * result + _id.hashCode();
847 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
849 if (_sequenceList != null
850 && !org.castor.util.CycleBreaker.startingToCycle(_sequenceList)) {
851 result = 37 * result + _sequenceList.hashCode();
852 org.castor.util.CycleBreaker.releaseCycleHandle(_sequenceList);
854 if (_sequenceMappingList != null
855 && !org.castor.util.CycleBreaker.startingToCycle(_sequenceMappingList)) {
856 result = 37 * result + _sequenceMappingList.hashCode();
857 org.castor.util.CycleBreaker.releaseCycleHandle(_sequenceMappingList);
859 if (_dataSetAnnotationsList != null
860 && !org.castor.util.CycleBreaker
861 .startingToCycle(_dataSetAnnotationsList)) {
862 result = 37 * result + _dataSetAnnotationsList.hashCode();
863 org.castor.util.CycleBreaker.releaseCycleHandle(_dataSetAnnotationsList);
865 if (_alignmentList != null
866 && !org.castor.util.CycleBreaker.startingToCycle(_alignmentList)) {
867 result = 37 * result + _alignmentList.hashCode();
868 org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentList);
870 if (_treeList != null
871 && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
872 result = 37 * result + _treeList.hashCode();
873 org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
875 if (_provenance != null
876 && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
877 result = 37 * result + _provenance.hashCode();
878 org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
887 * @return true if this object is valid according to the schema
889 public boolean isValid() {
892 } catch (org.exolab.castor.xml.ValidationException vex) {
902 * @throws org.exolab.castor.xml.MarshalException
903 * if object is null or if any SAXException is thrown during
905 * @throws org.exolab.castor.xml.ValidationException
906 * if this object is an invalid instance according to the schema
908 public void marshal(final java.io.Writer out)
909 throws org.exolab.castor.xml.MarshalException,
910 org.exolab.castor.xml.ValidationException {
911 Marshaller.marshal(this, out);
918 * @throws java.io.IOException
919 * if an IOException occurs during marshaling
920 * @throws org.exolab.castor.xml.ValidationException
921 * if this object is an invalid instance according to the schema
922 * @throws org.exolab.castor.xml.MarshalException
923 * if object is null or if any SAXException is thrown during
926 public void marshal(final org.xml.sax.ContentHandler handler)
927 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
928 org.exolab.castor.xml.ValidationException {
929 Marshaller.marshal(this, handler);
933 * Method removeAlignment.
936 * @return true if the object was removed from the collection.
938 public boolean removeAlignment(
939 final uk.ac.vamsas.objects.core.Alignment vAlignment) {
940 boolean removed = _alignmentList.remove(vAlignment);
945 * Method removeAlignmentAt.
948 * @return the element removed from the collection
950 public uk.ac.vamsas.objects.core.Alignment removeAlignmentAt(final int index) {
951 java.lang.Object obj = this._alignmentList.remove(index);
952 return (uk.ac.vamsas.objects.core.Alignment) obj;
957 public void removeAllAlignment() {
958 this._alignmentList.clear();
963 public void removeAllDataSetAnnotations() {
964 this._dataSetAnnotationsList.clear();
969 public void removeAllSequence() {
970 this._sequenceList.clear();
975 public void removeAllSequenceMapping() {
976 this._sequenceMappingList.clear();
981 public void removeAllTree() {
982 this._treeList.clear();
986 * Method removeDataSetAnnotations.
988 * @param vDataSetAnnotations
989 * @return true if the object was removed from the collection.
991 public boolean removeDataSetAnnotations(
992 final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations) {
993 boolean removed = _dataSetAnnotationsList.remove(vDataSetAnnotations);
998 * Method removeDataSetAnnotationsAt.
1001 * @return the element removed from the collection
1003 public uk.ac.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotationsAt(
1005 java.lang.Object obj = this._dataSetAnnotationsList.remove(index);
1006 return (uk.ac.vamsas.objects.core.DataSetAnnotations) obj;
1010 * Method removeSequence.
1013 * @return true if the object was removed from the collection.
1015 public boolean removeSequence(
1016 final uk.ac.vamsas.objects.core.Sequence vSequence) {
1017 boolean removed = _sequenceList.remove(vSequence);
1022 * Method removeSequenceAt.
1025 * @return the element removed from the collection
1027 public uk.ac.vamsas.objects.core.Sequence removeSequenceAt(final int index) {
1028 java.lang.Object obj = this._sequenceList.remove(index);
1029 return (uk.ac.vamsas.objects.core.Sequence) obj;
1033 * Method removeSequenceMapping.
1035 * @param vSequenceMapping
1036 * @return true if the object was removed from the collection.
1038 public boolean removeSequenceMapping(
1039 final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping) {
1040 boolean removed = _sequenceMappingList.remove(vSequenceMapping);
1045 * Method removeSequenceMappingAt.
1048 * @return the element removed from the collection
1050 public uk.ac.vamsas.objects.core.SequenceMapping removeSequenceMappingAt(
1052 java.lang.Object obj = this._sequenceMappingList.remove(index);
1053 return (uk.ac.vamsas.objects.core.SequenceMapping) obj;
1057 * Method removeTree.
1060 * @return true if the object was removed from the collection.
1062 public boolean removeTree(final uk.ac.vamsas.objects.core.Tree vTree) {
1063 boolean removed = _treeList.remove(vTree);
1068 * Method removeTreeAt.
1071 * @return the element removed from the collection
1073 public uk.ac.vamsas.objects.core.Tree removeTreeAt(final int index) {
1074 java.lang.Object obj = this._treeList.remove(index);
1075 return (uk.ac.vamsas.objects.core.Tree) obj;
1083 * @throws java.lang.IndexOutOfBoundsException
1084 * if the index given is outside the bounds of the collection
1086 public void setAlignment(final int index,
1087 final uk.ac.vamsas.objects.core.Alignment vAlignment)
1088 throws java.lang.IndexOutOfBoundsException {
1089 // check bounds for index
1090 if (index < 0 || index >= this._alignmentList.size()) {
1091 throw new IndexOutOfBoundsException("setAlignment: Index value '" + index
1092 + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
1095 this._alignmentList.set(index, vAlignment);
1101 * @param vAlignmentArray
1103 public void setAlignment(
1104 final uk.ac.vamsas.objects.core.Alignment[] vAlignmentArray) {
1106 _alignmentList.clear();
1108 for (int i = 0; i < vAlignmentArray.length; i++) {
1109 this._alignmentList.add(vAlignmentArray[i]);
1114 * Sets the value of '_alignmentList' by copying the given Vector. All
1115 * elements will be checked for type safety.
1117 * @param vAlignmentList
1118 * the Vector to copy.
1120 public void setAlignment(final java.util.Vector vAlignmentList) {
1122 this._alignmentList.clear();
1124 this._alignmentList.addAll(vAlignmentList);
1128 * Sets the value of '_alignmentList' by setting it to the given Vector. No
1129 * type checking is performed.
1133 * @param alignmentVector
1134 * the Vector to set.
1136 public void setAlignmentAsReference(final java.util.Vector alignmentVector) {
1137 this._alignmentList = alignmentVector;
1144 * @param vDataSetAnnotations
1145 * @throws java.lang.IndexOutOfBoundsException
1146 * if the index given is outside the bounds of the collection
1148 public void setDataSetAnnotations(final int index,
1149 final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
1150 throws java.lang.IndexOutOfBoundsException {
1151 // check bounds for index
1152 if (index < 0 || index >= this._dataSetAnnotationsList.size()) {
1153 throw new IndexOutOfBoundsException(
1154 "setDataSetAnnotations: Index value '" + index
1155 + "' not in range [0.."
1156 + (this._dataSetAnnotationsList.size() - 1) + "]");
1159 this._dataSetAnnotationsList.set(index, vDataSetAnnotations);
1165 * @param vDataSetAnnotationsArray
1167 public void setDataSetAnnotations(
1168 final uk.ac.vamsas.objects.core.DataSetAnnotations[] vDataSetAnnotationsArray) {
1170 _dataSetAnnotationsList.clear();
1172 for (int i = 0; i < vDataSetAnnotationsArray.length; i++) {
1173 this._dataSetAnnotationsList.add(vDataSetAnnotationsArray[i]);
1178 * Sets the value of '_dataSetAnnotationsList' by copying the given Vector.
1179 * All elements will be checked for type safety.
1181 * @param vDataSetAnnotationsList
1182 * the Vector to copy.
1184 public void setDataSetAnnotations(
1185 final java.util.Vector vDataSetAnnotationsList) {
1187 this._dataSetAnnotationsList.clear();
1189 this._dataSetAnnotationsList.addAll(vDataSetAnnotationsList);
1193 * Sets the value of '_dataSetAnnotationsList' by setting it to the given
1194 * Vector. No type checking is performed.
1198 * @param dataSetAnnotationsVector
1199 * the Vector to set.
1201 public void setDataSetAnnotationsAsReference(
1202 final java.util.Vector dataSetAnnotationsVector) {
1203 this._dataSetAnnotationsList = dataSetAnnotationsVector;
1207 * Sets the value of field 'id'. The field 'id' has the following description:
1208 * Primary Key for vamsas object referencing
1211 * the value of field 'id'.
1213 public void setId(final java.lang.String id) {
1218 * Sets the value of field 'provenance'.
1221 * the value of field 'provenance'.
1223 public void setProvenance(
1224 final uk.ac.vamsas.objects.core.Provenance provenance) {
1225 this._provenance = provenance;
1233 * @throws java.lang.IndexOutOfBoundsException
1234 * if the index given is outside the bounds of the collection
1236 public void setSequence(final int index,
1237 final uk.ac.vamsas.objects.core.Sequence vSequence)
1238 throws java.lang.IndexOutOfBoundsException {
1239 // check bounds for index
1240 if (index < 0 || index >= this._sequenceList.size()) {
1241 throw new IndexOutOfBoundsException("setSequence: Index value '" + index
1242 + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
1245 this._sequenceList.set(index, vSequence);
1251 * @param vSequenceArray
1253 public void setSequence(
1254 final uk.ac.vamsas.objects.core.Sequence[] vSequenceArray) {
1256 _sequenceList.clear();
1258 for (int i = 0; i < vSequenceArray.length; i++) {
1259 this._sequenceList.add(vSequenceArray[i]);
1264 * Sets the value of '_sequenceList' by copying the given Vector. All elements
1265 * will be checked for type safety.
1267 * @param vSequenceList
1268 * the Vector to copy.
1270 public void setSequence(final java.util.Vector vSequenceList) {
1272 this._sequenceList.clear();
1274 this._sequenceList.addAll(vSequenceList);
1278 * Sets the value of '_sequenceList' by setting it to the given Vector. No
1279 * type checking is performed.
1283 * @param sequenceVector
1284 * the Vector to set.
1286 public void setSequenceAsReference(final java.util.Vector sequenceVector) {
1287 this._sequenceList = sequenceVector;
1294 * @param vSequenceMapping
1295 * @throws java.lang.IndexOutOfBoundsException
1296 * if the index given is outside the bounds of the collection
1298 public void setSequenceMapping(final int index,
1299 final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
1300 throws java.lang.IndexOutOfBoundsException {
1301 // check bounds for index
1302 if (index < 0 || index >= this._sequenceMappingList.size()) {
1303 throw new IndexOutOfBoundsException("setSequenceMapping: Index value '"
1304 + index + "' not in range [0.."
1305 + (this._sequenceMappingList.size() - 1) + "]");
1308 this._sequenceMappingList.set(index, vSequenceMapping);
1314 * @param vSequenceMappingArray
1316 public void setSequenceMapping(
1317 final uk.ac.vamsas.objects.core.SequenceMapping[] vSequenceMappingArray) {
1319 _sequenceMappingList.clear();
1321 for (int i = 0; i < vSequenceMappingArray.length; i++) {
1322 this._sequenceMappingList.add(vSequenceMappingArray[i]);
1327 * Sets the value of '_sequenceMappingList' by copying the given Vector. All
1328 * elements will be checked for type safety.
1330 * @param vSequenceMappingList
1331 * the Vector to copy.
1333 public void setSequenceMapping(final java.util.Vector vSequenceMappingList) {
1335 this._sequenceMappingList.clear();
1337 this._sequenceMappingList.addAll(vSequenceMappingList);
1341 * Sets the value of '_sequenceMappingList' by setting it to the given Vector.
1342 * No type checking is performed.
1346 * @param sequenceMappingVector
1347 * the Vector to set.
1349 public void setSequenceMappingAsReference(
1350 final java.util.Vector sequenceMappingVector) {
1351 this._sequenceMappingList = sequenceMappingVector;
1359 * @throws java.lang.IndexOutOfBoundsException
1360 * if the index given is outside the bounds of the collection
1362 public void setTree(final int index,
1363 final uk.ac.vamsas.objects.core.Tree vTree)
1364 throws java.lang.IndexOutOfBoundsException {
1365 // check bounds for index
1366 if (index < 0 || index >= this._treeList.size()) {
1367 throw new IndexOutOfBoundsException("setTree: Index value '" + index
1368 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
1371 this._treeList.set(index, vTree);
1379 public void setTree(final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
1383 for (int i = 0; i < vTreeArray.length; i++) {
1384 this._treeList.add(vTreeArray[i]);
1389 * Sets the value of '_treeList' by copying the given Vector. All elements
1390 * will be checked for type safety.
1393 * the Vector to copy.
1395 public void setTree(final java.util.Vector vTreeList) {
1397 this._treeList.clear();
1399 this._treeList.addAll(vTreeList);
1403 * Sets the value of '_treeList' by setting it to the given Vector. No type
1404 * checking is performed.
1409 * the Vector to set.
1411 public void setTreeAsReference(final java.util.Vector treeVector) {
1412 this._treeList = treeVector;
1419 * @throws org.exolab.castor.xml.MarshalException
1420 * if object is null or if any SAXException is thrown during
1422 * @throws org.exolab.castor.xml.ValidationException
1423 * if this object is an invalid instance according to the schema
1424 * @return the unmarshaled uk.ac.vamsas.objects.core.DataSet
1426 public static uk.ac.vamsas.objects.core.DataSet unmarshal(
1427 final java.io.Reader reader)
1428 throws org.exolab.castor.xml.MarshalException,
1429 org.exolab.castor.xml.ValidationException {
1430 return (uk.ac.vamsas.objects.core.DataSet) Unmarshaller.unmarshal(
1431 uk.ac.vamsas.objects.core.DataSet.class, reader);
1437 * @throws org.exolab.castor.xml.ValidationException
1438 * if this object is an invalid instance according to the schema
1440 public void validate() throws org.exolab.castor.xml.ValidationException {
1441 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1442 validator.validate(this);