2 * This file is part of the Vamsas Client version 0.2.
3 * Copyright 2010 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;
32 * Class VamsasDocument.
34 * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
37 public class VamsasDocument extends uk.ac.vamsas.client.Vobject implements
38 java.io.Serializable {
40 // --------------------------/
41 // - Class/Member Variables -/
42 // --------------------------/
45 * Vamsas Document Version Number
47 private java.lang.String _version;
52 private uk.ac.vamsas.objects.core.LockFile _lockFile;
57 private uk.ac.vamsas.objects.core.Provenance _provenance;
60 * contains unassociated trees and a number of analysis sets
63 private java.util.Vector _VAMSASList;
66 * Field _applicationDataList.
68 private java.util.Vector _applicationDataList;
71 * Field _attachmentList.
73 private java.util.Vector _attachmentList;
79 public VamsasDocument() {
81 this._VAMSASList = new java.util.Vector();
82 this._applicationDataList = new java.util.Vector();
83 this._attachmentList = new java.util.Vector();
93 * @param vApplicationData
94 * @throws java.lang.IndexOutOfBoundsException
95 * if the index given is outside the bounds of the collection
97 public void addApplicationData(
98 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
99 throws java.lang.IndexOutOfBoundsException {
100 this._applicationDataList.addElement(vApplicationData);
107 * @param vApplicationData
108 * @throws java.lang.IndexOutOfBoundsException
109 * if the index given is outside the bounds of the collection
111 public void addApplicationData(final int index,
112 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
113 throws java.lang.IndexOutOfBoundsException {
114 this._applicationDataList.add(index, vApplicationData);
121 * @throws java.lang.IndexOutOfBoundsException
122 * if the index given is outside the bounds of the collection
124 public void addAttachment(
125 final uk.ac.vamsas.objects.core.Attachment vAttachment)
126 throws java.lang.IndexOutOfBoundsException {
127 this._attachmentList.addElement(vAttachment);
135 * @throws java.lang.IndexOutOfBoundsException
136 * if the index given is outside the bounds of the collection
138 public void addAttachment(final int index,
139 final uk.ac.vamsas.objects.core.Attachment vAttachment)
140 throws java.lang.IndexOutOfBoundsException {
141 this._attachmentList.add(index, vAttachment);
148 * @throws java.lang.IndexOutOfBoundsException
149 * if the index given is outside the bounds of the collection
151 public void addVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
152 throws java.lang.IndexOutOfBoundsException {
153 this._VAMSASList.addElement(vVAMSAS);
161 * @throws java.lang.IndexOutOfBoundsException
162 * if the index given is outside the bounds of the collection
164 public void addVAMSAS(final int index,
165 final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
166 throws java.lang.IndexOutOfBoundsException {
167 this._VAMSASList.add(index, vVAMSAS);
171 * Method enumerateApplicationData.
173 * @return an Enumeration over all uk.ac.vamsas.objects.core.ApplicationData
176 public java.util.Enumeration enumerateApplicationData() {
177 return this._applicationDataList.elements();
181 * Method enumerateAttachment.
183 * @return an Enumeration over all uk.ac.vamsas.objects.core.Attachment
186 public java.util.Enumeration enumerateAttachment() {
187 return this._attachmentList.elements();
191 * Method enumerateVAMSAS.
193 * @return an Enumeration over all uk.ac.vamsas.objects.core.VAMSAS elements
195 public java.util.Enumeration enumerateVAMSAS() {
196 return this._VAMSASList.elements();
200 * Overrides the java.lang.Object.equals method.
203 * @return true if the objects are equal.
205 public boolean equals(final java.lang.Object obj) {
209 if (super.equals(obj) == false)
212 if (obj instanceof VamsasDocument) {
214 VamsasDocument temp = (VamsasDocument) obj;
217 if (this._version != null) {
218 if (temp._version == null)
220 if (this._version != temp._version) {
221 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._version);
222 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._version);
223 if (thcycle != tmcycle) {
225 org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
229 org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
235 if (!this._version.equals(temp._version)) {
236 org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
237 org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
240 org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
241 org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
244 } else if (temp._version != null)
246 if (this._lockFile != null) {
247 if (temp._lockFile == null)
249 if (this._lockFile != temp._lockFile) {
250 thcycle = org.castor.util.CycleBreaker
251 .startingToCycle(this._lockFile);
252 tmcycle = org.castor.util.CycleBreaker
253 .startingToCycle(temp._lockFile);
254 if (thcycle != tmcycle) {
256 org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
260 org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
266 if (!this._lockFile.equals(temp._lockFile)) {
267 org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
268 org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
271 org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
272 org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
275 } else if (temp._lockFile != null)
277 if (this._provenance != null) {
278 if (temp._provenance == null)
280 if (this._provenance != temp._provenance) {
281 thcycle = org.castor.util.CycleBreaker
282 .startingToCycle(this._provenance);
283 tmcycle = org.castor.util.CycleBreaker
284 .startingToCycle(temp._provenance);
285 if (thcycle != tmcycle) {
287 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
291 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
297 if (!this._provenance.equals(temp._provenance)) {
298 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
299 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
302 org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
303 org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
306 } else if (temp._provenance != null)
308 if (this._VAMSASList != null) {
309 if (temp._VAMSASList == null)
311 if (this._VAMSASList != temp._VAMSASList) {
312 thcycle = org.castor.util.CycleBreaker
313 .startingToCycle(this._VAMSASList);
314 tmcycle = org.castor.util.CycleBreaker
315 .startingToCycle(temp._VAMSASList);
316 if (thcycle != tmcycle) {
318 org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
322 org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
328 if (!this._VAMSASList.equals(temp._VAMSASList)) {
329 org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
330 org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
333 org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
334 org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
337 } else if (temp._VAMSASList != null)
339 if (this._applicationDataList != null) {
340 if (temp._applicationDataList == null)
342 if (this._applicationDataList != temp._applicationDataList) {
343 thcycle = org.castor.util.CycleBreaker
344 .startingToCycle(this._applicationDataList);
345 tmcycle = org.castor.util.CycleBreaker
346 .startingToCycle(temp._applicationDataList);
347 if (thcycle != tmcycle) {
349 org.castor.util.CycleBreaker
350 .releaseCycleHandle(this._applicationDataList);
354 org.castor.util.CycleBreaker
355 .releaseCycleHandle(temp._applicationDataList);
361 if (!this._applicationDataList.equals(temp._applicationDataList)) {
362 org.castor.util.CycleBreaker
363 .releaseCycleHandle(this._applicationDataList);
364 org.castor.util.CycleBreaker
365 .releaseCycleHandle(temp._applicationDataList);
368 org.castor.util.CycleBreaker
369 .releaseCycleHandle(this._applicationDataList);
370 org.castor.util.CycleBreaker
371 .releaseCycleHandle(temp._applicationDataList);
374 } else if (temp._applicationDataList != null)
376 if (this._attachmentList != null) {
377 if (temp._attachmentList == null)
379 if (this._attachmentList != temp._attachmentList) {
380 thcycle = org.castor.util.CycleBreaker
381 .startingToCycle(this._attachmentList);
382 tmcycle = org.castor.util.CycleBreaker
383 .startingToCycle(temp._attachmentList);
384 if (thcycle != tmcycle) {
386 org.castor.util.CycleBreaker
387 .releaseCycleHandle(this._attachmentList);
391 org.castor.util.CycleBreaker
392 .releaseCycleHandle(temp._attachmentList);
398 if (!this._attachmentList.equals(temp._attachmentList)) {
399 org.castor.util.CycleBreaker
400 .releaseCycleHandle(this._attachmentList);
401 org.castor.util.CycleBreaker
402 .releaseCycleHandle(temp._attachmentList);
405 org.castor.util.CycleBreaker
406 .releaseCycleHandle(this._attachmentList);
407 org.castor.util.CycleBreaker
408 .releaseCycleHandle(temp._attachmentList);
411 } else if (temp._attachmentList != null)
419 * Method getApplicationData.
422 * @throws java.lang.IndexOutOfBoundsException
423 * if the index given is outside the bounds of the collection
424 * @return the value of the uk.ac.vamsas.objects.core.ApplicationData at the
427 public uk.ac.vamsas.objects.core.ApplicationData getApplicationData(
428 final int index) throws java.lang.IndexOutOfBoundsException {
429 // check bounds for index
430 if (index < 0 || index >= this._applicationDataList.size()) {
431 throw new IndexOutOfBoundsException("getApplicationData: Index value '"
432 + index + "' not in range [0.."
433 + (this._applicationDataList.size() - 1) + "]");
436 return (uk.ac.vamsas.objects.core.ApplicationData) _applicationDataList
441 * Method getApplicationData.Returns the contents of the collection in an
444 * Note: Just in case the collection contents are changing in another thread,
445 * we pass a 0-length Array of the correct type into the API call. This way we
446 * <i>know</i> that the Array returned is of exactly the correct length.
448 * @return this collection as an Array
450 public uk.ac.vamsas.objects.core.ApplicationData[] getApplicationData() {
451 uk.ac.vamsas.objects.core.ApplicationData[] array = new uk.ac.vamsas.objects.core.ApplicationData[0];
452 return (uk.ac.vamsas.objects.core.ApplicationData[]) this._applicationDataList
457 * Method getApplicationDataAsReference.Returns a reference to
458 * '_applicationDataList'. No type checking is performed on any modifications
461 * @return a reference to the Vector backing this class
463 public java.util.Vector getApplicationDataAsReference() {
464 return this._applicationDataList;
468 * Method getApplicationDataCount.
470 * @return the size of this collection
472 public int getApplicationDataCount() {
473 return this._applicationDataList.size();
477 * Method getAttachment.
480 * @throws java.lang.IndexOutOfBoundsException
481 * if the index given is outside the bounds of the collection
482 * @return the value of the uk.ac.vamsas.objects.core.Attachment at the given
485 public uk.ac.vamsas.objects.core.Attachment getAttachment(final int index)
486 throws java.lang.IndexOutOfBoundsException {
487 // check bounds for index
488 if (index < 0 || index >= this._attachmentList.size()) {
489 throw new IndexOutOfBoundsException("getAttachment: Index value '"
490 + index + "' not in range [0.." + (this._attachmentList.size() - 1)
494 return (uk.ac.vamsas.objects.core.Attachment) _attachmentList.get(index);
498 * Method getAttachment.Returns the contents of the collection in an Array.
500 * Note: Just in case the collection contents are changing in another thread,
501 * we pass a 0-length Array of the correct type into the API call. This way we
502 * <i>know</i> that the Array returned is of exactly the correct length.
504 * @return this collection as an Array
506 public uk.ac.vamsas.objects.core.Attachment[] getAttachment() {
507 uk.ac.vamsas.objects.core.Attachment[] array = new uk.ac.vamsas.objects.core.Attachment[0];
508 return (uk.ac.vamsas.objects.core.Attachment[]) this._attachmentList
513 * Method getAttachmentAsReference.Returns a reference to '_attachmentList'.
514 * No type checking is performed on any modifications to the Vector.
516 * @return a reference to the Vector backing this class
518 public java.util.Vector getAttachmentAsReference() {
519 return this._attachmentList;
523 * Method getAttachmentCount.
525 * @return the size of this collection
527 public int getAttachmentCount() {
528 return this._attachmentList.size();
532 * Returns the value of field 'lockFile'.
534 * @return the value of field 'LockFile'.
536 public uk.ac.vamsas.objects.core.LockFile getLockFile() {
537 return this._lockFile;
541 * Returns the value of field 'provenance'.
543 * @return the value of field 'Provenance'.
545 public uk.ac.vamsas.objects.core.Provenance getProvenance() {
546 return this._provenance;
553 * @throws java.lang.IndexOutOfBoundsException
554 * if the index given is outside the bounds of the collection
555 * @return the value of the uk.ac.vamsas.objects.core.VAMSAS at the given
558 public uk.ac.vamsas.objects.core.VAMSAS getVAMSAS(final int index)
559 throws java.lang.IndexOutOfBoundsException {
560 // check bounds for index
561 if (index < 0 || index >= this._VAMSASList.size()) {
562 throw new IndexOutOfBoundsException("getVAMSAS: Index value '" + index
563 + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
566 return (uk.ac.vamsas.objects.core.VAMSAS) _VAMSASList.get(index);
570 * Method getVAMSAS.Returns the contents of the collection in an Array.
572 * Note: Just in case the collection contents are changing in another thread,
573 * we pass a 0-length Array of the correct type into the API call. This way we
574 * <i>know</i> that the Array returned is of exactly the correct length.
576 * @return this collection as an Array
578 public uk.ac.vamsas.objects.core.VAMSAS[] getVAMSAS() {
579 uk.ac.vamsas.objects.core.VAMSAS[] array = new uk.ac.vamsas.objects.core.VAMSAS[0];
580 return (uk.ac.vamsas.objects.core.VAMSAS[]) this._VAMSASList.toArray(array);
584 * Method getVAMSASAsReference.Returns a reference to '_VAMSASList'. No type
585 * checking is performed on any modifications to the Vector.
587 * @return a reference to the Vector backing this class
589 public java.util.Vector getVAMSASAsReference() {
590 return this._VAMSASList;
594 * Method getVAMSASCount.
596 * @return the size of this collection
598 public int getVAMSASCount() {
599 return this._VAMSASList.size();
603 * Returns the value of field 'version'. The field 'version' has the following
604 * description: Vamsas Document Version Number
606 * @return the value of field 'Version'.
608 public java.lang.String getVersion() {
609 return this._version;
613 * Overrides the java.lang.Object.hashCode method.
615 * The following steps came from <b>Effective Java Programming Language
616 * Guide</b> by Joshua Bloch, Chapter 3
618 * @return a hash code value for the object.
620 public int hashCode() {
621 int result = super.hashCode();
625 && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
626 result = 37 * result + _version.hashCode();
627 org.castor.util.CycleBreaker.releaseCycleHandle(_version);
629 if (_lockFile != null
630 && !org.castor.util.CycleBreaker.startingToCycle(_lockFile)) {
631 result = 37 * result + _lockFile.hashCode();
632 org.castor.util.CycleBreaker.releaseCycleHandle(_lockFile);
634 if (_provenance != null
635 && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
636 result = 37 * result + _provenance.hashCode();
637 org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
639 if (_VAMSASList != null
640 && !org.castor.util.CycleBreaker.startingToCycle(_VAMSASList)) {
641 result = 37 * result + _VAMSASList.hashCode();
642 org.castor.util.CycleBreaker.releaseCycleHandle(_VAMSASList);
644 if (_applicationDataList != null
645 && !org.castor.util.CycleBreaker.startingToCycle(_applicationDataList)) {
646 result = 37 * result + _applicationDataList.hashCode();
647 org.castor.util.CycleBreaker.releaseCycleHandle(_applicationDataList);
649 if (_attachmentList != null
650 && !org.castor.util.CycleBreaker.startingToCycle(_attachmentList)) {
651 result = 37 * result + _attachmentList.hashCode();
652 org.castor.util.CycleBreaker.releaseCycleHandle(_attachmentList);
661 * @return true if this object is valid according to the schema
663 public boolean isValid() {
666 } catch (org.exolab.castor.xml.ValidationException vex) {
676 * @throws org.exolab.castor.xml.MarshalException
677 * if object is null or if any SAXException is thrown during
679 * @throws org.exolab.castor.xml.ValidationException
680 * if this object is an invalid instance according to the schema
682 public void marshal(final java.io.Writer out)
683 throws org.exolab.castor.xml.MarshalException,
684 org.exolab.castor.xml.ValidationException {
685 Marshaller.marshal(this, out);
692 * @throws java.io.IOException
693 * if an IOException occurs during marshaling
694 * @throws org.exolab.castor.xml.ValidationException
695 * if this object is an invalid instance according to the schema
696 * @throws org.exolab.castor.xml.MarshalException
697 * if object is null or if any SAXException is thrown during
700 public void marshal(final org.xml.sax.ContentHandler handler)
701 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
702 org.exolab.castor.xml.ValidationException {
703 Marshaller.marshal(this, handler);
708 public void removeAllApplicationData() {
709 this._applicationDataList.clear();
714 public void removeAllAttachment() {
715 this._attachmentList.clear();
720 public void removeAllVAMSAS() {
721 this._VAMSASList.clear();
725 * Method removeApplicationData.
727 * @param vApplicationData
728 * @return true if the object was removed from the collection.
730 public boolean removeApplicationData(
731 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData) {
732 boolean removed = _applicationDataList.remove(vApplicationData);
737 * Method removeApplicationDataAt.
740 * @return the element removed from the collection
742 public uk.ac.vamsas.objects.core.ApplicationData removeApplicationDataAt(
744 java.lang.Object obj = this._applicationDataList.remove(index);
745 return (uk.ac.vamsas.objects.core.ApplicationData) obj;
749 * Method removeAttachment.
752 * @return true if the object was removed from the collection.
754 public boolean removeAttachment(
755 final uk.ac.vamsas.objects.core.Attachment vAttachment) {
756 boolean removed = _attachmentList.remove(vAttachment);
761 * Method removeAttachmentAt.
764 * @return the element removed from the collection
766 public uk.ac.vamsas.objects.core.Attachment removeAttachmentAt(final int index) {
767 java.lang.Object obj = this._attachmentList.remove(index);
768 return (uk.ac.vamsas.objects.core.Attachment) obj;
772 * Method removeVAMSAS.
775 * @return true if the object was removed from the collection.
777 public boolean removeVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS) {
778 boolean removed = _VAMSASList.remove(vVAMSAS);
783 * Method removeVAMSASAt.
786 * @return the element removed from the collection
788 public uk.ac.vamsas.objects.core.VAMSAS removeVAMSASAt(final int index) {
789 java.lang.Object obj = this._VAMSASList.remove(index);
790 return (uk.ac.vamsas.objects.core.VAMSAS) obj;
797 * @param vApplicationData
798 * @throws java.lang.IndexOutOfBoundsException
799 * if the index given is outside the bounds of the collection
801 public void setApplicationData(final int index,
802 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
803 throws java.lang.IndexOutOfBoundsException {
804 // check bounds for index
805 if (index < 0 || index >= this._applicationDataList.size()) {
806 throw new IndexOutOfBoundsException("setApplicationData: Index value '"
807 + index + "' not in range [0.."
808 + (this._applicationDataList.size() - 1) + "]");
811 this._applicationDataList.set(index, vApplicationData);
817 * @param vApplicationDataArray
819 public void setApplicationData(
820 final uk.ac.vamsas.objects.core.ApplicationData[] vApplicationDataArray) {
822 _applicationDataList.clear();
824 for (int i = 0; i < vApplicationDataArray.length; i++) {
825 this._applicationDataList.add(vApplicationDataArray[i]);
830 * Sets the value of '_applicationDataList' by copying the given Vector. All
831 * elements will be checked for type safety.
833 * @param vApplicationDataList
834 * the Vector to copy.
836 public void setApplicationData(final java.util.Vector vApplicationDataList) {
838 this._applicationDataList.clear();
840 this._applicationDataList.addAll(vApplicationDataList);
844 * Sets the value of '_applicationDataList' by setting it to the given Vector.
845 * No type checking is performed.
849 * @param applicationDataVector
852 public void setApplicationDataAsReference(
853 final java.util.Vector applicationDataVector) {
854 this._applicationDataList = applicationDataVector;
862 * @throws java.lang.IndexOutOfBoundsException
863 * if the index given is outside the bounds of the collection
865 public void setAttachment(final int index,
866 final uk.ac.vamsas.objects.core.Attachment vAttachment)
867 throws java.lang.IndexOutOfBoundsException {
868 // check bounds for index
869 if (index < 0 || index >= this._attachmentList.size()) {
870 throw new IndexOutOfBoundsException("setAttachment: Index value '"
871 + index + "' not in range [0.." + (this._attachmentList.size() - 1)
875 this._attachmentList.set(index, vAttachment);
881 * @param vAttachmentArray
883 public void setAttachment(
884 final uk.ac.vamsas.objects.core.Attachment[] vAttachmentArray) {
886 _attachmentList.clear();
888 for (int i = 0; i < vAttachmentArray.length; i++) {
889 this._attachmentList.add(vAttachmentArray[i]);
894 * Sets the value of '_attachmentList' by copying the given Vector. All
895 * elements will be checked for type safety.
897 * @param vAttachmentList
898 * the Vector to copy.
900 public void setAttachment(final java.util.Vector vAttachmentList) {
902 this._attachmentList.clear();
904 this._attachmentList.addAll(vAttachmentList);
908 * Sets the value of '_attachmentList' by setting it to the given Vector. No
909 * type checking is performed.
913 * @param attachmentVector
916 public void setAttachmentAsReference(final java.util.Vector attachmentVector) {
917 this._attachmentList = attachmentVector;
921 * Sets the value of field 'lockFile'.
924 * the value of field 'lockFile'.
926 public void setLockFile(final uk.ac.vamsas.objects.core.LockFile lockFile) {
927 this._lockFile = lockFile;
931 * Sets the value of field 'provenance'.
934 * the value of field 'provenance'.
936 public void setProvenance(
937 final uk.ac.vamsas.objects.core.Provenance provenance) {
938 this._provenance = provenance;
946 * @throws java.lang.IndexOutOfBoundsException
947 * if the index given is outside the bounds of the collection
949 public void setVAMSAS(final int index,
950 final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
951 throws java.lang.IndexOutOfBoundsException {
952 // check bounds for index
953 if (index < 0 || index >= this._VAMSASList.size()) {
954 throw new IndexOutOfBoundsException("setVAMSAS: Index value '" + index
955 + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
958 this._VAMSASList.set(index, vVAMSAS);
964 * @param vVAMSASArray
966 public void setVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS[] vVAMSASArray) {
970 for (int i = 0; i < vVAMSASArray.length; i++) {
971 this._VAMSASList.add(vVAMSASArray[i]);
976 * Sets the value of '_VAMSASList' by copying the given Vector. All elements
977 * will be checked for type safety.
980 * the Vector to copy.
982 public void setVAMSAS(final java.util.Vector vVAMSASList) {
984 this._VAMSASList.clear();
986 this._VAMSASList.addAll(vVAMSASList);
990 * Sets the value of '_VAMSASList' by setting it to the given Vector. No type
991 * checking is performed.
995 * @param VAMSASVector
998 public void setVAMSASAsReference(final java.util.Vector VAMSASVector) {
999 this._VAMSASList = VAMSASVector;
1003 * Sets the value of field 'version'. The field 'version' has the following
1004 * description: Vamsas Document Version Number
1007 * the value of field 'version'.
1009 public void setVersion(final java.lang.String version) {
1010 this._version = version;
1017 * @throws org.exolab.castor.xml.MarshalException
1018 * if object is null or if any SAXException is thrown during
1020 * @throws org.exolab.castor.xml.ValidationException
1021 * if this object is an invalid instance according to the schema
1022 * @return the unmarshaled uk.ac.vamsas.objects.core.VamsasDocument
1024 public static uk.ac.vamsas.objects.core.VamsasDocument unmarshal(
1025 final java.io.Reader reader)
1026 throws org.exolab.castor.xml.MarshalException,
1027 org.exolab.castor.xml.ValidationException {
1028 return (uk.ac.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(
1029 uk.ac.vamsas.objects.core.VamsasDocument.class, reader);
1035 * @throws org.exolab.castor.xml.ValidationException
1036 * if this object is an invalid instance according to the schema
1038 public void validate() throws org.exolab.castor.xml.ValidationException {
1039 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1040 validator.validate(this);