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 AlignmentSequence.
20 * @version $Revision$ $Date$
22 public class AlignmentSequence extends uk.ac.vamsas.objects.core.SequenceType
23 implements java.io.Serializable
27 //--------------------------/
28 //- Class/Member Variables -/
29 //--------------------------/
32 * Primary Key for vamsas object
35 private java.lang.String _id;
38 * Dataset Sequence from which
39 * this alignment sequence is taken from
42 private java.lang.Object _refid;
45 * Field _alignmentSequenceAnnotationList.
47 private java.util.Vector _alignmentSequenceAnnotationList;
54 public AlignmentSequence() {
56 this._alignmentSequenceAnnotationList = new java.util.Vector();
67 * @param vAlignmentSequenceAnnotation
68 * @throws java.lang.IndexOutOfBoundsException if the index
69 * given is outside the bounds of the collection
71 public void addAlignmentSequenceAnnotation(
72 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
73 throws java.lang.IndexOutOfBoundsException {
74 this._alignmentSequenceAnnotationList.addElement(vAlignmentSequenceAnnotation);
81 * @param vAlignmentSequenceAnnotation
82 * @throws java.lang.IndexOutOfBoundsException if the index
83 * given is outside the bounds of the collection
85 public void addAlignmentSequenceAnnotation(
87 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
88 throws java.lang.IndexOutOfBoundsException {
89 this._alignmentSequenceAnnotationList.add(index, vAlignmentSequenceAnnotation);
93 * Method enumerateAlignmentSequenceAnnotation.
95 * @return an Enumeration over all
96 * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation element
98 public java.util.Enumeration enumerateAlignmentSequenceAnnotation(
100 return this._alignmentSequenceAnnotationList.elements();
104 * Overrides the java.lang.Object.equals method.
107 * @return true if the objects are equal.
109 public boolean equals(
110 final java.lang.Object obj) {
114 if (super.equals(obj)==false)
117 if (obj instanceof AlignmentSequence) {
119 AlignmentSequence temp = (AlignmentSequence)obj;
120 if (this._id != null) {
121 if (temp._id == null) return false;
122 else if (!(this._id.equals(temp._id)))
125 else if (temp._id != null)
127 if (this._refid != null) {
128 if (temp._refid == null) return false;
129 else if (!(this._refid.equals(temp._refid)))
132 else if (temp._refid != null)
134 if (this._alignmentSequenceAnnotationList != null) {
135 if (temp._alignmentSequenceAnnotationList == null) return false;
136 else if (!(this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList)))
139 else if (temp._alignmentSequenceAnnotationList != null)
147 * Method getAlignmentSequenceAnnotation.
150 * @throws java.lang.IndexOutOfBoundsException if the index
151 * given is outside the bounds of the collection
152 * @return the value of the
153 * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation at the
156 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(
158 throws java.lang.IndexOutOfBoundsException {
159 // check bounds for index
160 if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
161 throw new IndexOutOfBoundsException("getAlignmentSequenceAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
164 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.get(index);
168 * Method getAlignmentSequenceAnnotation.Returns the contents
169 * of the collection in an Array. <p>Note: Just in case the
170 * collection contents are changing in another thread, we pass
171 * a 0-length Array of the correct type into the API call.
172 * This way we <i>know</i> that the Array returned is of
173 * exactly the correct length.
175 * @return this collection as an Array
177 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation(
179 uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[0];
180 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[]) this._alignmentSequenceAnnotationList.toArray(array);
184 * Method getAlignmentSequenceAnnotationAsReference.Returns a
185 * reference to '_alignmentSequenceAnnotationList'. No type
186 * checking is performed on any modifications to the Vector.
188 * @return a reference to the Vector backing this class
190 public java.util.Vector getAlignmentSequenceAnnotationAsReference(
192 return this._alignmentSequenceAnnotationList;
196 * Method getAlignmentSequenceAnnotationCount.
198 * @return the size of this collection
200 public int getAlignmentSequenceAnnotationCount(
202 return this._alignmentSequenceAnnotationList.size();
206 * Returns the value of field 'id'. The field 'id' has the
207 * following description: Primary Key for vamsas object
210 * @return the value of field 'Id'.
212 public java.lang.String getId(
218 * Returns the value of field 'refid'. The field 'refid' has
219 * the following description: Dataset Sequence from which
220 * this alignment sequence is taken from
223 * @return the value of field 'Refid'.
225 public java.lang.Object getRefid(
231 * Overrides the java.lang.Object.hashCode method.
233 * The following steps came from <b>Effective Java Programming
234 * Language Guide</b> by Joshua Bloch, Chapter 3
236 * @return a hash code value for the object.
240 int result = super.hashCode();
244 result = 37 * result + _id.hashCode();
246 if (_refid != null) {
247 result = 37 * result + _refid.hashCode();
249 if (_alignmentSequenceAnnotationList != null) {
250 result = 37 * result + _alignmentSequenceAnnotationList.hashCode();
259 * @return true if this object is valid according to the schema
261 public boolean isValid(
265 } catch (org.exolab.castor.xml.ValidationException vex) {
275 * @throws org.exolab.castor.xml.MarshalException if object is
276 * null or if any SAXException is thrown during marshaling
277 * @throws org.exolab.castor.xml.ValidationException if this
278 * object is an invalid instance according to the schema
281 final java.io.Writer out)
282 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
283 Marshaller.marshal(this, out);
290 * @throws java.io.IOException if an IOException occurs during
292 * @throws org.exolab.castor.xml.ValidationException if this
293 * object is an invalid instance according to the schema
294 * @throws org.exolab.castor.xml.MarshalException if object is
295 * null or if any SAXException is thrown during marshaling
298 final org.xml.sax.ContentHandler handler)
299 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
300 Marshaller.marshal(this, handler);
304 * Method removeAlignmentSequenceAnnotation.
306 * @param vAlignmentSequenceAnnotation
307 * @return true if the object was removed from the collection.
309 public boolean removeAlignmentSequenceAnnotation(
310 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) {
311 boolean removed = _alignmentSequenceAnnotationList.remove(vAlignmentSequenceAnnotation);
316 * Method removeAlignmentSequenceAnnotationAt.
319 * @return the element removed from the collection
321 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotationAt(
323 java.lang.Object obj = this._alignmentSequenceAnnotationList.remove(index);
324 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) obj;
329 public void removeAllAlignmentSequenceAnnotation(
331 this._alignmentSequenceAnnotationList.clear();
338 * @param vAlignmentSequenceAnnotation
339 * @throws java.lang.IndexOutOfBoundsException if the index
340 * given is outside the bounds of the collection
342 public void setAlignmentSequenceAnnotation(
344 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
345 throws java.lang.IndexOutOfBoundsException {
346 // check bounds for index
347 if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
348 throw new IndexOutOfBoundsException("setAlignmentSequenceAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
351 this._alignmentSequenceAnnotationList.set(index, vAlignmentSequenceAnnotation);
357 * @param vAlignmentSequenceAnnotationArray
359 public void setAlignmentSequenceAnnotation(
360 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] vAlignmentSequenceAnnotationArray) {
362 _alignmentSequenceAnnotationList.clear();
364 for (int i = 0; i < vAlignmentSequenceAnnotationArray.length; i++) {
365 this._alignmentSequenceAnnotationList.add(vAlignmentSequenceAnnotationArray[i]);
370 * Sets the value of '_alignmentSequenceAnnotationList' by
371 * copying the given Vector. All elements will be checked for
374 * @param vAlignmentSequenceAnnotationList the Vector to copy.
376 public void setAlignmentSequenceAnnotation(
377 final java.util.Vector vAlignmentSequenceAnnotationList) {
379 this._alignmentSequenceAnnotationList.clear();
381 this._alignmentSequenceAnnotationList.addAll(vAlignmentSequenceAnnotationList);
385 * Sets the value of '_alignmentSequenceAnnotationList' by
386 * setting it to the given Vector. No type checking is
390 * @param alignmentSequenceAnnotationVector the Vector to set.
392 public void setAlignmentSequenceAnnotationAsReference(
393 final java.util.Vector alignmentSequenceAnnotationVector) {
394 this._alignmentSequenceAnnotationList = alignmentSequenceAnnotationVector;
398 * Sets the value of field 'id'. The field 'id' has the
399 * following description: Primary Key for vamsas object
402 * @param id the value of field 'id'.
405 final java.lang.String id) {
410 * Sets the value of field 'refid'. The field 'refid' has the
411 * following description: Dataset Sequence from which
412 * this alignment sequence is taken from
415 * @param refid the value of field 'refid'.
417 public void setRefid(
418 final java.lang.Object refid) {
426 * @throws org.exolab.castor.xml.MarshalException if object is
427 * null or if any SAXException is thrown during marshaling
428 * @throws org.exolab.castor.xml.ValidationException if this
429 * object is an invalid instance according to the schema
430 * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
432 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
433 final java.io.Reader reader)
434 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
435 return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentSequence.class, reader);
441 * @throws org.exolab.castor.xml.ValidationException if this
442 * object is an invalid instance according to the schema
444 public void validate(
446 throws org.exolab.castor.xml.ValidationException {
447 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
448 validator.validate(this);