applied LGPLv3 and source code formatting.
[vamsas.git] / src / uk / ac / vamsas / objects / core / VamsasDocument.java
1 /*
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.
5  * 
6  * Earlier versions have also been incorporated into Jalview version 2.4 
7  * since 2008, and TOPALi version 2 since 2007.
8  * 
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.
13  *  
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.
18  * 
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/>.
21  */
22 package uk.ac.vamsas.objects.core;
23
24 //---------------------------------/
25 //- Imported classes and packages -/
26 //---------------------------------/
27
28 import org.exolab.castor.xml.Marshaller;
29 import org.exolab.castor.xml.Unmarshaller;
30
31 /**
32  * Class VamsasDocument.
33  * 
34  * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
35  *          $
36  */
37 public class VamsasDocument extends uk.ac.vamsas.client.Vobject implements
38     java.io.Serializable {
39
40   // --------------------------/
41   // - Class/Member Variables -/
42   // --------------------------/
43
44   /**
45    * Vamsas Document Version Number
46    */
47   private java.lang.String _version;
48
49   /**
50    * Field _lockFile.
51    */
52   private uk.ac.vamsas.objects.core.LockFile _lockFile;
53
54   /**
55    * Field _provenance.
56    */
57   private uk.ac.vamsas.objects.core.Provenance _provenance;
58
59   /**
60    * contains unassociated trees and a number of analysis sets
61    * 
62    */
63   private java.util.Vector _VAMSASList;
64
65   /**
66    * Field _applicationDataList.
67    */
68   private java.util.Vector _applicationDataList;
69
70   /**
71    * Field _attachmentList.
72    */
73   private java.util.Vector _attachmentList;
74
75   // ----------------/
76   // - Constructors -/
77   // ----------------/
78
79   public VamsasDocument() {
80     super();
81     this._VAMSASList = new java.util.Vector();
82     this._applicationDataList = new java.util.Vector();
83     this._attachmentList = new java.util.Vector();
84   }
85
86   // -----------/
87   // - Methods -/
88   // -----------/
89
90   /**
91    * 
92    * 
93    * @param vApplicationData
94    * @throws java.lang.IndexOutOfBoundsException
95    *           if the index given is outside the bounds of the collection
96    */
97   public void addApplicationData(
98       final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
99       throws java.lang.IndexOutOfBoundsException {
100     this._applicationDataList.addElement(vApplicationData);
101   }
102
103   /**
104    * 
105    * 
106    * @param index
107    * @param vApplicationData
108    * @throws java.lang.IndexOutOfBoundsException
109    *           if the index given is outside the bounds of the collection
110    */
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);
115   }
116
117   /**
118    * 
119    * 
120    * @param vAttachment
121    * @throws java.lang.IndexOutOfBoundsException
122    *           if the index given is outside the bounds of the collection
123    */
124   public void addAttachment(
125       final uk.ac.vamsas.objects.core.Attachment vAttachment)
126       throws java.lang.IndexOutOfBoundsException {
127     this._attachmentList.addElement(vAttachment);
128   }
129
130   /**
131    * 
132    * 
133    * @param index
134    * @param vAttachment
135    * @throws java.lang.IndexOutOfBoundsException
136    *           if the index given is outside the bounds of the collection
137    */
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);
142   }
143
144   /**
145    * 
146    * 
147    * @param vVAMSAS
148    * @throws java.lang.IndexOutOfBoundsException
149    *           if the index given is outside the bounds of the collection
150    */
151   public void addVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
152       throws java.lang.IndexOutOfBoundsException {
153     this._VAMSASList.addElement(vVAMSAS);
154   }
155
156   /**
157    * 
158    * 
159    * @param index
160    * @param vVAMSAS
161    * @throws java.lang.IndexOutOfBoundsException
162    *           if the index given is outside the bounds of the collection
163    */
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);
168   }
169
170   /**
171    * Method enumerateApplicationData.
172    * 
173    * @return an Enumeration over all uk.ac.vamsas.objects.core.ApplicationData
174    *         elements
175    */
176   public java.util.Enumeration enumerateApplicationData() {
177     return this._applicationDataList.elements();
178   }
179
180   /**
181    * Method enumerateAttachment.
182    * 
183    * @return an Enumeration over all uk.ac.vamsas.objects.core.Attachment
184    *         elements
185    */
186   public java.util.Enumeration enumerateAttachment() {
187     return this._attachmentList.elements();
188   }
189
190   /**
191    * Method enumerateVAMSAS.
192    * 
193    * @return an Enumeration over all uk.ac.vamsas.objects.core.VAMSAS elements
194    */
195   public java.util.Enumeration enumerateVAMSAS() {
196     return this._VAMSASList.elements();
197   }
198
199   /**
200    * Overrides the java.lang.Object.equals method.
201    * 
202    * @param obj
203    * @return true if the objects are equal.
204    */
205   public boolean equals(final java.lang.Object obj) {
206     if (this == obj)
207       return true;
208
209     if (super.equals(obj) == false)
210       return false;
211
212     if (obj instanceof VamsasDocument) {
213
214       VamsasDocument temp = (VamsasDocument) obj;
215       boolean thcycle;
216       boolean tmcycle;
217       if (this._version != null) {
218         if (temp._version == null)
219           return false;
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) {
224             if (!thcycle) {
225               org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
226             }
227             ;
228             if (!tmcycle) {
229               org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
230             }
231             ;
232             return false;
233           }
234           if (!thcycle) {
235             if (!this._version.equals(temp._version)) {
236               org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
237               org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
238               return false;
239             }
240             org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
241             org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
242           }
243         }
244       } else if (temp._version != null)
245         return false;
246       if (this._lockFile != null) {
247         if (temp._lockFile == null)
248           return false;
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) {
255             if (!thcycle) {
256               org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
257             }
258             ;
259             if (!tmcycle) {
260               org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
261             }
262             ;
263             return false;
264           }
265           if (!thcycle) {
266             if (!this._lockFile.equals(temp._lockFile)) {
267               org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
268               org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
269               return false;
270             }
271             org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
272             org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
273           }
274         }
275       } else if (temp._lockFile != null)
276         return false;
277       if (this._provenance != null) {
278         if (temp._provenance == null)
279           return false;
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) {
286             if (!thcycle) {
287               org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
288             }
289             ;
290             if (!tmcycle) {
291               org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
292             }
293             ;
294             return false;
295           }
296           if (!thcycle) {
297             if (!this._provenance.equals(temp._provenance)) {
298               org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
299               org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
300               return false;
301             }
302             org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
303             org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
304           }
305         }
306       } else if (temp._provenance != null)
307         return false;
308       if (this._VAMSASList != null) {
309         if (temp._VAMSASList == null)
310           return false;
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) {
317             if (!thcycle) {
318               org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
319             }
320             ;
321             if (!tmcycle) {
322               org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
323             }
324             ;
325             return false;
326           }
327           if (!thcycle) {
328             if (!this._VAMSASList.equals(temp._VAMSASList)) {
329               org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
330               org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
331               return false;
332             }
333             org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
334             org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
335           }
336         }
337       } else if (temp._VAMSASList != null)
338         return false;
339       if (this._applicationDataList != null) {
340         if (temp._applicationDataList == null)
341           return false;
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) {
348             if (!thcycle) {
349               org.castor.util.CycleBreaker
350                   .releaseCycleHandle(this._applicationDataList);
351             }
352             ;
353             if (!tmcycle) {
354               org.castor.util.CycleBreaker
355                   .releaseCycleHandle(temp._applicationDataList);
356             }
357             ;
358             return false;
359           }
360           if (!thcycle) {
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);
366               return false;
367             }
368             org.castor.util.CycleBreaker
369                 .releaseCycleHandle(this._applicationDataList);
370             org.castor.util.CycleBreaker
371                 .releaseCycleHandle(temp._applicationDataList);
372           }
373         }
374       } else if (temp._applicationDataList != null)
375         return false;
376       if (this._attachmentList != null) {
377         if (temp._attachmentList == null)
378           return false;
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) {
385             if (!thcycle) {
386               org.castor.util.CycleBreaker
387                   .releaseCycleHandle(this._attachmentList);
388             }
389             ;
390             if (!tmcycle) {
391               org.castor.util.CycleBreaker
392                   .releaseCycleHandle(temp._attachmentList);
393             }
394             ;
395             return false;
396           }
397           if (!thcycle) {
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);
403               return false;
404             }
405             org.castor.util.CycleBreaker
406                 .releaseCycleHandle(this._attachmentList);
407             org.castor.util.CycleBreaker
408                 .releaseCycleHandle(temp._attachmentList);
409           }
410         }
411       } else if (temp._attachmentList != null)
412         return false;
413       return true;
414     }
415     return false;
416   }
417
418   /**
419    * Method getApplicationData.
420    * 
421    * @param index
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
425    *         given index
426    */
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) + "]");
434     }
435
436     return (uk.ac.vamsas.objects.core.ApplicationData) _applicationDataList
437         .get(index);
438   }
439
440   /**
441    * Method getApplicationData.Returns the contents of the collection in an
442    * Array.
443    * <p>
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.
447    * 
448    * @return this collection as an Array
449    */
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
453         .toArray(array);
454   }
455
456   /**
457    * Method getApplicationDataAsReference.Returns a reference to
458    * '_applicationDataList'. No type checking is performed on any modifications
459    * to the Vector.
460    * 
461    * @return a reference to the Vector backing this class
462    */
463   public java.util.Vector getApplicationDataAsReference() {
464     return this._applicationDataList;
465   }
466
467   /**
468    * Method getApplicationDataCount.
469    * 
470    * @return the size of this collection
471    */
472   public int getApplicationDataCount() {
473     return this._applicationDataList.size();
474   }
475
476   /**
477    * Method getAttachment.
478    * 
479    * @param index
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
483    *         index
484    */
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)
491           + "]");
492     }
493
494     return (uk.ac.vamsas.objects.core.Attachment) _attachmentList.get(index);
495   }
496
497   /**
498    * Method getAttachment.Returns the contents of the collection in an Array.
499    * <p>
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.
503    * 
504    * @return this collection as an Array
505    */
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
509         .toArray(array);
510   }
511
512   /**
513    * Method getAttachmentAsReference.Returns a reference to '_attachmentList'.
514    * No type checking is performed on any modifications to the Vector.
515    * 
516    * @return a reference to the Vector backing this class
517    */
518   public java.util.Vector getAttachmentAsReference() {
519     return this._attachmentList;
520   }
521
522   /**
523    * Method getAttachmentCount.
524    * 
525    * @return the size of this collection
526    */
527   public int getAttachmentCount() {
528     return this._attachmentList.size();
529   }
530
531   /**
532    * Returns the value of field 'lockFile'.
533    * 
534    * @return the value of field 'LockFile'.
535    */
536   public uk.ac.vamsas.objects.core.LockFile getLockFile() {
537     return this._lockFile;
538   }
539
540   /**
541    * Returns the value of field 'provenance'.
542    * 
543    * @return the value of field 'Provenance'.
544    */
545   public uk.ac.vamsas.objects.core.Provenance getProvenance() {
546     return this._provenance;
547   }
548
549   /**
550    * Method getVAMSAS.
551    * 
552    * @param index
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
556    *         index
557    */
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) + "]");
564     }
565
566     return (uk.ac.vamsas.objects.core.VAMSAS) _VAMSASList.get(index);
567   }
568
569   /**
570    * Method getVAMSAS.Returns the contents of the collection in an Array.
571    * <p>
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.
575    * 
576    * @return this collection as an Array
577    */
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);
581   }
582
583   /**
584    * Method getVAMSASAsReference.Returns a reference to '_VAMSASList'. No type
585    * checking is performed on any modifications to the Vector.
586    * 
587    * @return a reference to the Vector backing this class
588    */
589   public java.util.Vector getVAMSASAsReference() {
590     return this._VAMSASList;
591   }
592
593   /**
594    * Method getVAMSASCount.
595    * 
596    * @return the size of this collection
597    */
598   public int getVAMSASCount() {
599     return this._VAMSASList.size();
600   }
601
602   /**
603    * Returns the value of field 'version'. The field 'version' has the following
604    * description: Vamsas Document Version Number
605    * 
606    * @return the value of field 'Version'.
607    */
608   public java.lang.String getVersion() {
609     return this._version;
610   }
611
612   /**
613    * Overrides the java.lang.Object.hashCode method.
614    * <p>
615    * The following steps came from <b>Effective Java Programming Language
616    * Guide</b> by Joshua Bloch, Chapter 3
617    * 
618    * @return a hash code value for the object.
619    */
620   public int hashCode() {
621     int result = super.hashCode();
622
623     long tmp;
624     if (_version != null
625         && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
626       result = 37 * result + _version.hashCode();
627       org.castor.util.CycleBreaker.releaseCycleHandle(_version);
628     }
629     if (_lockFile != null
630         && !org.castor.util.CycleBreaker.startingToCycle(_lockFile)) {
631       result = 37 * result + _lockFile.hashCode();
632       org.castor.util.CycleBreaker.releaseCycleHandle(_lockFile);
633     }
634     if (_provenance != null
635         && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
636       result = 37 * result + _provenance.hashCode();
637       org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
638     }
639     if (_VAMSASList != null
640         && !org.castor.util.CycleBreaker.startingToCycle(_VAMSASList)) {
641       result = 37 * result + _VAMSASList.hashCode();
642       org.castor.util.CycleBreaker.releaseCycleHandle(_VAMSASList);
643     }
644     if (_applicationDataList != null
645         && !org.castor.util.CycleBreaker.startingToCycle(_applicationDataList)) {
646       result = 37 * result + _applicationDataList.hashCode();
647       org.castor.util.CycleBreaker.releaseCycleHandle(_applicationDataList);
648     }
649     if (_attachmentList != null
650         && !org.castor.util.CycleBreaker.startingToCycle(_attachmentList)) {
651       result = 37 * result + _attachmentList.hashCode();
652       org.castor.util.CycleBreaker.releaseCycleHandle(_attachmentList);
653     }
654
655     return result;
656   }
657
658   /**
659    * Method isValid.
660    * 
661    * @return true if this object is valid according to the schema
662    */
663   public boolean isValid() {
664     try {
665       validate();
666     } catch (org.exolab.castor.xml.ValidationException vex) {
667       return false;
668     }
669     return true;
670   }
671
672   /**
673    * 
674    * 
675    * @param out
676    * @throws org.exolab.castor.xml.MarshalException
677    *           if object is null or if any SAXException is thrown during
678    *           marshaling
679    * @throws org.exolab.castor.xml.ValidationException
680    *           if this object is an invalid instance according to the schema
681    */
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);
686   }
687
688   /**
689    * 
690    * 
691    * @param handler
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
698    *           marshaling
699    */
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);
704   }
705
706   /**
707      */
708   public void removeAllApplicationData() {
709     this._applicationDataList.clear();
710   }
711
712   /**
713      */
714   public void removeAllAttachment() {
715     this._attachmentList.clear();
716   }
717
718   /**
719      */
720   public void removeAllVAMSAS() {
721     this._VAMSASList.clear();
722   }
723
724   /**
725    * Method removeApplicationData.
726    * 
727    * @param vApplicationData
728    * @return true if the object was removed from the collection.
729    */
730   public boolean removeApplicationData(
731       final uk.ac.vamsas.objects.core.ApplicationData vApplicationData) {
732     boolean removed = _applicationDataList.remove(vApplicationData);
733     return removed;
734   }
735
736   /**
737    * Method removeApplicationDataAt.
738    * 
739    * @param index
740    * @return the element removed from the collection
741    */
742   public uk.ac.vamsas.objects.core.ApplicationData removeApplicationDataAt(
743       final int index) {
744     java.lang.Object obj = this._applicationDataList.remove(index);
745     return (uk.ac.vamsas.objects.core.ApplicationData) obj;
746   }
747
748   /**
749    * Method removeAttachment.
750    * 
751    * @param vAttachment
752    * @return true if the object was removed from the collection.
753    */
754   public boolean removeAttachment(
755       final uk.ac.vamsas.objects.core.Attachment vAttachment) {
756     boolean removed = _attachmentList.remove(vAttachment);
757     return removed;
758   }
759
760   /**
761    * Method removeAttachmentAt.
762    * 
763    * @param index
764    * @return the element removed from the collection
765    */
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;
769   }
770
771   /**
772    * Method removeVAMSAS.
773    * 
774    * @param vVAMSAS
775    * @return true if the object was removed from the collection.
776    */
777   public boolean removeVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS) {
778     boolean removed = _VAMSASList.remove(vVAMSAS);
779     return removed;
780   }
781
782   /**
783    * Method removeVAMSASAt.
784    * 
785    * @param index
786    * @return the element removed from the collection
787    */
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;
791   }
792
793   /**
794    * 
795    * 
796    * @param index
797    * @param vApplicationData
798    * @throws java.lang.IndexOutOfBoundsException
799    *           if the index given is outside the bounds of the collection
800    */
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) + "]");
809     }
810
811     this._applicationDataList.set(index, vApplicationData);
812   }
813
814   /**
815    * 
816    * 
817    * @param vApplicationDataArray
818    */
819   public void setApplicationData(
820       final uk.ac.vamsas.objects.core.ApplicationData[] vApplicationDataArray) {
821     // -- copy array
822     _applicationDataList.clear();
823
824     for (int i = 0; i < vApplicationDataArray.length; i++) {
825       this._applicationDataList.add(vApplicationDataArray[i]);
826     }
827   }
828
829   /**
830    * Sets the value of '_applicationDataList' by copying the given Vector. All
831    * elements will be checked for type safety.
832    * 
833    * @param vApplicationDataList
834    *          the Vector to copy.
835    */
836   public void setApplicationData(final java.util.Vector vApplicationDataList) {
837     // copy vector
838     this._applicationDataList.clear();
839
840     this._applicationDataList.addAll(vApplicationDataList);
841   }
842
843   /**
844    * Sets the value of '_applicationDataList' by setting it to the given Vector.
845    * No type checking is performed.
846    * 
847    * @deprecated
848    * 
849    * @param applicationDataVector
850    *          the Vector to set.
851    */
852   public void setApplicationDataAsReference(
853       final java.util.Vector applicationDataVector) {
854     this._applicationDataList = applicationDataVector;
855   }
856
857   /**
858    * 
859    * 
860    * @param index
861    * @param vAttachment
862    * @throws java.lang.IndexOutOfBoundsException
863    *           if the index given is outside the bounds of the collection
864    */
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)
872           + "]");
873     }
874
875     this._attachmentList.set(index, vAttachment);
876   }
877
878   /**
879    * 
880    * 
881    * @param vAttachmentArray
882    */
883   public void setAttachment(
884       final uk.ac.vamsas.objects.core.Attachment[] vAttachmentArray) {
885     // -- copy array
886     _attachmentList.clear();
887
888     for (int i = 0; i < vAttachmentArray.length; i++) {
889       this._attachmentList.add(vAttachmentArray[i]);
890     }
891   }
892
893   /**
894    * Sets the value of '_attachmentList' by copying the given Vector. All
895    * elements will be checked for type safety.
896    * 
897    * @param vAttachmentList
898    *          the Vector to copy.
899    */
900   public void setAttachment(final java.util.Vector vAttachmentList) {
901     // copy vector
902     this._attachmentList.clear();
903
904     this._attachmentList.addAll(vAttachmentList);
905   }
906
907   /**
908    * Sets the value of '_attachmentList' by setting it to the given Vector. No
909    * type checking is performed.
910    * 
911    * @deprecated
912    * 
913    * @param attachmentVector
914    *          the Vector to set.
915    */
916   public void setAttachmentAsReference(final java.util.Vector attachmentVector) {
917     this._attachmentList = attachmentVector;
918   }
919
920   /**
921    * Sets the value of field 'lockFile'.
922    * 
923    * @param lockFile
924    *          the value of field 'lockFile'.
925    */
926   public void setLockFile(final uk.ac.vamsas.objects.core.LockFile lockFile) {
927     this._lockFile = lockFile;
928   }
929
930   /**
931    * Sets the value of field 'provenance'.
932    * 
933    * @param provenance
934    *          the value of field 'provenance'.
935    */
936   public void setProvenance(
937       final uk.ac.vamsas.objects.core.Provenance provenance) {
938     this._provenance = provenance;
939   }
940
941   /**
942    * 
943    * 
944    * @param index
945    * @param vVAMSAS
946    * @throws java.lang.IndexOutOfBoundsException
947    *           if the index given is outside the bounds of the collection
948    */
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) + "]");
956     }
957
958     this._VAMSASList.set(index, vVAMSAS);
959   }
960
961   /**
962    * 
963    * 
964    * @param vVAMSASArray
965    */
966   public void setVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS[] vVAMSASArray) {
967     // -- copy array
968     _VAMSASList.clear();
969
970     for (int i = 0; i < vVAMSASArray.length; i++) {
971       this._VAMSASList.add(vVAMSASArray[i]);
972     }
973   }
974
975   /**
976    * Sets the value of '_VAMSASList' by copying the given Vector. All elements
977    * will be checked for type safety.
978    * 
979    * @param vVAMSASList
980    *          the Vector to copy.
981    */
982   public void setVAMSAS(final java.util.Vector vVAMSASList) {
983     // copy vector
984     this._VAMSASList.clear();
985
986     this._VAMSASList.addAll(vVAMSASList);
987   }
988
989   /**
990    * Sets the value of '_VAMSASList' by setting it to the given Vector. No type
991    * checking is performed.
992    * 
993    * @deprecated
994    * 
995    * @param VAMSASVector
996    *          the Vector to set.
997    */
998   public void setVAMSASAsReference(final java.util.Vector VAMSASVector) {
999     this._VAMSASList = VAMSASVector;
1000   }
1001
1002   /**
1003    * Sets the value of field 'version'. The field 'version' has the following
1004    * description: Vamsas Document Version Number
1005    * 
1006    * @param version
1007    *          the value of field 'version'.
1008    */
1009   public void setVersion(final java.lang.String version) {
1010     this._version = version;
1011   }
1012
1013   /**
1014    * Method unmarshal.
1015    * 
1016    * @param reader
1017    * @throws org.exolab.castor.xml.MarshalException
1018    *           if object is null or if any SAXException is thrown during
1019    *           marshaling
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
1023    */
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);
1030   }
1031
1032   /**
1033    * 
1034    * 
1035    * @throws org.exolab.castor.xml.ValidationException
1036    *           if this object is an invalid instance according to the schema
1037    */
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);
1041   }
1042
1043 }