2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package org.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
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;
27 * Class VamsasDocument.
29 * @version $Revision$ $Date$
31 public class VamsasDocument extends org.vamsas.client.object
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Vamsas Document Version Number
43 private java.lang.String _version;
48 private org.vamsas.objects.core.LockFile _lockFile;
53 private Provenance _provenance;
58 private java.util.Vector _VAMSASList;
61 * Field _applicationDataList
63 private java.util.Vector _applicationDataList;
70 public VamsasDocument()
73 _VAMSASList = new Vector();
74 _applicationDataList = new Vector();
75 } //-- org.vamsas.objects.core.VamsasDocument()
83 * Method addApplicationData
87 * @param vApplicationData
89 public void addApplicationData(ApplicationData vApplicationData)
90 throws java.lang.IndexOutOfBoundsException
92 _applicationDataList.addElement(vApplicationData);
93 } //-- void addApplicationData(ApplicationData)
96 * Method addApplicationData
101 * @param vApplicationData
103 public void addApplicationData(int index, ApplicationData vApplicationData)
104 throws java.lang.IndexOutOfBoundsException
106 _applicationDataList.insertElementAt(vApplicationData, index);
107 } //-- void addApplicationData(int, ApplicationData)
116 public void addVAMSAS(VAMSAS vVAMSAS)
117 throws java.lang.IndexOutOfBoundsException
119 _VAMSASList.addElement(vVAMSAS);
120 } //-- void addVAMSAS(VAMSAS)
130 public void addVAMSAS(int index, VAMSAS vVAMSAS)
131 throws java.lang.IndexOutOfBoundsException
133 _VAMSASList.insertElementAt(vVAMSAS, index);
134 } //-- void addVAMSAS(int, VAMSAS)
137 * Method enumerateApplicationData
141 * @return Enumeration
143 public java.util.Enumeration enumerateApplicationData()
145 return _applicationDataList.elements();
146 } //-- java.util.Enumeration enumerateApplicationData()
149 * Method enumerateVAMSAS
153 * @return Enumeration
155 public java.util.Enumeration enumerateVAMSAS()
157 return _VAMSASList.elements();
158 } //-- java.util.Enumeration enumerateVAMSAS()
161 * Note: hashCode() has not been overriden
166 public boolean equals(java.lang.Object obj)
171 if (super.equals(obj)==false)
174 if (obj instanceof VamsasDocument) {
176 VamsasDocument temp = (VamsasDocument)obj;
177 if (this._version != null) {
178 if (temp._version == null) return false;
179 else if (!(this._version.equals(temp._version)))
182 else if (temp._version != null)
184 if (this._lockFile != null) {
185 if (temp._lockFile == null) return false;
186 else if (!(this._lockFile.equals(temp._lockFile)))
189 else if (temp._lockFile != null)
191 if (this._provenance != null) {
192 if (temp._provenance == null) return false;
193 else if (!(this._provenance.equals(temp._provenance)))
196 else if (temp._provenance != null)
198 if (this._VAMSASList != null) {
199 if (temp._VAMSASList == null) return false;
200 else if (!(this._VAMSASList.equals(temp._VAMSASList)))
203 else if (temp._VAMSASList != null)
205 if (this._applicationDataList != null) {
206 if (temp._applicationDataList == null) return false;
207 else if (!(this._applicationDataList.equals(temp._applicationDataList)))
210 else if (temp._applicationDataList != null)
215 } //-- boolean equals(java.lang.Object)
218 * Method getApplicationData
223 * @return ApplicationData
225 public ApplicationData getApplicationData(int index)
226 throws java.lang.IndexOutOfBoundsException
228 //-- check bounds for index
229 if ((index < 0) || (index > _applicationDataList.size())) {
230 throw new IndexOutOfBoundsException("getApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]");
233 return (ApplicationData) _applicationDataList.elementAt(index);
234 } //-- ApplicationData getApplicationData(int)
237 * Method getApplicationData
241 * @return ApplicationData
243 public ApplicationData[] getApplicationData()
245 int size = _applicationDataList.size();
246 ApplicationData[] mArray = new ApplicationData[size];
247 for (int index = 0; index < size; index++) {
248 mArray[index] = (ApplicationData) _applicationDataList.elementAt(index);
251 } //-- ApplicationData[] getApplicationData()
254 * Method getApplicationDataCount
260 public int getApplicationDataCount()
262 return _applicationDataList.size();
263 } //-- int getApplicationDataCount()
266 * Returns the value of field 'lockFile'.
269 * @return the value of field 'lockFile'.
271 public org.vamsas.objects.core.LockFile getLockFile()
273 return this._lockFile;
274 } //-- org.vamsas.objects.core.LockFile getLockFile()
277 * Returns the value of field 'provenance'.
280 * @return the value of field 'provenance'.
282 public Provenance getProvenance()
284 return this._provenance;
285 } //-- Provenance getProvenance()
295 public VAMSAS getVAMSAS(int index)
296 throws java.lang.IndexOutOfBoundsException
298 //-- check bounds for index
299 if ((index < 0) || (index > _VAMSASList.size())) {
300 throw new IndexOutOfBoundsException("getVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
303 return (VAMSAS) _VAMSASList.elementAt(index);
304 } //-- VAMSAS getVAMSAS(int)
313 public VAMSAS[] getVAMSAS()
315 int size = _VAMSASList.size();
316 VAMSAS[] mArray = new VAMSAS[size];
317 for (int index = 0; index < size; index++) {
318 mArray[index] = (VAMSAS) _VAMSASList.elementAt(index);
321 } //-- VAMSAS[] getVAMSAS()
324 * Method getVAMSASCount
330 public int getVAMSASCount()
332 return _VAMSASList.size();
333 } //-- int getVAMSASCount()
336 * Returns the value of field 'version'. The field 'version'
337 * has the following description: Vamsas Document Version
341 * @return the value of field 'version'.
343 public java.lang.String getVersion()
345 return this._version;
346 } //-- java.lang.String getVersion()
355 public boolean isValid()
360 catch (org.exolab.castor.xml.ValidationException vex) {
364 } //-- boolean isValid()
373 public void marshal(java.io.Writer out)
374 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
377 Marshaller.marshal(this, out);
378 } //-- void marshal(java.io.Writer)
387 public void marshal(org.xml.sax.ContentHandler handler)
388 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
391 Marshaller.marshal(this, handler);
392 } //-- void marshal(org.xml.sax.ContentHandler)
395 * Method removeAllApplicationData
398 public void removeAllApplicationData()
400 _applicationDataList.removeAllElements();
401 } //-- void removeAllApplicationData()
404 * Method removeAllVAMSAS
407 public void removeAllVAMSAS()
409 _VAMSASList.removeAllElements();
410 } //-- void removeAllVAMSAS()
413 * Method removeApplicationData
418 * @return ApplicationData
420 public ApplicationData removeApplicationData(int index)
422 java.lang.Object obj = _applicationDataList.elementAt(index);
423 _applicationDataList.removeElementAt(index);
424 return (ApplicationData) obj;
425 } //-- ApplicationData removeApplicationData(int)
428 * Method removeVAMSAS
435 public VAMSAS removeVAMSAS(int index)
437 java.lang.Object obj = _VAMSASList.elementAt(index);
438 _VAMSASList.removeElementAt(index);
440 } //-- VAMSAS removeVAMSAS(int)
443 * Method setApplicationData
448 * @param vApplicationData
450 public void setApplicationData(int index, ApplicationData vApplicationData)
451 throws java.lang.IndexOutOfBoundsException
453 //-- check bounds for index
454 if ((index < 0) || (index > _applicationDataList.size())) {
455 throw new IndexOutOfBoundsException("setApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]");
457 _applicationDataList.setElementAt(vApplicationData, index);
458 } //-- void setApplicationData(int, ApplicationData)
461 * Method setApplicationData
465 * @param applicationDataArray
467 public void setApplicationData(ApplicationData[] applicationDataArray)
470 _applicationDataList.removeAllElements();
471 for (int i = 0; i < applicationDataArray.length; i++) {
472 _applicationDataList.addElement(applicationDataArray[i]);
474 } //-- void setApplicationData(ApplicationData)
477 * Sets the value of field 'lockFile'.
479 * @param lockFile the value of field 'lockFile'.
481 public void setLockFile(org.vamsas.objects.core.LockFile lockFile)
483 this._lockFile = lockFile;
484 } //-- void setLockFile(org.vamsas.objects.core.LockFile)
487 * Sets the value of field 'provenance'.
489 * @param provenance the value of field 'provenance'.
491 public void setProvenance(Provenance provenance)
493 this._provenance = provenance;
494 } //-- void setProvenance(Provenance)
504 public void setVAMSAS(int index, VAMSAS vVAMSAS)
505 throws java.lang.IndexOutOfBoundsException
507 //-- check bounds for index
508 if ((index < 0) || (index > _VAMSASList.size())) {
509 throw new IndexOutOfBoundsException("setVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
511 _VAMSASList.setElementAt(vVAMSAS, index);
512 } //-- void setVAMSAS(int, VAMSAS)
521 public void setVAMSAS(VAMSAS[] VAMSASArray)
524 _VAMSASList.removeAllElements();
525 for (int i = 0; i < VAMSASArray.length; i++) {
526 _VAMSASList.addElement(VAMSASArray[i]);
528 } //-- void setVAMSAS(VAMSAS)
531 * Sets the value of field 'version'. The field 'version' has
532 * the following description: Vamsas Document Version Number
534 * @param version the value of field 'version'.
536 public void setVersion(java.lang.String version)
538 this._version = version;
539 } //-- void setVersion(java.lang.String)
547 * @return VamsasDocument
549 public static org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader reader)
550 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
552 return (org.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(org.vamsas.objects.core.VamsasDocument.class, reader);
553 } //-- org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader)
559 public void validate()
560 throws org.exolab.castor.xml.ValidationException
562 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
563 validator.validate(this);
564 } //-- void validate()