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 Tree 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;
52 private java.lang.String _modifiable;
57 private java.lang.String _title;
62 private java.util.Vector _newickList;
65 * node identity and mapping data between tree representations and vamsas
68 private java.util.Vector _treenodeList;
71 * Field _propertyList.
73 private java.util.Vector _propertyList;
78 private uk.ac.vamsas.objects.core.Provenance _provenance;
86 this._newickList = new java.util.Vector();
87 this._treenodeList = new java.util.Vector();
88 this._propertyList = new java.util.Vector();
99 * @throws java.lang.IndexOutOfBoundsException
100 * if the index given is outside the bounds of the collection
102 public void addNewick(final uk.ac.vamsas.objects.core.Newick vNewick)
103 throws java.lang.IndexOutOfBoundsException {
104 this._newickList.addElement(vNewick);
112 * @throws java.lang.IndexOutOfBoundsException
113 * if the index given is outside the bounds of the collection
115 public void addNewick(final int index,
116 final uk.ac.vamsas.objects.core.Newick vNewick)
117 throws java.lang.IndexOutOfBoundsException {
118 this._newickList.add(index, vNewick);
125 * @throws java.lang.IndexOutOfBoundsException
126 * if the index given is outside the bounds of the collection
128 public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
129 throws java.lang.IndexOutOfBoundsException {
130 this._propertyList.addElement(vProperty);
138 * @throws java.lang.IndexOutOfBoundsException
139 * if the index given is outside the bounds of the collection
141 public void addProperty(final int index,
142 final uk.ac.vamsas.objects.core.Property vProperty)
143 throws java.lang.IndexOutOfBoundsException {
144 this._propertyList.add(index, vProperty);
151 * @throws java.lang.IndexOutOfBoundsException
152 * if the index given is outside the bounds of the collection
154 public void addTreenode(final uk.ac.vamsas.objects.core.Treenode vTreenode)
155 throws java.lang.IndexOutOfBoundsException {
156 this._treenodeList.addElement(vTreenode);
164 * @throws java.lang.IndexOutOfBoundsException
165 * if the index given is outside the bounds of the collection
167 public void addTreenode(final int index,
168 final uk.ac.vamsas.objects.core.Treenode vTreenode)
169 throws java.lang.IndexOutOfBoundsException {
170 this._treenodeList.add(index, vTreenode);
174 * Method enumerateNewick.
176 * @return an Enumeration over all uk.ac.vamsas.objects.core.Newick elements
178 public java.util.Enumeration enumerateNewick() {
179 return this._newickList.elements();
183 * Method enumerateProperty.
185 * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
187 public java.util.Enumeration enumerateProperty() {
188 return this._propertyList.elements();
192 * Method enumerateTreenode.
194 * @return an Enumeration over all uk.ac.vamsas.objects.core.Treenode elements
196 public java.util.Enumeration enumerateTreenode() {
197 return this._treenodeList.elements();
201 * Overrides the java.lang.Object.equals method.
204 * @return true if the objects are equal.
206 public boolean equals(final java.lang.Object obj) {
210 if (super.equals(obj) == false)
213 if (obj instanceof Tree) {
215 Tree temp = (Tree) obj;
218 if (this._id != null) {
219 if (temp._id == null)
221 if (this._id != temp._id) {
222 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
223 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
224 if (thcycle != tmcycle) {
226 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
230 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
236 if (!this._id.equals(temp._id)) {
237 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
238 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
241 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
242 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
245 } else if (temp._id != null)
247 if (this._modifiable != null) {
248 if (temp._modifiable == null)
250 if (this._modifiable != temp._modifiable) {
251 thcycle = org.castor.util.CycleBreaker
252 .startingToCycle(this._modifiable);
253 tmcycle = org.castor.util.CycleBreaker
254 .startingToCycle(temp._modifiable);
255 if (thcycle != tmcycle) {
257 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
261 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
267 if (!this._modifiable.equals(temp._modifiable)) {
268 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
269 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
272 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
273 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
276 } else if (temp._modifiable != null)
278 if (this._title != null) {
279 if (temp._title == null)
281 if (this._title != temp._title) {
282 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._title);
283 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._title);
284 if (thcycle != tmcycle) {
286 org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
290 org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
296 if (!this._title.equals(temp._title)) {
297 org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
298 org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
301 org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
302 org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
305 } else if (temp._title != null)
307 if (this._newickList != null) {
308 if (temp._newickList == null)
310 if (this._newickList != temp._newickList) {
311 thcycle = org.castor.util.CycleBreaker
312 .startingToCycle(this._newickList);
313 tmcycle = org.castor.util.CycleBreaker
314 .startingToCycle(temp._newickList);
315 if (thcycle != tmcycle) {
317 org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
321 org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
327 if (!this._newickList.equals(temp._newickList)) {
328 org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
329 org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
332 org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
333 org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
336 } else if (temp._newickList != null)
338 if (this._treenodeList != null) {
339 if (temp._treenodeList == null)
341 if (this._treenodeList != temp._treenodeList) {
342 thcycle = org.castor.util.CycleBreaker
343 .startingToCycle(this._treenodeList);
344 tmcycle = org.castor.util.CycleBreaker
345 .startingToCycle(temp._treenodeList);
346 if (thcycle != tmcycle) {
348 org.castor.util.CycleBreaker
349 .releaseCycleHandle(this._treenodeList);
353 org.castor.util.CycleBreaker
354 .releaseCycleHandle(temp._treenodeList);
360 if (!this._treenodeList.equals(temp._treenodeList)) {
361 org.castor.util.CycleBreaker
362 .releaseCycleHandle(this._treenodeList);
363 org.castor.util.CycleBreaker
364 .releaseCycleHandle(temp._treenodeList);
367 org.castor.util.CycleBreaker.releaseCycleHandle(this._treenodeList);
368 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treenodeList);
371 } else if (temp._treenodeList != null)
373 if (this._propertyList != null) {
374 if (temp._propertyList == null)
376 if (this._propertyList != temp._propertyList) {
377 thcycle = org.castor.util.CycleBreaker
378 .startingToCycle(this._propertyList);
379 tmcycle = org.castor.util.CycleBreaker
380 .startingToCycle(temp._propertyList);
381 if (thcycle != tmcycle) {
383 org.castor.util.CycleBreaker
384 .releaseCycleHandle(this._propertyList);
388 org.castor.util.CycleBreaker
389 .releaseCycleHandle(temp._propertyList);
395 if (!this._propertyList.equals(temp._propertyList)) {
396 org.castor.util.CycleBreaker
397 .releaseCycleHandle(this._propertyList);
398 org.castor.util.CycleBreaker
399 .releaseCycleHandle(temp._propertyList);
402 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
403 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
406 } else if (temp._propertyList != null)
408 if (this._provenance != null) {
409 if (temp._provenance == null)
411 if (this._provenance != temp._provenance) {
412 thcycle = org.castor.util.CycleBreaker
413 .startingToCycle(this._provenance);
414 tmcycle = org.castor.util.CycleBreaker
415 .startingToCycle(temp._provenance);
416 if (thcycle != tmcycle) {
418 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
422 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
428 if (!this._provenance.equals(temp._provenance)) {
429 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
430 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
433 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
434 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
437 } else if (temp._provenance != null)
445 * Returns the value of field 'id'. The field 'id' has the following
446 * description: Primary Key for vamsas object referencing
448 * @return the value of field 'Id'.
450 public java.lang.String getId() {
455 * Returns the value of field 'modifiable'.
457 * @return the value of field 'Modifiable'.
459 public java.lang.String getModifiable() {
460 return this._modifiable;
467 * @throws java.lang.IndexOutOfBoundsException
468 * if the index given is outside the bounds of the collection
469 * @return the value of the uk.ac.vamsas.objects.core.Newick at the given
472 public uk.ac.vamsas.objects.core.Newick getNewick(final int index)
473 throws java.lang.IndexOutOfBoundsException {
474 // check bounds for index
475 if (index < 0 || index >= this._newickList.size()) {
476 throw new IndexOutOfBoundsException("getNewick: Index value '" + index
477 + "' not in range [0.." + (this._newickList.size() - 1) + "]");
480 return (uk.ac.vamsas.objects.core.Newick) _newickList.get(index);
484 * Method getNewick.Returns the contents of the collection in an Array.
486 * Note: Just in case the collection contents are changing in another thread,
487 * we pass a 0-length Array of the correct type into the API call. This way we
488 * <i>know</i> that the Array returned is of exactly the correct length.
490 * @return this collection as an Array
492 public uk.ac.vamsas.objects.core.Newick[] getNewick() {
493 uk.ac.vamsas.objects.core.Newick[] array = new uk.ac.vamsas.objects.core.Newick[0];
494 return (uk.ac.vamsas.objects.core.Newick[]) this._newickList.toArray(array);
498 * Method getNewickAsReference.Returns a reference to '_newickList'. No type
499 * checking is performed on any modifications to the Vector.
501 * @return a reference to the Vector backing this class
503 public java.util.Vector getNewickAsReference() {
504 return this._newickList;
508 * Method getNewickCount.
510 * @return the size of this collection
512 public int getNewickCount() {
513 return this._newickList.size();
517 * Method getProperty.
520 * @throws java.lang.IndexOutOfBoundsException
521 * if the index given is outside the bounds of the collection
522 * @return the value of the uk.ac.vamsas.objects.core.Property at the given
525 public uk.ac.vamsas.objects.core.Property getProperty(final int index)
526 throws java.lang.IndexOutOfBoundsException {
527 // check bounds for index
528 if (index < 0 || index >= this._propertyList.size()) {
529 throw new IndexOutOfBoundsException("getProperty: Index value '" + index
530 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
533 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
537 * Method getProperty.Returns the contents of the collection in an Array.
539 * Note: Just in case the collection contents are changing in another thread,
540 * we pass a 0-length Array of the correct type into the API call. This way we
541 * <i>know</i> that the Array returned is of exactly the correct length.
543 * @return this collection as an Array
545 public uk.ac.vamsas.objects.core.Property[] getProperty() {
546 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
547 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
552 * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
553 * type checking is performed on any modifications to the Vector.
555 * @return a reference to the Vector backing this class
557 public java.util.Vector getPropertyAsReference() {
558 return this._propertyList;
562 * Method getPropertyCount.
564 * @return the size of this collection
566 public int getPropertyCount() {
567 return this._propertyList.size();
571 * Returns the value of field 'provenance'.
573 * @return the value of field 'Provenance'.
575 public uk.ac.vamsas.objects.core.Provenance getProvenance() {
576 return this._provenance;
580 * Returns the value of field 'title'.
582 * @return the value of field 'Title'.
584 public java.lang.String getTitle() {
589 * Method getTreenode.
592 * @throws java.lang.IndexOutOfBoundsException
593 * if the index given is outside the bounds of the collection
594 * @return the value of the uk.ac.vamsas.objects.core.Treenode at the given
597 public uk.ac.vamsas.objects.core.Treenode getTreenode(final int index)
598 throws java.lang.IndexOutOfBoundsException {
599 // check bounds for index
600 if (index < 0 || index >= this._treenodeList.size()) {
601 throw new IndexOutOfBoundsException("getTreenode: Index value '" + index
602 + "' not in range [0.." + (this._treenodeList.size() - 1) + "]");
605 return (uk.ac.vamsas.objects.core.Treenode) _treenodeList.get(index);
609 * Method getTreenode.Returns the contents of the collection in an Array.
611 * Note: Just in case the collection contents are changing in another thread,
612 * we pass a 0-length Array of the correct type into the API call. This way we
613 * <i>know</i> that the Array returned is of exactly the correct length.
615 * @return this collection as an Array
617 public uk.ac.vamsas.objects.core.Treenode[] getTreenode() {
618 uk.ac.vamsas.objects.core.Treenode[] array = new uk.ac.vamsas.objects.core.Treenode[0];
619 return (uk.ac.vamsas.objects.core.Treenode[]) this._treenodeList
624 * Method getTreenodeAsReference.Returns a reference to '_treenodeList'. No
625 * type checking is performed on any modifications to the Vector.
627 * @return a reference to the Vector backing this class
629 public java.util.Vector getTreenodeAsReference() {
630 return this._treenodeList;
634 * Method getTreenodeCount.
636 * @return the size of this collection
638 public int getTreenodeCount() {
639 return this._treenodeList.size();
643 * Overrides the java.lang.Object.hashCode method.
645 * The following steps came from <b>Effective Java Programming Language
646 * Guide</b> by Joshua Bloch, Chapter 3
648 * @return a hash code value for the object.
650 public int hashCode() {
651 int result = super.hashCode();
654 if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
655 result = 37 * result + _id.hashCode();
656 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
658 if (_modifiable != null
659 && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
660 result = 37 * result + _modifiable.hashCode();
661 org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
663 if (_title != null && !org.castor.util.CycleBreaker.startingToCycle(_title)) {
664 result = 37 * result + _title.hashCode();
665 org.castor.util.CycleBreaker.releaseCycleHandle(_title);
667 if (_newickList != null
668 && !org.castor.util.CycleBreaker.startingToCycle(_newickList)) {
669 result = 37 * result + _newickList.hashCode();
670 org.castor.util.CycleBreaker.releaseCycleHandle(_newickList);
672 if (_treenodeList != null
673 && !org.castor.util.CycleBreaker.startingToCycle(_treenodeList)) {
674 result = 37 * result + _treenodeList.hashCode();
675 org.castor.util.CycleBreaker.releaseCycleHandle(_treenodeList);
677 if (_propertyList != null
678 && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
679 result = 37 * result + _propertyList.hashCode();
680 org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
682 if (_provenance != null
683 && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
684 result = 37 * result + _provenance.hashCode();
685 org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
694 * @return true if this object is valid according to the schema
696 public boolean isValid() {
699 } catch (org.exolab.castor.xml.ValidationException vex) {
709 * @throws org.exolab.castor.xml.MarshalException
710 * if object is null or if any SAXException is thrown during
712 * @throws org.exolab.castor.xml.ValidationException
713 * if this object is an invalid instance according to the schema
715 public void marshal(final java.io.Writer out)
716 throws org.exolab.castor.xml.MarshalException,
717 org.exolab.castor.xml.ValidationException {
718 Marshaller.marshal(this, out);
725 * @throws java.io.IOException
726 * if an IOException occurs during marshaling
727 * @throws org.exolab.castor.xml.ValidationException
728 * if this object is an invalid instance according to the schema
729 * @throws org.exolab.castor.xml.MarshalException
730 * if object is null or if any SAXException is thrown during
733 public void marshal(final org.xml.sax.ContentHandler handler)
734 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
735 org.exolab.castor.xml.ValidationException {
736 Marshaller.marshal(this, handler);
741 public void removeAllNewick() {
742 this._newickList.clear();
747 public void removeAllProperty() {
748 this._propertyList.clear();
753 public void removeAllTreenode() {
754 this._treenodeList.clear();
758 * Method removeNewick.
761 * @return true if the object was removed from the collection.
763 public boolean removeNewick(final uk.ac.vamsas.objects.core.Newick vNewick) {
764 boolean removed = _newickList.remove(vNewick);
769 * Method removeNewickAt.
772 * @return the element removed from the collection
774 public uk.ac.vamsas.objects.core.Newick removeNewickAt(final int index) {
775 java.lang.Object obj = this._newickList.remove(index);
776 return (uk.ac.vamsas.objects.core.Newick) obj;
780 * Method removeProperty.
783 * @return true if the object was removed from the collection.
785 public boolean removeProperty(
786 final uk.ac.vamsas.objects.core.Property vProperty) {
787 boolean removed = _propertyList.remove(vProperty);
792 * Method removePropertyAt.
795 * @return the element removed from the collection
797 public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
798 java.lang.Object obj = this._propertyList.remove(index);
799 return (uk.ac.vamsas.objects.core.Property) obj;
803 * Method removeTreenode.
806 * @return true if the object was removed from the collection.
808 public boolean removeTreenode(
809 final uk.ac.vamsas.objects.core.Treenode vTreenode) {
810 boolean removed = _treenodeList.remove(vTreenode);
815 * Method removeTreenodeAt.
818 * @return the element removed from the collection
820 public uk.ac.vamsas.objects.core.Treenode removeTreenodeAt(final int index) {
821 java.lang.Object obj = this._treenodeList.remove(index);
822 return (uk.ac.vamsas.objects.core.Treenode) obj;
826 * Sets the value of field 'id'. The field 'id' has the following description:
827 * Primary Key for vamsas object referencing
830 * the value of field 'id'.
832 public void setId(final java.lang.String id) {
837 * Sets the value of field 'modifiable'.
840 * the value of field 'modifiable'.
842 public void setModifiable(final java.lang.String modifiable) {
843 this._modifiable = modifiable;
851 * @throws java.lang.IndexOutOfBoundsException
852 * if the index given is outside the bounds of the collection
854 public void setNewick(final int index,
855 final uk.ac.vamsas.objects.core.Newick vNewick)
856 throws java.lang.IndexOutOfBoundsException {
857 // check bounds for index
858 if (index < 0 || index >= this._newickList.size()) {
859 throw new IndexOutOfBoundsException("setNewick: Index value '" + index
860 + "' not in range [0.." + (this._newickList.size() - 1) + "]");
863 this._newickList.set(index, vNewick);
869 * @param vNewickArray
871 public void setNewick(final uk.ac.vamsas.objects.core.Newick[] vNewickArray) {
875 for (int i = 0; i < vNewickArray.length; i++) {
876 this._newickList.add(vNewickArray[i]);
881 * Sets the value of '_newickList' by copying the given Vector. All elements
882 * will be checked for type safety.
885 * the Vector to copy.
887 public void setNewick(final java.util.Vector vNewickList) {
889 this._newickList.clear();
891 this._newickList.addAll(vNewickList);
895 * Sets the value of '_newickList' by setting it to the given Vector. No type
896 * checking is performed.
900 * @param newickVector
903 public void setNewickAsReference(final java.util.Vector newickVector) {
904 this._newickList = newickVector;
912 * @throws java.lang.IndexOutOfBoundsException
913 * if the index given is outside the bounds of the collection
915 public void setProperty(final int index,
916 final uk.ac.vamsas.objects.core.Property vProperty)
917 throws java.lang.IndexOutOfBoundsException {
918 // check bounds for index
919 if (index < 0 || index >= this._propertyList.size()) {
920 throw new IndexOutOfBoundsException("setProperty: Index value '" + index
921 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
924 this._propertyList.set(index, vProperty);
930 * @param vPropertyArray
932 public void setProperty(
933 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
935 _propertyList.clear();
937 for (int i = 0; i < vPropertyArray.length; i++) {
938 this._propertyList.add(vPropertyArray[i]);
943 * Sets the value of '_propertyList' by copying the given Vector. All elements
944 * will be checked for type safety.
946 * @param vPropertyList
947 * the Vector to copy.
949 public void setProperty(final java.util.Vector vPropertyList) {
951 this._propertyList.clear();
953 this._propertyList.addAll(vPropertyList);
957 * Sets the value of '_propertyList' by setting it to the given Vector. No
958 * type checking is performed.
962 * @param propertyVector
965 public void setPropertyAsReference(final java.util.Vector propertyVector) {
966 this._propertyList = propertyVector;
970 * Sets the value of field 'provenance'.
973 * the value of field 'provenance'.
975 public void setProvenance(
976 final uk.ac.vamsas.objects.core.Provenance provenance) {
977 this._provenance = provenance;
981 * Sets the value of field 'title'.
984 * the value of field 'title'.
986 public void setTitle(final java.lang.String title) {
995 * @throws java.lang.IndexOutOfBoundsException
996 * if the index given is outside the bounds of the collection
998 public void setTreenode(final int index,
999 final uk.ac.vamsas.objects.core.Treenode vTreenode)
1000 throws java.lang.IndexOutOfBoundsException {
1001 // check bounds for index
1002 if (index < 0 || index >= this._treenodeList.size()) {
1003 throw new IndexOutOfBoundsException("setTreenode: Index value '" + index
1004 + "' not in range [0.." + (this._treenodeList.size() - 1) + "]");
1007 this._treenodeList.set(index, vTreenode);
1013 * @param vTreenodeArray
1015 public void setTreenode(
1016 final uk.ac.vamsas.objects.core.Treenode[] vTreenodeArray) {
1018 _treenodeList.clear();
1020 for (int i = 0; i < vTreenodeArray.length; i++) {
1021 this._treenodeList.add(vTreenodeArray[i]);
1026 * Sets the value of '_treenodeList' by copying the given Vector. All elements
1027 * will be checked for type safety.
1029 * @param vTreenodeList
1030 * the Vector to copy.
1032 public void setTreenode(final java.util.Vector vTreenodeList) {
1034 this._treenodeList.clear();
1036 this._treenodeList.addAll(vTreenodeList);
1040 * Sets the value of '_treenodeList' by setting it to the given Vector. No
1041 * type checking is performed.
1045 * @param treenodeVector
1046 * the Vector to set.
1048 public void setTreenodeAsReference(final java.util.Vector treenodeVector) {
1049 this._treenodeList = treenodeVector;
1056 * @throws org.exolab.castor.xml.MarshalException
1057 * if object is null or if any SAXException is thrown during
1059 * @throws org.exolab.castor.xml.ValidationException
1060 * if this object is an invalid instance according to the schema
1061 * @return the unmarshaled uk.ac.vamsas.objects.core.Tree
1063 public static uk.ac.vamsas.objects.core.Tree unmarshal(
1064 final java.io.Reader reader)
1065 throws org.exolab.castor.xml.MarshalException,
1066 org.exolab.castor.xml.ValidationException {
1067 return (uk.ac.vamsas.objects.core.Tree) Unmarshaller.unmarshal(
1068 uk.ac.vamsas.objects.core.Tree.class, reader);
1074 * @throws org.exolab.castor.xml.ValidationException
1075 * if this object is an invalid instance according to the schema
1077 public void validate() throws org.exolab.castor.xml.ValidationException {
1078 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1079 validator.validate(this);