2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package uk.ac.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
18 * Class VamsasDocument.
20 * @version $Revision$ $Date$
22 public class VamsasDocument extends uk.ac.vamsas.client.Vobject
23 implements java.io.Serializable
27 //--------------------------/
28 //- Class/Member Variables -/
29 //--------------------------/
32 * Vamsas Document Version Number
34 private java.lang.String _version;
39 private uk.ac.vamsas.objects.core.LockFile _lockFile;
44 private uk.ac.vamsas.objects.core.Provenance _provenance;
47 * contains unassociated trees and a number of analysis sets
50 private java.util.Vector _VAMSASList;
53 * Field _applicationDataList.
55 private java.util.Vector _applicationDataList;
58 * Field _attachmentList.
60 private java.util.Vector _attachmentList;
67 public VamsasDocument() {
69 this._VAMSASList = new java.util.Vector();
70 this._applicationDataList = new java.util.Vector();
71 this._attachmentList = new java.util.Vector();
82 * @param vApplicationData
83 * @throws java.lang.IndexOutOfBoundsException if the index
84 * given is outside the bounds of the collection
86 public void addApplicationData(
87 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
88 throws java.lang.IndexOutOfBoundsException {
89 this._applicationDataList.addElement(vApplicationData);
96 * @param vApplicationData
97 * @throws java.lang.IndexOutOfBoundsException if the index
98 * given is outside the bounds of the collection
100 public void addApplicationData(
102 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
103 throws java.lang.IndexOutOfBoundsException {
104 this._applicationDataList.add(index, vApplicationData);
111 * @throws java.lang.IndexOutOfBoundsException if the index
112 * given is outside the bounds of the collection
114 public void addAttachment(
115 final uk.ac.vamsas.objects.core.Attachment vAttachment)
116 throws java.lang.IndexOutOfBoundsException {
117 this._attachmentList.addElement(vAttachment);
125 * @throws java.lang.IndexOutOfBoundsException if the index
126 * given is outside the bounds of the collection
128 public void addAttachment(
130 final uk.ac.vamsas.objects.core.Attachment vAttachment)
131 throws java.lang.IndexOutOfBoundsException {
132 this._attachmentList.add(index, vAttachment);
139 * @throws java.lang.IndexOutOfBoundsException if the index
140 * given is outside the bounds of the collection
142 public void addVAMSAS(
143 final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
144 throws java.lang.IndexOutOfBoundsException {
145 this._VAMSASList.addElement(vVAMSAS);
153 * @throws java.lang.IndexOutOfBoundsException if the index
154 * given is outside the bounds of the collection
156 public void addVAMSAS(
158 final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
159 throws java.lang.IndexOutOfBoundsException {
160 this._VAMSASList.add(index, vVAMSAS);
164 * Method enumerateApplicationData.
166 * @return an Enumeration over all
167 * uk.ac.vamsas.objects.core.ApplicationData elements
169 public java.util.Enumeration enumerateApplicationData(
171 return this._applicationDataList.elements();
175 * Method enumerateAttachment.
177 * @return an Enumeration over all
178 * uk.ac.vamsas.objects.core.Attachment elements
180 public java.util.Enumeration enumerateAttachment(
182 return this._attachmentList.elements();
186 * Method enumerateVAMSAS.
188 * @return an Enumeration over all
189 * uk.ac.vamsas.objects.core.VAMSAS elements
191 public java.util.Enumeration enumerateVAMSAS(
193 return this._VAMSASList.elements();
197 * Overrides the java.lang.Object.equals method.
200 * @return true if the objects are equal.
202 public boolean equals(
203 final java.lang.Object obj) {
207 if (super.equals(obj)==false)
210 if (obj instanceof VamsasDocument) {
212 VamsasDocument temp = (VamsasDocument)obj;
213 if (this._version != null) {
214 if (temp._version == null) return false;
215 else if (!(this._version.equals(temp._version)))
218 else if (temp._version != null)
220 if (this._lockFile != null) {
221 if (temp._lockFile == null) return false;
222 else if (!(this._lockFile.equals(temp._lockFile)))
225 else if (temp._lockFile != null)
227 if (this._provenance != null) {
228 if (temp._provenance == null) return false;
229 else if (!(this._provenance.equals(temp._provenance)))
232 else if (temp._provenance != null)
234 if (this._VAMSASList != null) {
235 if (temp._VAMSASList == null) return false;
236 else if (!(this._VAMSASList.equals(temp._VAMSASList)))
239 else if (temp._VAMSASList != null)
241 if (this._applicationDataList != null) {
242 if (temp._applicationDataList == null) return false;
243 else if (!(this._applicationDataList.equals(temp._applicationDataList)))
246 else if (temp._applicationDataList != null)
248 if (this._attachmentList != null) {
249 if (temp._attachmentList == null) return false;
250 else if (!(this._attachmentList.equals(temp._attachmentList)))
253 else if (temp._attachmentList != null)
261 * Method getApplicationData.
264 * @throws java.lang.IndexOutOfBoundsException if the index
265 * given is outside the bounds of the collection
266 * @return the value of the
267 * uk.ac.vamsas.objects.core.ApplicationData at the given index
269 public uk.ac.vamsas.objects.core.ApplicationData getApplicationData(
271 throws java.lang.IndexOutOfBoundsException {
272 // check bounds for index
273 if (index < 0 || index >= this._applicationDataList.size()) {
274 throw new IndexOutOfBoundsException("getApplicationData: Index value '" + index + "' not in range [0.." + (this._applicationDataList.size() - 1) + "]");
277 return (uk.ac.vamsas.objects.core.ApplicationData) _applicationDataList.get(index);
281 * Method getApplicationData.Returns the contents of the
282 * collection in an Array. <p>Note: Just in case the
283 * collection contents are changing in another thread, we pass
284 * a 0-length Array of the correct type into the API call.
285 * This way we <i>know</i> that the Array returned is of
286 * exactly the correct length.
288 * @return this collection as an Array
290 public uk.ac.vamsas.objects.core.ApplicationData[] getApplicationData(
292 uk.ac.vamsas.objects.core.ApplicationData[] array = new uk.ac.vamsas.objects.core.ApplicationData[0];
293 return (uk.ac.vamsas.objects.core.ApplicationData[]) this._applicationDataList.toArray(array);
297 * Method getApplicationDataAsReference.Returns a reference to
298 * '_applicationDataList'. No type checking is performed on any
299 * modifications to the Vector.
301 * @return a reference to the Vector backing this class
303 public java.util.Vector getApplicationDataAsReference(
305 return this._applicationDataList;
309 * Method getApplicationDataCount.
311 * @return the size of this collection
313 public int getApplicationDataCount(
315 return this._applicationDataList.size();
319 * Method getAttachment.
322 * @throws java.lang.IndexOutOfBoundsException if the index
323 * given is outside the bounds of the collection
324 * @return the value of the
325 * uk.ac.vamsas.objects.core.Attachment at the given index
327 public uk.ac.vamsas.objects.core.Attachment getAttachment(
329 throws java.lang.IndexOutOfBoundsException {
330 // check bounds for index
331 if (index < 0 || index >= this._attachmentList.size()) {
332 throw new IndexOutOfBoundsException("getAttachment: Index value '" + index + "' not in range [0.." + (this._attachmentList.size() - 1) + "]");
335 return (uk.ac.vamsas.objects.core.Attachment) _attachmentList.get(index);
339 * Method getAttachment.Returns the contents of the collection
340 * in an Array. <p>Note: Just in case the collection contents
341 * are changing in another thread, we pass a 0-length Array of
342 * the correct type into the API call. This way we <i>know</i>
343 * that the Array returned is of exactly the correct length.
345 * @return this collection as an Array
347 public uk.ac.vamsas.objects.core.Attachment[] getAttachment(
349 uk.ac.vamsas.objects.core.Attachment[] array = new uk.ac.vamsas.objects.core.Attachment[0];
350 return (uk.ac.vamsas.objects.core.Attachment[]) this._attachmentList.toArray(array);
354 * Method getAttachmentAsReference.Returns a reference to
355 * '_attachmentList'. No type checking is performed on any
356 * modifications to the Vector.
358 * @return a reference to the Vector backing this class
360 public java.util.Vector getAttachmentAsReference(
362 return this._attachmentList;
366 * Method getAttachmentCount.
368 * @return the size of this collection
370 public int getAttachmentCount(
372 return this._attachmentList.size();
376 * Returns the value of field 'lockFile'.
378 * @return the value of field 'LockFile'.
380 public uk.ac.vamsas.objects.core.LockFile getLockFile(
382 return this._lockFile;
386 * Returns the value of field 'provenance'.
388 * @return the value of field 'Provenance'.
390 public uk.ac.vamsas.objects.core.Provenance getProvenance(
392 return this._provenance;
399 * @throws java.lang.IndexOutOfBoundsException if the index
400 * given is outside the bounds of the collection
401 * @return the value of the uk.ac.vamsas.objects.core.VAMSAS at
404 public uk.ac.vamsas.objects.core.VAMSAS getVAMSAS(
406 throws java.lang.IndexOutOfBoundsException {
407 // check bounds for index
408 if (index < 0 || index >= this._VAMSASList.size()) {
409 throw new IndexOutOfBoundsException("getVAMSAS: Index value '" + index + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
412 return (uk.ac.vamsas.objects.core.VAMSAS) _VAMSASList.get(index);
416 * Method getVAMSAS.Returns the contents of the collection in
417 * an Array. <p>Note: Just in case the collection contents
418 * are changing in another thread, we pass a 0-length Array of
419 * the correct type into the API call. This way we <i>know</i>
420 * that the Array returned is of exactly the correct length.
422 * @return this collection as an Array
424 public uk.ac.vamsas.objects.core.VAMSAS[] getVAMSAS(
426 uk.ac.vamsas.objects.core.VAMSAS[] array = new uk.ac.vamsas.objects.core.VAMSAS[0];
427 return (uk.ac.vamsas.objects.core.VAMSAS[]) this._VAMSASList.toArray(array);
431 * Method getVAMSASAsReference.Returns a reference to
432 * '_VAMSASList'. No type checking is performed on any
433 * modifications to the Vector.
435 * @return a reference to the Vector backing this class
437 public java.util.Vector getVAMSASAsReference(
439 return this._VAMSASList;
443 * Method getVAMSASCount.
445 * @return the size of this collection
447 public int getVAMSASCount(
449 return this._VAMSASList.size();
453 * Returns the value of field 'version'. The field 'version'
454 * has the following description: Vamsas Document Version
457 * @return the value of field 'Version'.
459 public java.lang.String getVersion(
461 return this._version;
465 * Overrides the java.lang.Object.hashCode method.
467 * The following steps came from <b>Effective Java Programming
468 * Language Guide</b> by Joshua Bloch, Chapter 3
470 * @return a hash code value for the object.
474 int result = super.hashCode();
477 if (_version != null) {
478 result = 37 * result + _version.hashCode();
480 if (_lockFile != null) {
481 result = 37 * result + _lockFile.hashCode();
483 if (_provenance != null) {
484 result = 37 * result + _provenance.hashCode();
486 if (_VAMSASList != null) {
487 result = 37 * result + _VAMSASList.hashCode();
489 if (_applicationDataList != null) {
490 result = 37 * result + _applicationDataList.hashCode();
492 if (_attachmentList != null) {
493 result = 37 * result + _attachmentList.hashCode();
502 * @return true if this object is valid according to the schema
504 public boolean isValid(
508 } catch (org.exolab.castor.xml.ValidationException vex) {
518 * @throws org.exolab.castor.xml.MarshalException if object is
519 * null or if any SAXException is thrown during marshaling
520 * @throws org.exolab.castor.xml.ValidationException if this
521 * object is an invalid instance according to the schema
524 final java.io.Writer out)
525 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
526 Marshaller.marshal(this, out);
533 * @throws java.io.IOException if an IOException occurs during
535 * @throws org.exolab.castor.xml.ValidationException if this
536 * object is an invalid instance according to the schema
537 * @throws org.exolab.castor.xml.MarshalException if object is
538 * null or if any SAXException is thrown during marshaling
541 final org.xml.sax.ContentHandler handler)
542 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
543 Marshaller.marshal(this, handler);
548 public void removeAllApplicationData(
550 this._applicationDataList.clear();
555 public void removeAllAttachment(
557 this._attachmentList.clear();
562 public void removeAllVAMSAS(
564 this._VAMSASList.clear();
568 * Method removeApplicationData.
570 * @param vApplicationData
571 * @return true if the object was removed from the collection.
573 public boolean removeApplicationData(
574 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData) {
575 boolean removed = _applicationDataList.remove(vApplicationData);
580 * Method removeApplicationDataAt.
583 * @return the element removed from the collection
585 public uk.ac.vamsas.objects.core.ApplicationData removeApplicationDataAt(
587 java.lang.Object obj = this._applicationDataList.remove(index);
588 return (uk.ac.vamsas.objects.core.ApplicationData) obj;
592 * Method removeAttachment.
595 * @return true if the object was removed from the collection.
597 public boolean removeAttachment(
598 final uk.ac.vamsas.objects.core.Attachment vAttachment) {
599 boolean removed = _attachmentList.remove(vAttachment);
604 * Method removeAttachmentAt.
607 * @return the element removed from the collection
609 public uk.ac.vamsas.objects.core.Attachment removeAttachmentAt(
611 java.lang.Object obj = this._attachmentList.remove(index);
612 return (uk.ac.vamsas.objects.core.Attachment) obj;
616 * Method removeVAMSAS.
619 * @return true if the object was removed from the collection.
621 public boolean removeVAMSAS(
622 final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS) {
623 boolean removed = _VAMSASList.remove(vVAMSAS);
628 * Method removeVAMSASAt.
631 * @return the element removed from the collection
633 public uk.ac.vamsas.objects.core.VAMSAS removeVAMSASAt(
635 java.lang.Object obj = this._VAMSASList.remove(index);
636 return (uk.ac.vamsas.objects.core.VAMSAS) obj;
643 * @param vApplicationData
644 * @throws java.lang.IndexOutOfBoundsException if the index
645 * given is outside the bounds of the collection
647 public void setApplicationData(
649 final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
650 throws java.lang.IndexOutOfBoundsException {
651 // check bounds for index
652 if (index < 0 || index >= this._applicationDataList.size()) {
653 throw new IndexOutOfBoundsException("setApplicationData: Index value '" + index + "' not in range [0.." + (this._applicationDataList.size() - 1) + "]");
656 this._applicationDataList.set(index, vApplicationData);
662 * @param vApplicationDataArray
664 public void setApplicationData(
665 final uk.ac.vamsas.objects.core.ApplicationData[] vApplicationDataArray) {
667 _applicationDataList.clear();
669 for (int i = 0; i < vApplicationDataArray.length; i++) {
670 this._applicationDataList.add(vApplicationDataArray[i]);
675 * Sets the value of '_applicationDataList' by copying the
676 * given Vector. All elements will be checked for type safety.
678 * @param vApplicationDataList the Vector to copy.
680 public void setApplicationData(
681 final java.util.Vector vApplicationDataList) {
683 this._applicationDataList.clear();
685 this._applicationDataList.addAll(vApplicationDataList);
689 * Sets the value of '_applicationDataList' by setting it to
690 * the given Vector. No type checking is performed.
693 * @param applicationDataVector the Vector to set.
695 public void setApplicationDataAsReference(
696 final java.util.Vector applicationDataVector) {
697 this._applicationDataList = applicationDataVector;
705 * @throws java.lang.IndexOutOfBoundsException if the index
706 * given is outside the bounds of the collection
708 public void setAttachment(
710 final uk.ac.vamsas.objects.core.Attachment vAttachment)
711 throws java.lang.IndexOutOfBoundsException {
712 // check bounds for index
713 if (index < 0 || index >= this._attachmentList.size()) {
714 throw new IndexOutOfBoundsException("setAttachment: Index value '" + index + "' not in range [0.." + (this._attachmentList.size() - 1) + "]");
717 this._attachmentList.set(index, vAttachment);
723 * @param vAttachmentArray
725 public void setAttachment(
726 final uk.ac.vamsas.objects.core.Attachment[] vAttachmentArray) {
728 _attachmentList.clear();
730 for (int i = 0; i < vAttachmentArray.length; i++) {
731 this._attachmentList.add(vAttachmentArray[i]);
736 * Sets the value of '_attachmentList' by copying the given
737 * Vector. All elements will be checked for type safety.
739 * @param vAttachmentList the Vector to copy.
741 public void setAttachment(
742 final java.util.Vector vAttachmentList) {
744 this._attachmentList.clear();
746 this._attachmentList.addAll(vAttachmentList);
750 * Sets the value of '_attachmentList' by setting it to the
751 * given Vector. No type checking is performed.
754 * @param attachmentVector the Vector to set.
756 public void setAttachmentAsReference(
757 final java.util.Vector attachmentVector) {
758 this._attachmentList = attachmentVector;
762 * Sets the value of field 'lockFile'.
764 * @param lockFile the value of field 'lockFile'.
766 public void setLockFile(
767 final uk.ac.vamsas.objects.core.LockFile lockFile) {
768 this._lockFile = lockFile;
772 * Sets the value of field 'provenance'.
774 * @param provenance the value of field 'provenance'.
776 public void setProvenance(
777 final uk.ac.vamsas.objects.core.Provenance provenance) {
778 this._provenance = provenance;
786 * @throws java.lang.IndexOutOfBoundsException if the index
787 * given is outside the bounds of the collection
789 public void setVAMSAS(
791 final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
792 throws java.lang.IndexOutOfBoundsException {
793 // check bounds for index
794 if (index < 0 || index >= this._VAMSASList.size()) {
795 throw new IndexOutOfBoundsException("setVAMSAS: Index value '" + index + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
798 this._VAMSASList.set(index, vVAMSAS);
804 * @param vVAMSASArray
806 public void setVAMSAS(
807 final uk.ac.vamsas.objects.core.VAMSAS[] vVAMSASArray) {
811 for (int i = 0; i < vVAMSASArray.length; i++) {
812 this._VAMSASList.add(vVAMSASArray[i]);
817 * Sets the value of '_VAMSASList' by copying the given Vector.
818 * All elements will be checked for type safety.
820 * @param vVAMSASList the Vector to copy.
822 public void setVAMSAS(
823 final java.util.Vector vVAMSASList) {
825 this._VAMSASList.clear();
827 this._VAMSASList.addAll(vVAMSASList);
831 * Sets the value of '_VAMSASList' by setting it to the given
832 * Vector. No type checking is performed.
835 * @param VAMSASVector the Vector to set.
837 public void setVAMSASAsReference(
838 final java.util.Vector VAMSASVector) {
839 this._VAMSASList = VAMSASVector;
843 * Sets the value of field 'version'. The field 'version' has
844 * the following description: Vamsas Document Version Number
846 * @param version the value of field 'version'.
848 public void setVersion(
849 final java.lang.String version) {
850 this._version = version;
857 * @throws org.exolab.castor.xml.MarshalException if object is
858 * null or if any SAXException is thrown during marshaling
859 * @throws org.exolab.castor.xml.ValidationException if this
860 * object is an invalid instance according to the schema
861 * @return the unmarshaled
862 * uk.ac.vamsas.objects.core.VamsasDocument
864 public static uk.ac.vamsas.objects.core.VamsasDocument unmarshal(
865 final java.io.Reader reader)
866 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
867 return (uk.ac.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VamsasDocument.class, reader);
873 * @throws org.exolab.castor.xml.ValidationException if this
874 * object is an invalid instance according to the schema
876 public void validate(
878 throws org.exolab.castor.xml.ValidationException {
879 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
880 validator.validate(this);