8da041cff3d43e5535748aaeef886f463b2a62e1
[vamsas.git] / src / uk / ac / vamsas / objects / core / VamsasDocument.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package uk.ac.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26 /**
27  * Class VamsasDocument.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class VamsasDocument extends uk.ac.vamsas.client.Vobject 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Vamsas Document Version Number
42      */
43     private java.lang.String _version;
44
45     /**
46      * Field _lockFile
47      */
48     private uk.ac.vamsas.objects.core.LockFile _lockFile;
49
50     /**
51      * Field _provenance
52      */
53     private Provenance _provenance;
54
55     /**
56      * contains unassociated trees and a number of analysis sets
57      *  
58      */
59     private java.util.Vector _VAMSASList;
60
61     /**
62      * Field _applicationDataList
63      */
64     private java.util.Vector _applicationDataList;
65
66     /**
67      * Field _attachmentList
68      */
69     private java.util.Vector _attachmentList;
70
71
72       //----------------/
73      //- Constructors -/
74     //----------------/
75
76     public VamsasDocument() 
77      {
78         super();
79         _VAMSASList = new Vector();
80         _applicationDataList = new Vector();
81         _attachmentList = new Vector();
82     } //-- uk.ac.vamsas.objects.core.VamsasDocument()
83
84
85       //-----------/
86      //- Methods -/
87     //-----------/
88
89     /**
90      * Method addApplicationData
91      * 
92      * 
93      * 
94      * @param vApplicationData
95      */
96     public void addApplicationData(ApplicationData vApplicationData)
97         throws java.lang.IndexOutOfBoundsException
98     {
99         _applicationDataList.addElement(vApplicationData);
100     } //-- void addApplicationData(ApplicationData) 
101
102     /**
103      * Method addApplicationData
104      * 
105      * 
106      * 
107      * @param index
108      * @param vApplicationData
109      */
110     public void addApplicationData(int index, ApplicationData vApplicationData)
111         throws java.lang.IndexOutOfBoundsException
112     {
113         _applicationDataList.insertElementAt(vApplicationData, index);
114     } //-- void addApplicationData(int, ApplicationData) 
115
116     /**
117      * Method addAttachment
118      * 
119      * 
120      * 
121      * @param vAttachment
122      */
123     public void addAttachment(Attachment vAttachment)
124         throws java.lang.IndexOutOfBoundsException
125     {
126         _attachmentList.addElement(vAttachment);
127     } //-- void addAttachment(Attachment) 
128
129     /**
130      * Method addAttachment
131      * 
132      * 
133      * 
134      * @param index
135      * @param vAttachment
136      */
137     public void addAttachment(int index, Attachment vAttachment)
138         throws java.lang.IndexOutOfBoundsException
139     {
140         _attachmentList.insertElementAt(vAttachment, index);
141     } //-- void addAttachment(int, Attachment) 
142
143     /**
144      * Method addVAMSAS
145      * 
146      * 
147      * 
148      * @param vVAMSAS
149      */
150     public void addVAMSAS(VAMSAS vVAMSAS)
151         throws java.lang.IndexOutOfBoundsException
152     {
153         _VAMSASList.addElement(vVAMSAS);
154     } //-- void addVAMSAS(VAMSAS) 
155
156     /**
157      * Method addVAMSAS
158      * 
159      * 
160      * 
161      * @param index
162      * @param vVAMSAS
163      */
164     public void addVAMSAS(int index, VAMSAS vVAMSAS)
165         throws java.lang.IndexOutOfBoundsException
166     {
167         _VAMSASList.insertElementAt(vVAMSAS, index);
168     } //-- void addVAMSAS(int, VAMSAS) 
169
170     /**
171      * Method enumerateApplicationData
172      * 
173      * 
174      * 
175      * @return Enumeration
176      */
177     public java.util.Enumeration enumerateApplicationData()
178     {
179         return _applicationDataList.elements();
180     } //-- java.util.Enumeration enumerateApplicationData() 
181
182     /**
183      * Method enumerateAttachment
184      * 
185      * 
186      * 
187      * @return Enumeration
188      */
189     public java.util.Enumeration enumerateAttachment()
190     {
191         return _attachmentList.elements();
192     } //-- java.util.Enumeration enumerateAttachment() 
193
194     /**
195      * Method enumerateVAMSAS
196      * 
197      * 
198      * 
199      * @return Enumeration
200      */
201     public java.util.Enumeration enumerateVAMSAS()
202     {
203         return _VAMSASList.elements();
204     } //-- java.util.Enumeration enumerateVAMSAS() 
205
206     /**
207      * Note: hashCode() has not been overriden
208      * 
209      * @param obj
210      * @return boolean
211      */
212     public boolean equals(java.lang.Object obj)
213     {
214         if ( this == obj )
215             return true;
216         
217         if (super.equals(obj)==false)
218             return false;
219         
220         if (obj instanceof VamsasDocument) {
221         
222             VamsasDocument temp = (VamsasDocument)obj;
223             if (this._version != null) {
224                 if (temp._version == null) return false;
225                 else if (!(this._version.equals(temp._version))) 
226                     return false;
227             }
228             else if (temp._version != null)
229                 return false;
230             if (this._lockFile != null) {
231                 if (temp._lockFile == null) return false;
232                 else if (!(this._lockFile.equals(temp._lockFile))) 
233                     return false;
234             }
235             else if (temp._lockFile != null)
236                 return false;
237             if (this._provenance != null) {
238                 if (temp._provenance == null) return false;
239                 else if (!(this._provenance.equals(temp._provenance))) 
240                     return false;
241             }
242             else if (temp._provenance != null)
243                 return false;
244             if (this._VAMSASList != null) {
245                 if (temp._VAMSASList == null) return false;
246                 else if (!(this._VAMSASList.equals(temp._VAMSASList))) 
247                     return false;
248             }
249             else if (temp._VAMSASList != null)
250                 return false;
251             if (this._applicationDataList != null) {
252                 if (temp._applicationDataList == null) return false;
253                 else if (!(this._applicationDataList.equals(temp._applicationDataList))) 
254                     return false;
255             }
256             else if (temp._applicationDataList != null)
257                 return false;
258             if (this._attachmentList != null) {
259                 if (temp._attachmentList == null) return false;
260                 else if (!(this._attachmentList.equals(temp._attachmentList))) 
261                     return false;
262             }
263             else if (temp._attachmentList != null)
264                 return false;
265             return true;
266         }
267         return false;
268     } //-- boolean equals(java.lang.Object) 
269
270     /**
271      * Method getApplicationData
272      * 
273      * 
274      * 
275      * @param index
276      * @return ApplicationData
277      */
278     public ApplicationData getApplicationData(int index)
279         throws java.lang.IndexOutOfBoundsException
280     {
281         //-- check bounds for index
282         if ((index < 0) || (index > _applicationDataList.size())) {
283             throw new IndexOutOfBoundsException("getApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]");
284         }
285         
286         return (ApplicationData) _applicationDataList.elementAt(index);
287     } //-- ApplicationData getApplicationData(int) 
288
289     /**
290      * Method getApplicationData
291      * 
292      * 
293      * 
294      * @return ApplicationData
295      */
296     public ApplicationData[] getApplicationData()
297     {
298         int size = _applicationDataList.size();
299         ApplicationData[] mArray = new ApplicationData[size];
300         for (int index = 0; index < size; index++) {
301             mArray[index] = (ApplicationData) _applicationDataList.elementAt(index);
302         }
303         return mArray;
304     } //-- ApplicationData[] getApplicationData() 
305
306     /**
307      * Method getApplicationDataCount
308      * 
309      * 
310      * 
311      * @return int
312      */
313     public int getApplicationDataCount()
314     {
315         return _applicationDataList.size();
316     } //-- int getApplicationDataCount() 
317
318     /**
319      * Method getAttachment
320      * 
321      * 
322      * 
323      * @param index
324      * @return Attachment
325      */
326     public Attachment getAttachment(int index)
327         throws java.lang.IndexOutOfBoundsException
328     {
329         //-- check bounds for index
330         if ((index < 0) || (index > _attachmentList.size())) {
331             throw new IndexOutOfBoundsException("getAttachment: Index value '"+index+"' not in range [0.."+_attachmentList.size()+ "]");
332         }
333         
334         return (Attachment) _attachmentList.elementAt(index);
335     } //-- Attachment getAttachment(int) 
336
337     /**
338      * Method getAttachment
339      * 
340      * 
341      * 
342      * @return Attachment
343      */
344     public Attachment[] getAttachment()
345     {
346         int size = _attachmentList.size();
347         Attachment[] mArray = new Attachment[size];
348         for (int index = 0; index < size; index++) {
349             mArray[index] = (Attachment) _attachmentList.elementAt(index);
350         }
351         return mArray;
352     } //-- Attachment[] getAttachment() 
353
354     /**
355      * Method getAttachmentCount
356      * 
357      * 
358      * 
359      * @return int
360      */
361     public int getAttachmentCount()
362     {
363         return _attachmentList.size();
364     } //-- int getAttachmentCount() 
365
366     /**
367      * Returns the value of field 'lockFile'.
368      * 
369      * @return LockFile
370      * @return the value of field 'lockFile'.
371      */
372     public uk.ac.vamsas.objects.core.LockFile getLockFile()
373     {
374         return this._lockFile;
375     } //-- uk.ac.vamsas.objects.core.LockFile getLockFile() 
376
377     /**
378      * Returns the value of field 'provenance'.
379      * 
380      * @return Provenance
381      * @return the value of field 'provenance'.
382      */
383     public Provenance getProvenance()
384     {
385         return this._provenance;
386     } //-- Provenance getProvenance() 
387
388     /**
389      * Method getVAMSAS
390      * 
391      * 
392      * 
393      * @param index
394      * @return VAMSAS
395      */
396     public VAMSAS getVAMSAS(int index)
397         throws java.lang.IndexOutOfBoundsException
398     {
399         //-- check bounds for index
400         if ((index < 0) || (index > _VAMSASList.size())) {
401             throw new IndexOutOfBoundsException("getVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
402         }
403         
404         return (VAMSAS) _VAMSASList.elementAt(index);
405     } //-- VAMSAS getVAMSAS(int) 
406
407     /**
408      * Method getVAMSAS
409      * 
410      * 
411      * 
412      * @return VAMSAS
413      */
414     public VAMSAS[] getVAMSAS()
415     {
416         int size = _VAMSASList.size();
417         VAMSAS[] mArray = new VAMSAS[size];
418         for (int index = 0; index < size; index++) {
419             mArray[index] = (VAMSAS) _VAMSASList.elementAt(index);
420         }
421         return mArray;
422     } //-- VAMSAS[] getVAMSAS() 
423
424     /**
425      * Method getVAMSASCount
426      * 
427      * 
428      * 
429      * @return int
430      */
431     public int getVAMSASCount()
432     {
433         return _VAMSASList.size();
434     } //-- int getVAMSASCount() 
435
436     /**
437      * Returns the value of field 'version'. The field 'version'
438      * has the following description: Vamsas Document Version
439      * Number
440      * 
441      * @return String
442      * @return the value of field 'version'.
443      */
444     public java.lang.String getVersion()
445     {
446         return this._version;
447     } //-- java.lang.String getVersion() 
448
449     /**
450      * Method isValid
451      * 
452      * 
453      * 
454      * @return boolean
455      */
456     public boolean isValid()
457     {
458         try {
459             validate();
460         }
461         catch (org.exolab.castor.xml.ValidationException vex) {
462             return false;
463         }
464         return true;
465     } //-- boolean isValid() 
466
467     /**
468      * Method marshal
469      * 
470      * 
471      * 
472      * @param out
473      */
474     public void marshal(java.io.Writer out)
475         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
476     {
477         
478         Marshaller.marshal(this, out);
479     } //-- void marshal(java.io.Writer) 
480
481     /**
482      * Method marshal
483      * 
484      * 
485      * 
486      * @param handler
487      */
488     public void marshal(org.xml.sax.ContentHandler handler)
489         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
490     {
491         
492         Marshaller.marshal(this, handler);
493     } //-- void marshal(org.xml.sax.ContentHandler) 
494
495     /**
496      * Method removeAllApplicationData
497      * 
498      */
499     public void removeAllApplicationData()
500     {
501         _applicationDataList.removeAllElements();
502     } //-- void removeAllApplicationData() 
503
504     /**
505      * Method removeAllAttachment
506      * 
507      */
508     public void removeAllAttachment()
509     {
510         _attachmentList.removeAllElements();
511     } //-- void removeAllAttachment() 
512
513     /**
514      * Method removeAllVAMSAS
515      * 
516      */
517     public void removeAllVAMSAS()
518     {
519         _VAMSASList.removeAllElements();
520     } //-- void removeAllVAMSAS() 
521
522     /**
523      * Method removeApplicationData
524      * 
525      * 
526      * 
527      * @param index
528      * @return ApplicationData
529      */
530     public ApplicationData removeApplicationData(int index)
531     {
532         java.lang.Object obj = _applicationDataList.elementAt(index);
533         _applicationDataList.removeElementAt(index);
534         return (ApplicationData) obj;
535     } //-- ApplicationData removeApplicationData(int) 
536
537     /**
538      * Method removeAttachment
539      * 
540      * 
541      * 
542      * @param index
543      * @return Attachment
544      */
545     public Attachment removeAttachment(int index)
546     {
547         java.lang.Object obj = _attachmentList.elementAt(index);
548         _attachmentList.removeElementAt(index);
549         return (Attachment) obj;
550     } //-- Attachment removeAttachment(int) 
551
552     /**
553      * Method removeVAMSAS
554      * 
555      * 
556      * 
557      * @param index
558      * @return VAMSAS
559      */
560     public VAMSAS removeVAMSAS(int index)
561     {
562         java.lang.Object obj = _VAMSASList.elementAt(index);
563         _VAMSASList.removeElementAt(index);
564         return (VAMSAS) obj;
565     } //-- VAMSAS removeVAMSAS(int) 
566
567     /**
568      * Method setApplicationData
569      * 
570      * 
571      * 
572      * @param index
573      * @param vApplicationData
574      */
575     public void setApplicationData(int index, ApplicationData vApplicationData)
576         throws java.lang.IndexOutOfBoundsException
577     {
578         //-- check bounds for index
579         if ((index < 0) || (index > _applicationDataList.size())) {
580             throw new IndexOutOfBoundsException("setApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]");
581         }
582         _applicationDataList.setElementAt(vApplicationData, index);
583     } //-- void setApplicationData(int, ApplicationData) 
584
585     /**
586      * Method setApplicationData
587      * 
588      * 
589      * 
590      * @param applicationDataArray
591      */
592     public void setApplicationData(ApplicationData[] applicationDataArray)
593     {
594         //-- copy array
595         _applicationDataList.removeAllElements();
596         for (int i = 0; i < applicationDataArray.length; i++) {
597             _applicationDataList.addElement(applicationDataArray[i]);
598         }
599     } //-- void setApplicationData(ApplicationData) 
600
601     /**
602      * Method setAttachment
603      * 
604      * 
605      * 
606      * @param index
607      * @param vAttachment
608      */
609     public void setAttachment(int index, Attachment vAttachment)
610         throws java.lang.IndexOutOfBoundsException
611     {
612         //-- check bounds for index
613         if ((index < 0) || (index > _attachmentList.size())) {
614             throw new IndexOutOfBoundsException("setAttachment: Index value '"+index+"' not in range [0.."+_attachmentList.size()+ "]");
615         }
616         _attachmentList.setElementAt(vAttachment, index);
617     } //-- void setAttachment(int, Attachment) 
618
619     /**
620      * Method setAttachment
621      * 
622      * 
623      * 
624      * @param attachmentArray
625      */
626     public void setAttachment(Attachment[] attachmentArray)
627     {
628         //-- copy array
629         _attachmentList.removeAllElements();
630         for (int i = 0; i < attachmentArray.length; i++) {
631             _attachmentList.addElement(attachmentArray[i]);
632         }
633     } //-- void setAttachment(Attachment) 
634
635     /**
636      * Sets the value of field 'lockFile'.
637      * 
638      * @param lockFile the value of field 'lockFile'.
639      */
640     public void setLockFile(uk.ac.vamsas.objects.core.LockFile lockFile)
641     {
642         this._lockFile = lockFile;
643     } //-- void setLockFile(uk.ac.vamsas.objects.core.LockFile) 
644
645     /**
646      * Sets the value of field 'provenance'.
647      * 
648      * @param provenance the value of field 'provenance'.
649      */
650     public void setProvenance(Provenance provenance)
651     {
652         this._provenance = provenance;
653     } //-- void setProvenance(Provenance) 
654
655     /**
656      * Method setVAMSAS
657      * 
658      * 
659      * 
660      * @param index
661      * @param vVAMSAS
662      */
663     public void setVAMSAS(int index, VAMSAS vVAMSAS)
664         throws java.lang.IndexOutOfBoundsException
665     {
666         //-- check bounds for index
667         if ((index < 0) || (index > _VAMSASList.size())) {
668             throw new IndexOutOfBoundsException("setVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
669         }
670         _VAMSASList.setElementAt(vVAMSAS, index);
671     } //-- void setVAMSAS(int, VAMSAS) 
672
673     /**
674      * Method setVAMSAS
675      * 
676      * 
677      * 
678      * @param VAMSASArray
679      */
680     public void setVAMSAS(VAMSAS[] VAMSASArray)
681     {
682         //-- copy array
683         _VAMSASList.removeAllElements();
684         for (int i = 0; i < VAMSASArray.length; i++) {
685             _VAMSASList.addElement(VAMSASArray[i]);
686         }
687     } //-- void setVAMSAS(VAMSAS) 
688
689     /**
690      * Sets the value of field 'version'. The field 'version' has
691      * the following description: Vamsas Document Version Number
692      * 
693      * @param version the value of field 'version'.
694      */
695     public void setVersion(java.lang.String version)
696     {
697         this._version = version;
698     } //-- void setVersion(java.lang.String) 
699
700     /**
701      * Method unmarshal
702      * 
703      * 
704      * 
705      * @param reader
706      * @return VamsasDocument
707      */
708     public static uk.ac.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader reader)
709         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
710     {
711         return (uk.ac.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VamsasDocument.class, reader);
712     } //-- uk.ac.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader) 
713
714     /**
715      * Method validate
716      * 
717      */
718     public void validate()
719         throws org.exolab.castor.xml.ValidationException
720     {
721         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
722         validator.validate(this);
723     } //-- void validate() 
724
725 }