/* * This class was automatically generated with * Castor 0.9.9M2, using an XML * Schema. * $Id$ */ package org.vamsas.objects.core; //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ import java.io.IOException; import java.io.Reader; import java.io.Serializable; import java.io.Writer; import java.util.Enumeration; import java.util.Vector; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** * Class VamsasDocument. * * @version $Revision$ $Date$ */ public class VamsasDocument extends org.vamsas.client.Vobject implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Vamsas Document Version Number */ private java.lang.String _version; /** * Field _lockFile */ private org.vamsas.objects.core.LockFile _lockFile; /** * Field _provenance */ private Provenance _provenance; /** * Field _VAMSASList */ private java.util.Vector _VAMSASList; /** * Field _applicationDataList */ private java.util.Vector _applicationDataList; //----------------/ //- Constructors -/ //----------------/ public VamsasDocument() { super(); _VAMSASList = new Vector(); _applicationDataList = new Vector(); } //-- org.vamsas.objects.core.VamsasDocument() //-----------/ //- Methods -/ //-----------/ /** * Method addApplicationData * * * * @param vApplicationData */ public void addApplicationData(ApplicationData vApplicationData) throws java.lang.IndexOutOfBoundsException { _applicationDataList.addElement(vApplicationData); } //-- void addApplicationData(ApplicationData) /** * Method addApplicationData * * * * @param index * @param vApplicationData */ public void addApplicationData(int index, ApplicationData vApplicationData) throws java.lang.IndexOutOfBoundsException { _applicationDataList.insertElementAt(vApplicationData, index); } //-- void addApplicationData(int, ApplicationData) /** * Method addVAMSAS * * * * @param vVAMSAS */ public void addVAMSAS(VAMSAS vVAMSAS) throws java.lang.IndexOutOfBoundsException { _VAMSASList.addElement(vVAMSAS); } //-- void addVAMSAS(VAMSAS) /** * Method addVAMSAS * * * * @param index * @param vVAMSAS */ public void addVAMSAS(int index, VAMSAS vVAMSAS) throws java.lang.IndexOutOfBoundsException { _VAMSASList.insertElementAt(vVAMSAS, index); } //-- void addVAMSAS(int, VAMSAS) /** * Method enumerateApplicationData * * * * @return Enumeration */ public java.util.Enumeration enumerateApplicationData() { return _applicationDataList.elements(); } //-- java.util.Enumeration enumerateApplicationData() /** * Method enumerateVAMSAS * * * * @return Enumeration */ public java.util.Enumeration enumerateVAMSAS() { return _VAMSASList.elements(); } //-- java.util.Enumeration enumerateVAMSAS() /** * Note: hashCode() has not been overriden * * @param obj * @return boolean */ public boolean equals(java.lang.Object obj) { if ( this == obj ) return true; if (super.equals(obj)==false) return false; if (obj instanceof VamsasDocument) { VamsasDocument temp = (VamsasDocument)obj; if (this._version != null) { if (temp._version == null) return false; else if (!(this._version.equals(temp._version))) return false; } else if (temp._version != null) return false; if (this._lockFile != null) { if (temp._lockFile == null) return false; else if (!(this._lockFile.equals(temp._lockFile))) return false; } else if (temp._lockFile != null) return false; if (this._provenance != null) { if (temp._provenance == null) return false; else if (!(this._provenance.equals(temp._provenance))) return false; } else if (temp._provenance != null) return false; if (this._VAMSASList != null) { if (temp._VAMSASList == null) return false; else if (!(this._VAMSASList.equals(temp._VAMSASList))) return false; } else if (temp._VAMSASList != null) return false; if (this._applicationDataList != null) { if (temp._applicationDataList == null) return false; else if (!(this._applicationDataList.equals(temp._applicationDataList))) return false; } else if (temp._applicationDataList != null) return false; return true; } return false; } //-- boolean equals(java.lang.Object) /** * Method getApplicationData * * * * @param index * @return ApplicationData */ public ApplicationData getApplicationData(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _applicationDataList.size())) { throw new IndexOutOfBoundsException("getApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]"); } return (ApplicationData) _applicationDataList.elementAt(index); } //-- ApplicationData getApplicationData(int) /** * Method getApplicationData * * * * @return ApplicationData */ public ApplicationData[] getApplicationData() { int size = _applicationDataList.size(); ApplicationData[] mArray = new ApplicationData[size]; for (int index = 0; index < size; index++) { mArray[index] = (ApplicationData) _applicationDataList.elementAt(index); } return mArray; } //-- ApplicationData[] getApplicationData() /** * Method getApplicationDataCount * * * * @return int */ public int getApplicationDataCount() { return _applicationDataList.size(); } //-- int getApplicationDataCount() /** * Returns the value of field 'lockFile'. * * @return LockFile * @return the value of field 'lockFile'. */ public org.vamsas.objects.core.LockFile getLockFile() { return this._lockFile; } //-- org.vamsas.objects.core.LockFile getLockFile() /** * Returns the value of field 'provenance'. * * @return Provenance * @return the value of field 'provenance'. */ public Provenance getProvenance() { return this._provenance; } //-- Provenance getProvenance() /** * Method getVAMSAS * * * * @param index * @return VAMSAS */ public VAMSAS getVAMSAS(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _VAMSASList.size())) { throw new IndexOutOfBoundsException("getVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]"); } return (VAMSAS) _VAMSASList.elementAt(index); } //-- VAMSAS getVAMSAS(int) /** * Method getVAMSAS * * * * @return VAMSAS */ public VAMSAS[] getVAMSAS() { int size = _VAMSASList.size(); VAMSAS[] mArray = new VAMSAS[size]; for (int index = 0; index < size; index++) { mArray[index] = (VAMSAS) _VAMSASList.elementAt(index); } return mArray; } //-- VAMSAS[] getVAMSAS() /** * Method getVAMSASCount * * * * @return int */ public int getVAMSASCount() { return _VAMSASList.size(); } //-- int getVAMSASCount() /** * Returns the value of field 'version'. The field 'version' * has the following description: Vamsas Document Version * Number * * @return String * @return the value of field 'version'. */ public java.lang.String getVersion() { return this._version; } //-- java.lang.String getVersion() /** * Method isValid * * * * @return boolean */ public boolean isValid() { try { validate(); } catch (org.exolab.castor.xml.ValidationException vex) { return false; } return true; } //-- boolean isValid() /** * Method marshal * * * * @param out */ public void marshal(java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, out); } //-- void marshal(java.io.Writer) /** * Method marshal * * * * @param handler */ public void marshal(org.xml.sax.ContentHandler handler) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, handler); } //-- void marshal(org.xml.sax.ContentHandler) /** * Method removeAllApplicationData * */ public void removeAllApplicationData() { _applicationDataList.removeAllElements(); } //-- void removeAllApplicationData() /** * Method removeAllVAMSAS * */ public void removeAllVAMSAS() { _VAMSASList.removeAllElements(); } //-- void removeAllVAMSAS() /** * Method removeApplicationData * * * * @param index * @return ApplicationData */ public ApplicationData removeApplicationData(int index) { java.lang.Object obj = _applicationDataList.elementAt(index); _applicationDataList.removeElementAt(index); return (ApplicationData) obj; } //-- ApplicationData removeApplicationData(int) /** * Method removeVAMSAS * * * * @param index * @return VAMSAS */ public VAMSAS removeVAMSAS(int index) { java.lang.Object obj = _VAMSASList.elementAt(index); _VAMSASList.removeElementAt(index); return (VAMSAS) obj; } //-- VAMSAS removeVAMSAS(int) /** * Method setApplicationData * * * * @param index * @param vApplicationData */ public void setApplicationData(int index, ApplicationData vApplicationData) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _applicationDataList.size())) { throw new IndexOutOfBoundsException("setApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]"); } _applicationDataList.setElementAt(vApplicationData, index); } //-- void setApplicationData(int, ApplicationData) /** * Method setApplicationData * * * * @param applicationDataArray */ public void setApplicationData(ApplicationData[] applicationDataArray) { //-- copy array _applicationDataList.removeAllElements(); for (int i = 0; i < applicationDataArray.length; i++) { _applicationDataList.addElement(applicationDataArray[i]); } } //-- void setApplicationData(ApplicationData) /** * Sets the value of field 'lockFile'. * * @param lockFile the value of field 'lockFile'. */ public void setLockFile(org.vamsas.objects.core.LockFile lockFile) { this._lockFile = lockFile; } //-- void setLockFile(org.vamsas.objects.core.LockFile) /** * Sets the value of field 'provenance'. * * @param provenance the value of field 'provenance'. */ public void setProvenance(Provenance provenance) { this._provenance = provenance; } //-- void setProvenance(Provenance) /** * Method setVAMSAS * * * * @param index * @param vVAMSAS */ public void setVAMSAS(int index, VAMSAS vVAMSAS) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _VAMSASList.size())) { throw new IndexOutOfBoundsException("setVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]"); } _VAMSASList.setElementAt(vVAMSAS, index); } //-- void setVAMSAS(int, VAMSAS) /** * Method setVAMSAS * * * * @param VAMSASArray */ public void setVAMSAS(VAMSAS[] VAMSASArray) { //-- copy array _VAMSASList.removeAllElements(); for (int i = 0; i < VAMSASArray.length; i++) { _VAMSASList.addElement(VAMSASArray[i]); } } //-- void setVAMSAS(VAMSAS) /** * Sets the value of field 'version'. The field 'version' has * the following description: Vamsas Document Version Number * * @param version the value of field 'version'. */ public void setVersion(java.lang.String version) { this._version = version; } //-- void setVersion(java.lang.String) /** * Method unmarshal * * * * @param reader * @return VamsasDocument */ public static org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(org.vamsas.objects.core.VamsasDocument.class, reader); } //-- org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader) /** * Method validate * */ public void validate() throws org.exolab.castor.xml.ValidationException { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); } //-- void validate() }