2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package uk.ac.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 uk.ac.vamsas.client.Vobject
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Vamsas Document Version Number
43 private java.lang.String _version;
48 private uk.ac.vamsas.objects.core.LockFile _lockFile;
53 private Provenance _provenance;
56 * contains unassociated trees and a number of analysis sets
59 private java.util.Vector _VAMSASList;
62 * Field _applicationDataList
64 private java.util.Vector _applicationDataList;
67 * Field _attachmentList
69 private java.util.Vector _attachmentList;
76 public VamsasDocument()
79 _VAMSASList = new Vector();
80 _applicationDataList = new Vector();
81 _attachmentList = new Vector();
82 } //-- uk.ac.vamsas.objects.core.VamsasDocument()
90 * Method addApplicationData
94 * @param vApplicationData
96 public void addApplicationData(ApplicationData vApplicationData)
97 throws java.lang.IndexOutOfBoundsException
99 _applicationDataList.addElement(vApplicationData);
100 } //-- void addApplicationData(ApplicationData)
103 * Method addApplicationData
108 * @param vApplicationData
110 public void addApplicationData(int index, ApplicationData vApplicationData)
111 throws java.lang.IndexOutOfBoundsException
113 _applicationDataList.insertElementAt(vApplicationData, index);
114 } //-- void addApplicationData(int, ApplicationData)
117 * Method addAttachment
123 public void addAttachment(Attachment vAttachment)
124 throws java.lang.IndexOutOfBoundsException
126 _attachmentList.addElement(vAttachment);
127 } //-- void addAttachment(Attachment)
130 * Method addAttachment
137 public void addAttachment(int index, Attachment vAttachment)
138 throws java.lang.IndexOutOfBoundsException
140 _attachmentList.insertElementAt(vAttachment, index);
141 } //-- void addAttachment(int, Attachment)
150 public void addVAMSAS(VAMSAS vVAMSAS)
151 throws java.lang.IndexOutOfBoundsException
153 _VAMSASList.addElement(vVAMSAS);
154 } //-- void addVAMSAS(VAMSAS)
164 public void addVAMSAS(int index, VAMSAS vVAMSAS)
165 throws java.lang.IndexOutOfBoundsException
167 _VAMSASList.insertElementAt(vVAMSAS, index);
168 } //-- void addVAMSAS(int, VAMSAS)
171 * Method enumerateApplicationData
175 * @return Enumeration
177 public java.util.Enumeration enumerateApplicationData()
179 return _applicationDataList.elements();
180 } //-- java.util.Enumeration enumerateApplicationData()
183 * Method enumerateAttachment
187 * @return Enumeration
189 public java.util.Enumeration enumerateAttachment()
191 return _attachmentList.elements();
192 } //-- java.util.Enumeration enumerateAttachment()
195 * Method enumerateVAMSAS
199 * @return Enumeration
201 public java.util.Enumeration enumerateVAMSAS()
203 return _VAMSASList.elements();
204 } //-- java.util.Enumeration enumerateVAMSAS()
207 * Note: hashCode() has not been overriden
212 public boolean equals(java.lang.Object obj)
217 if (super.equals(obj)==false)
220 if (obj instanceof VamsasDocument) {
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)))
228 else if (temp._version != null)
230 if (this._lockFile != null) {
231 if (temp._lockFile == null) return false;
232 else if (!(this._lockFile.equals(temp._lockFile)))
235 else if (temp._lockFile != null)
237 if (this._provenance != null) {
238 if (temp._provenance == null) return false;
239 else if (!(this._provenance.equals(temp._provenance)))
242 else if (temp._provenance != null)
244 if (this._VAMSASList != null) {
245 if (temp._VAMSASList == null) return false;
246 else if (!(this._VAMSASList.equals(temp._VAMSASList)))
249 else if (temp._VAMSASList != null)
251 if (this._applicationDataList != null) {
252 if (temp._applicationDataList == null) return false;
253 else if (!(this._applicationDataList.equals(temp._applicationDataList)))
256 else if (temp._applicationDataList != null)
258 if (this._attachmentList != null) {
259 if (temp._attachmentList == null) return false;
260 else if (!(this._attachmentList.equals(temp._attachmentList)))
263 else if (temp._attachmentList != null)
268 } //-- boolean equals(java.lang.Object)
271 * Method getApplicationData
276 * @return ApplicationData
278 public ApplicationData getApplicationData(int index)
279 throws java.lang.IndexOutOfBoundsException
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()+ "]");
286 return (ApplicationData) _applicationDataList.elementAt(index);
287 } //-- ApplicationData getApplicationData(int)
290 * Method getApplicationData
294 * @return ApplicationData
296 public ApplicationData[] getApplicationData()
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);
304 } //-- ApplicationData[] getApplicationData()
307 * Method getApplicationDataCount
313 public int getApplicationDataCount()
315 return _applicationDataList.size();
316 } //-- int getApplicationDataCount()
319 * Method getAttachment
326 public Attachment getAttachment(int index)
327 throws java.lang.IndexOutOfBoundsException
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()+ "]");
334 return (Attachment) _attachmentList.elementAt(index);
335 } //-- Attachment getAttachment(int)
338 * Method getAttachment
344 public Attachment[] getAttachment()
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);
352 } //-- Attachment[] getAttachment()
355 * Method getAttachmentCount
361 public int getAttachmentCount()
363 return _attachmentList.size();
364 } //-- int getAttachmentCount()
367 * Returns the value of field 'lockFile'.
370 * @return the value of field 'lockFile'.
372 public uk.ac.vamsas.objects.core.LockFile getLockFile()
374 return this._lockFile;
375 } //-- uk.ac.vamsas.objects.core.LockFile getLockFile()
378 * Returns the value of field 'provenance'.
381 * @return the value of field 'provenance'.
383 public Provenance getProvenance()
385 return this._provenance;
386 } //-- Provenance getProvenance()
396 public VAMSAS getVAMSAS(int index)
397 throws java.lang.IndexOutOfBoundsException
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()+ "]");
404 return (VAMSAS) _VAMSASList.elementAt(index);
405 } //-- VAMSAS getVAMSAS(int)
414 public VAMSAS[] getVAMSAS()
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);
422 } //-- VAMSAS[] getVAMSAS()
425 * Method getVAMSASCount
431 public int getVAMSASCount()
433 return _VAMSASList.size();
434 } //-- int getVAMSASCount()
437 * Returns the value of field 'version'. The field 'version'
438 * has the following description: Vamsas Document Version
442 * @return the value of field 'version'.
444 public java.lang.String getVersion()
446 return this._version;
447 } //-- java.lang.String getVersion()
456 public boolean isValid()
461 catch (org.exolab.castor.xml.ValidationException vex) {
465 } //-- boolean isValid()
474 public void marshal(java.io.Writer out)
475 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
478 Marshaller.marshal(this, out);
479 } //-- void marshal(java.io.Writer)
488 public void marshal(org.xml.sax.ContentHandler handler)
489 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
492 Marshaller.marshal(this, handler);
493 } //-- void marshal(org.xml.sax.ContentHandler)
496 * Method removeAllApplicationData
499 public void removeAllApplicationData()
501 _applicationDataList.removeAllElements();
502 } //-- void removeAllApplicationData()
505 * Method removeAllAttachment
508 public void removeAllAttachment()
510 _attachmentList.removeAllElements();
511 } //-- void removeAllAttachment()
514 * Method removeAllVAMSAS
517 public void removeAllVAMSAS()
519 _VAMSASList.removeAllElements();
520 } //-- void removeAllVAMSAS()
523 * Method removeApplicationData
528 * @return ApplicationData
530 public ApplicationData removeApplicationData(int index)
532 java.lang.Object obj = _applicationDataList.elementAt(index);
533 _applicationDataList.removeElementAt(index);
534 return (ApplicationData) obj;
535 } //-- ApplicationData removeApplicationData(int)
538 * Method removeAttachment
545 public Attachment removeAttachment(int index)
547 java.lang.Object obj = _attachmentList.elementAt(index);
548 _attachmentList.removeElementAt(index);
549 return (Attachment) obj;
550 } //-- Attachment removeAttachment(int)
553 * Method removeVAMSAS
560 public VAMSAS removeVAMSAS(int index)
562 java.lang.Object obj = _VAMSASList.elementAt(index);
563 _VAMSASList.removeElementAt(index);
565 } //-- VAMSAS removeVAMSAS(int)
568 * Method setApplicationData
573 * @param vApplicationData
575 public void setApplicationData(int index, ApplicationData vApplicationData)
576 throws java.lang.IndexOutOfBoundsException
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()+ "]");
582 _applicationDataList.setElementAt(vApplicationData, index);
583 } //-- void setApplicationData(int, ApplicationData)
586 * Method setApplicationData
590 * @param applicationDataArray
592 public void setApplicationData(ApplicationData[] applicationDataArray)
595 _applicationDataList.removeAllElements();
596 for (int i = 0; i < applicationDataArray.length; i++) {
597 _applicationDataList.addElement(applicationDataArray[i]);
599 } //-- void setApplicationData(ApplicationData)
602 * Method setAttachment
609 public void setAttachment(int index, Attachment vAttachment)
610 throws java.lang.IndexOutOfBoundsException
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()+ "]");
616 _attachmentList.setElementAt(vAttachment, index);
617 } //-- void setAttachment(int, Attachment)
620 * Method setAttachment
624 * @param attachmentArray
626 public void setAttachment(Attachment[] attachmentArray)
629 _attachmentList.removeAllElements();
630 for (int i = 0; i < attachmentArray.length; i++) {
631 _attachmentList.addElement(attachmentArray[i]);
633 } //-- void setAttachment(Attachment)
636 * Sets the value of field 'lockFile'.
638 * @param lockFile the value of field 'lockFile'.
640 public void setLockFile(uk.ac.vamsas.objects.core.LockFile lockFile)
642 this._lockFile = lockFile;
643 } //-- void setLockFile(uk.ac.vamsas.objects.core.LockFile)
646 * Sets the value of field 'provenance'.
648 * @param provenance the value of field 'provenance'.
650 public void setProvenance(Provenance provenance)
652 this._provenance = provenance;
653 } //-- void setProvenance(Provenance)
663 public void setVAMSAS(int index, VAMSAS vVAMSAS)
664 throws java.lang.IndexOutOfBoundsException
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()+ "]");
670 _VAMSASList.setElementAt(vVAMSAS, index);
671 } //-- void setVAMSAS(int, VAMSAS)
680 public void setVAMSAS(VAMSAS[] VAMSASArray)
683 _VAMSASList.removeAllElements();
684 for (int i = 0; i < VAMSASArray.length; i++) {
685 _VAMSASList.addElement(VAMSASArray[i]);
687 } //-- void setVAMSAS(VAMSAS)
690 * Sets the value of field 'version'. The field 'version' has
691 * the following description: Vamsas Document Version Number
693 * @param version the value of field 'version'.
695 public void setVersion(java.lang.String version)
697 this._version = version;
698 } //-- void setVersion(java.lang.String)
706 * @return VamsasDocument
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
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)
718 public void validate()
719 throws org.exolab.castor.xml.ValidationException
721 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
722 validator.validate(this);
723 } //-- void validate()