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;
122 if (this._id != null) {
123 if (temp._id == null) return false;
124 if (this._id != temp._id) {
125 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
126 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
127 if (thcycle!=tmcycle) {
128 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
129 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
133 if (!this._id.equals(temp._id)) {
134 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
135 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
138 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
139 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
142 } else if (temp._id != null)
144 if (this._refid != null) {
145 if (temp._refid == null) return false;
146 if (this._refid != temp._refid) {
147 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._refid);
148 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._refid);
149 if (thcycle!=tmcycle) {
150 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._refid); };
151 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid); };
155 if (!this._refid.equals(temp._refid)) {
156 org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
157 org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
160 org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
161 org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
164 } else if (temp._refid != null)
166 if (this._alignmentSequenceAnnotationList != null) {
167 if (temp._alignmentSequenceAnnotationList == null) return false;
168 if (this._alignmentSequenceAnnotationList != temp._alignmentSequenceAnnotationList) {
169 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._alignmentSequenceAnnotationList);
170 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._alignmentSequenceAnnotationList);
171 if (thcycle!=tmcycle) {
172 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceAnnotationList); };
173 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceAnnotationList); };
177 if (!this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList)) {
178 org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceAnnotationList);
179 org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceAnnotationList);
182 org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceAnnotationList);
183 org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceAnnotationList);
186 } else if (temp._alignmentSequenceAnnotationList != null)
194 * Method getAlignmentSequenceAnnotation.
197 * @throws java.lang.IndexOutOfBoundsException if the index
198 * given is outside the bounds of the collection
199 * @return the value of the
200 * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation at the
203 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(
205 throws java.lang.IndexOutOfBoundsException {
206 // check bounds for index
207 if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
208 throw new IndexOutOfBoundsException("getAlignmentSequenceAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
211 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.get(index);
215 * Method getAlignmentSequenceAnnotation.Returns the contents
216 * of the collection in an Array. <p>Note: Just in case the
217 * collection contents are changing in another thread, we pass
218 * a 0-length Array of the correct type into the API call.
219 * This way we <i>know</i> that the Array returned is of
220 * exactly the correct length.
222 * @return this collection as an Array
224 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation(
226 uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[0];
227 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[]) this._alignmentSequenceAnnotationList.toArray(array);
231 * Method getAlignmentSequenceAnnotationAsReference.Returns a
232 * reference to '_alignmentSequenceAnnotationList'. No type
233 * checking is performed on any modifications to the Vector.
235 * @return a reference to the Vector backing this class
237 public java.util.Vector getAlignmentSequenceAnnotationAsReference(
239 return this._alignmentSequenceAnnotationList;
243 * Method getAlignmentSequenceAnnotationCount.
245 * @return the size of this collection
247 public int getAlignmentSequenceAnnotationCount(
249 return this._alignmentSequenceAnnotationList.size();
253 * Returns the value of field 'id'. The field 'id' has the
254 * following description: Primary Key for vamsas object
257 * @return the value of field 'Id'.
259 public java.lang.String getId(
265 * Returns the value of field 'refid'. The field 'refid' has
266 * the following description: Dataset Sequence from which
267 * this alignment sequence is taken from
270 * @return the value of field 'Refid'.
272 public java.lang.Object getRefid(
278 * Overrides the java.lang.Object.hashCode method.
280 * The following steps came from <b>Effective Java Programming
281 * Language Guide</b> by Joshua Bloch, Chapter 3
283 * @return a hash code value for the object.
287 int result = super.hashCode();
291 && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
292 result = 37 * result + _id.hashCode();
293 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
296 && !org.castor.util.CycleBreaker.startingToCycle(_refid)) {
297 result = 37 * result + _refid.hashCode();
298 org.castor.util.CycleBreaker.releaseCycleHandle(_refid);
300 if (_alignmentSequenceAnnotationList != null
301 && !org.castor.util.CycleBreaker.startingToCycle(_alignmentSequenceAnnotationList)) {
302 result = 37 * result + _alignmentSequenceAnnotationList.hashCode();
303 org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentSequenceAnnotationList);
312 * @return true if this object is valid according to the schema
314 public boolean isValid(
318 } catch (org.exolab.castor.xml.ValidationException vex) {
328 * @throws org.exolab.castor.xml.MarshalException if object is
329 * null or if any SAXException is thrown during marshaling
330 * @throws org.exolab.castor.xml.ValidationException if this
331 * object is an invalid instance according to the schema
334 final java.io.Writer out)
335 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
336 Marshaller.marshal(this, out);
343 * @throws java.io.IOException if an IOException occurs during
345 * @throws org.exolab.castor.xml.ValidationException if this
346 * object is an invalid instance according to the schema
347 * @throws org.exolab.castor.xml.MarshalException if object is
348 * null or if any SAXException is thrown during marshaling
351 final org.xml.sax.ContentHandler handler)
352 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
353 Marshaller.marshal(this, handler);
357 * Method removeAlignmentSequenceAnnotation.
359 * @param vAlignmentSequenceAnnotation
360 * @return true if the object was removed from the collection.
362 public boolean removeAlignmentSequenceAnnotation(
363 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) {
364 boolean removed = _alignmentSequenceAnnotationList.remove(vAlignmentSequenceAnnotation);
369 * Method removeAlignmentSequenceAnnotationAt.
372 * @return the element removed from the collection
374 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotationAt(
376 java.lang.Object obj = this._alignmentSequenceAnnotationList.remove(index);
377 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) obj;
382 public void removeAllAlignmentSequenceAnnotation(
384 this._alignmentSequenceAnnotationList.clear();
391 * @param vAlignmentSequenceAnnotation
392 * @throws java.lang.IndexOutOfBoundsException if the index
393 * given is outside the bounds of the collection
395 public void setAlignmentSequenceAnnotation(
397 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
398 throws java.lang.IndexOutOfBoundsException {
399 // check bounds for index
400 if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
401 throw new IndexOutOfBoundsException("setAlignmentSequenceAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
404 this._alignmentSequenceAnnotationList.set(index, vAlignmentSequenceAnnotation);
410 * @param vAlignmentSequenceAnnotationArray
412 public void setAlignmentSequenceAnnotation(
413 final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] vAlignmentSequenceAnnotationArray) {
415 _alignmentSequenceAnnotationList.clear();
417 for (int i = 0; i < vAlignmentSequenceAnnotationArray.length; i++) {
418 this._alignmentSequenceAnnotationList.add(vAlignmentSequenceAnnotationArray[i]);
423 * Sets the value of '_alignmentSequenceAnnotationList' by
424 * copying the given Vector. All elements will be checked for
427 * @param vAlignmentSequenceAnnotationList the Vector to copy.
429 public void setAlignmentSequenceAnnotation(
430 final java.util.Vector vAlignmentSequenceAnnotationList) {
432 this._alignmentSequenceAnnotationList.clear();
434 this._alignmentSequenceAnnotationList.addAll(vAlignmentSequenceAnnotationList);
438 * Sets the value of '_alignmentSequenceAnnotationList' by
439 * setting it to the given Vector. No type checking is
443 * @param alignmentSequenceAnnotationVector the Vector to set.
445 public void setAlignmentSequenceAnnotationAsReference(
446 final java.util.Vector alignmentSequenceAnnotationVector) {
447 this._alignmentSequenceAnnotationList = alignmentSequenceAnnotationVector;
451 * Sets the value of field 'id'. The field 'id' has the
452 * following description: Primary Key for vamsas object
455 * @param id the value of field 'id'.
458 final java.lang.String id) {
463 * Sets the value of field 'refid'. The field 'refid' has the
464 * following description: Dataset Sequence from which
465 * this alignment sequence is taken from
468 * @param refid the value of field 'refid'.
470 public void setRefid(
471 final java.lang.Object refid) {
479 * @throws org.exolab.castor.xml.MarshalException if object is
480 * null or if any SAXException is thrown during marshaling
481 * @throws org.exolab.castor.xml.ValidationException if this
482 * object is an invalid instance according to the schema
483 * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
485 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
486 final java.io.Reader reader)
487 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
488 return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentSequence.class, reader);
494 * @throws org.exolab.castor.xml.ValidationException if this
495 * object is an invalid instance according to the schema
497 public void validate(
499 throws org.exolab.castor.xml.ValidationException {
500 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
501 validator.validate(this);