e55371551129cf2618b542fd7d7dc26a1835ebd7
[vamsas.git] / src / org / 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 org.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 org.vamsas.client.object 
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 org.vamsas.objects.core.LockFile _lockFile;
49
50     /**
51      * Field _provenance
52      */
53     private Provenance _provenance;
54
55     /**
56      * Field _VAMSASList
57      */
58     private java.util.Vector _VAMSASList;
59
60     /**
61      * Field _applicationData
62      */
63     private ApplicationData _applicationData;
64
65
66       //----------------/
67      //- Constructors -/
68     //----------------/
69
70     public VamsasDocument() 
71      {
72         super();
73         _VAMSASList = new Vector();
74     } //-- org.vamsas.objects.core.VamsasDocument()
75
76
77       //-----------/
78      //- Methods -/
79     //-----------/
80
81     /**
82      * Method addVAMSAS
83      * 
84      * 
85      * 
86      * @param vVAMSAS
87      */
88     public void addVAMSAS(VAMSAS vVAMSAS)
89         throws java.lang.IndexOutOfBoundsException
90     {
91         _VAMSASList.addElement(vVAMSAS);
92     } //-- void addVAMSAS(VAMSAS) 
93
94     /**
95      * Method addVAMSAS
96      * 
97      * 
98      * 
99      * @param index
100      * @param vVAMSAS
101      */
102     public void addVAMSAS(int index, VAMSAS vVAMSAS)
103         throws java.lang.IndexOutOfBoundsException
104     {
105         _VAMSASList.insertElementAt(vVAMSAS, index);
106     } //-- void addVAMSAS(int, VAMSAS) 
107
108     /**
109      * Method enumerateVAMSAS
110      * 
111      * 
112      * 
113      * @return Enumeration
114      */
115     public java.util.Enumeration enumerateVAMSAS()
116     {
117         return _VAMSASList.elements();
118     } //-- java.util.Enumeration enumerateVAMSAS() 
119
120     /**
121      * Note: hashCode() has not been overriden
122      * 
123      * @param obj
124      * @return boolean
125      */
126     public boolean equals(java.lang.Object obj)
127     {
128         if ( this == obj )
129             return true;
130         
131         if (super.equals(obj)==false)
132             return false;
133         
134         if (obj instanceof VamsasDocument) {
135         
136             VamsasDocument temp = (VamsasDocument)obj;
137             if (this._version != null) {
138                 if (temp._version == null) return false;
139                 else if (!(this._version.equals(temp._version))) 
140                     return false;
141             }
142             else if (temp._version != null)
143                 return false;
144             if (this._lockFile != null) {
145                 if (temp._lockFile == null) return false;
146                 else if (!(this._lockFile.equals(temp._lockFile))) 
147                     return false;
148             }
149             else if (temp._lockFile != null)
150                 return false;
151             if (this._provenance != null) {
152                 if (temp._provenance == null) return false;
153                 else if (!(this._provenance.equals(temp._provenance))) 
154                     return false;
155             }
156             else if (temp._provenance != null)
157                 return false;
158             if (this._VAMSASList != null) {
159                 if (temp._VAMSASList == null) return false;
160                 else if (!(this._VAMSASList.equals(temp._VAMSASList))) 
161                     return false;
162             }
163             else if (temp._VAMSASList != null)
164                 return false;
165             if (this._applicationData != null) {
166                 if (temp._applicationData == null) return false;
167                 else if (!(this._applicationData.equals(temp._applicationData))) 
168                     return false;
169             }
170             else if (temp._applicationData != null)
171                 return false;
172             return true;
173         }
174         return false;
175     } //-- boolean equals(java.lang.Object) 
176
177     /**
178      * Returns the value of field 'applicationData'.
179      * 
180      * @return ApplicationData
181      * @return the value of field 'applicationData'.
182      */
183     public ApplicationData getApplicationData()
184     {
185         return this._applicationData;
186     } //-- ApplicationData getApplicationData() 
187
188     /**
189      * Returns the value of field 'lockFile'.
190      * 
191      * @return LockFile
192      * @return the value of field 'lockFile'.
193      */
194     public org.vamsas.objects.core.LockFile getLockFile()
195     {
196         return this._lockFile;
197     } //-- org.vamsas.objects.core.LockFile getLockFile() 
198
199     /**
200      * Returns the value of field 'provenance'.
201      * 
202      * @return Provenance
203      * @return the value of field 'provenance'.
204      */
205     public Provenance getProvenance()
206     {
207         return this._provenance;
208     } //-- Provenance getProvenance() 
209
210     /**
211      * Method getVAMSAS
212      * 
213      * 
214      * 
215      * @param index
216      * @return VAMSAS
217      */
218     public VAMSAS getVAMSAS(int index)
219         throws java.lang.IndexOutOfBoundsException
220     {
221         //-- check bounds for index
222         if ((index < 0) || (index > _VAMSASList.size())) {
223             throw new IndexOutOfBoundsException("getVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
224         }
225         
226         return (VAMSAS) _VAMSASList.elementAt(index);
227     } //-- VAMSAS getVAMSAS(int) 
228
229     /**
230      * Method getVAMSAS
231      * 
232      * 
233      * 
234      * @return VAMSAS
235      */
236     public VAMSAS[] getVAMSAS()
237     {
238         int size = _VAMSASList.size();
239         VAMSAS[] mArray = new VAMSAS[size];
240         for (int index = 0; index < size; index++) {
241             mArray[index] = (VAMSAS) _VAMSASList.elementAt(index);
242         }
243         return mArray;
244     } //-- VAMSAS[] getVAMSAS() 
245
246     /**
247      * Method getVAMSASCount
248      * 
249      * 
250      * 
251      * @return int
252      */
253     public int getVAMSASCount()
254     {
255         return _VAMSASList.size();
256     } //-- int getVAMSASCount() 
257
258     /**
259      * Returns the value of field 'version'. The field 'version'
260      * has the following description: Vamsas Document Version
261      * Number
262      * 
263      * @return String
264      * @return the value of field 'version'.
265      */
266     public java.lang.String getVersion()
267     {
268         return this._version;
269     } //-- java.lang.String getVersion() 
270
271     /**
272      * Method isValid
273      * 
274      * 
275      * 
276      * @return boolean
277      */
278     public boolean isValid()
279     {
280         try {
281             validate();
282         }
283         catch (org.exolab.castor.xml.ValidationException vex) {
284             return false;
285         }
286         return true;
287     } //-- boolean isValid() 
288
289     /**
290      * Method marshal
291      * 
292      * 
293      * 
294      * @param out
295      */
296     public void marshal(java.io.Writer out)
297         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
298     {
299         
300         Marshaller.marshal(this, out);
301     } //-- void marshal(java.io.Writer) 
302
303     /**
304      * Method marshal
305      * 
306      * 
307      * 
308      * @param handler
309      */
310     public void marshal(org.xml.sax.ContentHandler handler)
311         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
312     {
313         
314         Marshaller.marshal(this, handler);
315     } //-- void marshal(org.xml.sax.ContentHandler) 
316
317     /**
318      * Method removeAllVAMSAS
319      * 
320      */
321     public void removeAllVAMSAS()
322     {
323         _VAMSASList.removeAllElements();
324     } //-- void removeAllVAMSAS() 
325
326     /**
327      * Method removeVAMSAS
328      * 
329      * 
330      * 
331      * @param index
332      * @return VAMSAS
333      */
334     public VAMSAS removeVAMSAS(int index)
335     {
336         java.lang.Object obj = _VAMSASList.elementAt(index);
337         _VAMSASList.removeElementAt(index);
338         return (VAMSAS) obj;
339     } //-- VAMSAS removeVAMSAS(int) 
340
341     /**
342      * Sets the value of field 'applicationData'.
343      * 
344      * @param applicationData the value of field 'applicationData'.
345      */
346     public void setApplicationData(ApplicationData applicationData)
347     {
348         this._applicationData = applicationData;
349     } //-- void setApplicationData(ApplicationData) 
350
351     /**
352      * Sets the value of field 'lockFile'.
353      * 
354      * @param lockFile the value of field 'lockFile'.
355      */
356     public void setLockFile(org.vamsas.objects.core.LockFile lockFile)
357     {
358         this._lockFile = lockFile;
359     } //-- void setLockFile(org.vamsas.objects.core.LockFile) 
360
361     /**
362      * Sets the value of field 'provenance'.
363      * 
364      * @param provenance the value of field 'provenance'.
365      */
366     public void setProvenance(Provenance provenance)
367     {
368         this._provenance = provenance;
369     } //-- void setProvenance(Provenance) 
370
371     /**
372      * Method setVAMSAS
373      * 
374      * 
375      * 
376      * @param index
377      * @param vVAMSAS
378      */
379     public void setVAMSAS(int index, VAMSAS vVAMSAS)
380         throws java.lang.IndexOutOfBoundsException
381     {
382         //-- check bounds for index
383         if ((index < 0) || (index > _VAMSASList.size())) {
384             throw new IndexOutOfBoundsException("setVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
385         }
386         _VAMSASList.setElementAt(vVAMSAS, index);
387     } //-- void setVAMSAS(int, VAMSAS) 
388
389     /**
390      * Method setVAMSAS
391      * 
392      * 
393      * 
394      * @param VAMSASArray
395      */
396     public void setVAMSAS(VAMSAS[] VAMSASArray)
397     {
398         //-- copy array
399         _VAMSASList.removeAllElements();
400         for (int i = 0; i < VAMSASArray.length; i++) {
401             _VAMSASList.addElement(VAMSASArray[i]);
402         }
403     } //-- void setVAMSAS(VAMSAS) 
404
405     /**
406      * Sets the value of field 'version'. The field 'version' has
407      * the following description: Vamsas Document Version Number
408      * 
409      * @param version the value of field 'version'.
410      */
411     public void setVersion(java.lang.String version)
412     {
413         this._version = version;
414     } //-- void setVersion(java.lang.String) 
415
416     /**
417      * Method unmarshal
418      * 
419      * 
420      * 
421      * @param reader
422      * @return VamsasDocument
423      */
424     public static org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader reader)
425         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
426     {
427         return (org.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(org.vamsas.objects.core.VamsasDocument.class, reader);
428     } //-- org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader) 
429
430     /**
431      * Method validate
432      * 
433      */
434     public void validate()
435         throws org.exolab.castor.xml.ValidationException
436     {
437         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
438         validator.validate(this);
439     } //-- void validate() 
440
441 }