2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
\r
8 package uk.ac.vamsas.objects.core;
\r
10 //---------------------------------/
\r
11 //- Imported classes and packages -/
\r
12 //---------------------------------/
\r
14 import org.exolab.castor.xml.Marshaller;
\r
15 import org.exolab.castor.xml.Unmarshaller;
\r
18 * Class SequenceMapping.
\r
20 * @version $Revision$ $Date$
\r
22 public class SequenceMapping extends uk.ac.vamsas.client.Vobject
\r
23 implements java.io.Serializable
\r
27 //--------------------------/
\r
28 //- Class/Member Variables -/
\r
29 //--------------------------/
\r
34 private java.lang.Object _sequenceA;
\r
39 private java.lang.Object _sequenceB;
\r
44 private java.lang.String _id;
\r
49 private java.util.Vector _rangeList;
\r
52 * Field _provenance.
\r
54 private uk.ac.vamsas.objects.core.Provenance _provenance;
\r
61 public SequenceMapping() {
\r
63 this._rangeList = new java.util.Vector();
\r
75 * @throws java.lang.IndexOutOfBoundsException if the index
\r
76 * given is outside the bounds of the collection
\r
78 public void addRange(
\r
79 final uk.ac.vamsas.objects.core.Range vRange)
\r
80 throws java.lang.IndexOutOfBoundsException {
\r
81 this._rangeList.addElement(vRange);
\r
89 * @throws java.lang.IndexOutOfBoundsException if the index
\r
90 * given is outside the bounds of the collection
\r
92 public void addRange(
\r
94 final uk.ac.vamsas.objects.core.Range vRange)
\r
95 throws java.lang.IndexOutOfBoundsException {
\r
96 this._rangeList.add(index, vRange);
\r
100 * Method enumerateRange.
\r
102 * @return an Enumeration over all
\r
103 * uk.ac.vamsas.objects.core.Range elements
\r
105 public java.util.Enumeration enumerateRange(
\r
107 return this._rangeList.elements();
\r
111 * Overrides the java.lang.Object.equals method.
\r
114 * @return true if the objects are equal.
\r
116 public boolean equals(
\r
117 final java.lang.Object obj) {
\r
121 if (super.equals(obj)==false)
\r
124 if (obj instanceof SequenceMapping) {
\r
126 SequenceMapping temp = (SequenceMapping)obj;
\r
127 if (this._sequenceA != null) {
\r
128 if (temp._sequenceA == null) return false;
\r
129 else if (!(this._sequenceA.equals(temp._sequenceA)))
\r
132 else if (temp._sequenceA != null)
\r
134 if (this._sequenceB != null) {
\r
135 if (temp._sequenceB == null) return false;
\r
136 else if (!(this._sequenceB.equals(temp._sequenceB)))
\r
139 else if (temp._sequenceB != null)
\r
141 if (this._id != null) {
\r
142 if (temp._id == null) return false;
\r
143 else if (!(this._id.equals(temp._id)))
\r
146 else if (temp._id != null)
\r
148 if (this._rangeList != null) {
\r
149 if (temp._rangeList == null) return false;
\r
150 else if (!(this._rangeList.equals(temp._rangeList)))
\r
153 else if (temp._rangeList != null)
\r
155 if (this._provenance != null) {
\r
156 if (temp._provenance == null) return false;
\r
157 else if (!(this._provenance.equals(temp._provenance)))
\r
160 else if (temp._provenance != null)
\r
168 * Returns the value of field 'id'.
\r
170 * @return the value of field 'Id'.
\r
172 public java.lang.String getId(
\r
178 * Returns the value of field 'provenance'.
\r
180 * @return the value of field 'Provenance'.
\r
182 public uk.ac.vamsas.objects.core.Provenance getProvenance(
\r
184 return this._provenance;
\r
191 * @throws java.lang.IndexOutOfBoundsException if the index
\r
192 * given is outside the bounds of the collection
\r
193 * @return the value of the uk.ac.vamsas.objects.core.Range at
\r
196 public uk.ac.vamsas.objects.core.Range getRange(
\r
198 throws java.lang.IndexOutOfBoundsException {
\r
199 // check bounds for index
\r
200 if (index < 0 || index >= this._rangeList.size()) {
\r
201 throw new IndexOutOfBoundsException("getRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]");
\r
204 return (uk.ac.vamsas.objects.core.Range) _rangeList.get(index);
\r
208 * Method getRange.Returns the contents of the collection in an
\r
209 * Array. <p>Note: Just in case the collection contents are
\r
210 * changing in another thread, we pass a 0-length Array of the
\r
211 * correct type into the API call. This way we <i>know</i>
\r
212 * that the Array returned is of exactly the correct length.
\r
214 * @return this collection as an Array
\r
216 public uk.ac.vamsas.objects.core.Range[] getRange(
\r
218 uk.ac.vamsas.objects.core.Range[] array = new uk.ac.vamsas.objects.core.Range[0];
\r
219 return (uk.ac.vamsas.objects.core.Range[]) this._rangeList.toArray(array);
\r
223 * Method getRangeAsReference.Returns a reference to
\r
224 * '_rangeList'. No type checking is performed on any
\r
225 * modifications to the Vector.
\r
227 * @return a reference to the Vector backing this class
\r
229 public java.util.Vector getRangeAsReference(
\r
231 return this._rangeList;
\r
235 * Method getRangeCount.
\r
237 * @return the size of this collection
\r
239 public int getRangeCount(
\r
241 return this._rangeList.size();
\r
245 * Returns the value of field 'sequenceA'.
\r
247 * @return the value of field 'SequenceA'.
\r
249 public java.lang.Object getSequenceA(
\r
251 return this._sequenceA;
\r
255 * Returns the value of field 'sequenceB'.
\r
257 * @return the value of field 'SequenceB'.
\r
259 public java.lang.Object getSequenceB(
\r
261 return this._sequenceB;
\r
265 * Overrides the java.lang.Object.hashCode method.
\r
267 * The following steps came from <b>Effective Java Programming
\r
268 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
270 * @return a hash code value for the object.
\r
272 public int hashCode(
\r
274 int result = super.hashCode();
\r
277 if (_sequenceA != null) {
\r
278 result = 37 * result + _sequenceA.hashCode();
\r
280 if (_sequenceB != null) {
\r
281 result = 37 * result + _sequenceB.hashCode();
\r
284 result = 37 * result + _id.hashCode();
\r
286 if (_rangeList != null) {
\r
287 result = 37 * result + _rangeList.hashCode();
\r
289 if (_provenance != null) {
\r
290 result = 37 * result + _provenance.hashCode();
\r
299 * @return true if this object is valid according to the schema
\r
301 public boolean isValid(
\r
305 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
315 * @throws org.exolab.castor.xml.MarshalException if object is
\r
316 * null or if any SAXException is thrown during marshaling
\r
317 * @throws org.exolab.castor.xml.ValidationException if this
\r
318 * object is an invalid instance according to the schema
\r
320 public void marshal(
\r
321 final java.io.Writer out)
\r
322 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
323 Marshaller.marshal(this, out);
\r
330 * @throws java.io.IOException if an IOException occurs during
\r
332 * @throws org.exolab.castor.xml.ValidationException if this
\r
333 * object is an invalid instance according to the schema
\r
334 * @throws org.exolab.castor.xml.MarshalException if object is
\r
335 * null or if any SAXException is thrown during marshaling
\r
337 public void marshal(
\r
338 final org.xml.sax.ContentHandler handler)
\r
339 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
340 Marshaller.marshal(this, handler);
\r
345 public void removeAllRange(
\r
347 this._rangeList.clear();
\r
351 * Method removeRange.
\r
354 * @return true if the object was removed from the collection.
\r
356 public boolean removeRange(
\r
357 final uk.ac.vamsas.objects.core.Range vRange) {
\r
358 boolean removed = _rangeList.remove(vRange);
\r
363 * Method removeRangeAt.
\r
366 * @return the element removed from the collection
\r
368 public uk.ac.vamsas.objects.core.Range removeRangeAt(
\r
370 java.lang.Object obj = this._rangeList.remove(index);
\r
371 return (uk.ac.vamsas.objects.core.Range) obj;
\r
375 * Sets the value of field 'id'.
\r
377 * @param id the value of field 'id'.
\r
380 final java.lang.String id) {
\r
385 * Sets the value of field 'provenance'.
\r
387 * @param provenance the value of field 'provenance'.
\r
389 public void setProvenance(
\r
390 final uk.ac.vamsas.objects.core.Provenance provenance) {
\r
391 this._provenance = provenance;
\r
399 * @throws java.lang.IndexOutOfBoundsException if the index
\r
400 * given is outside the bounds of the collection
\r
402 public void setRange(
\r
404 final uk.ac.vamsas.objects.core.Range vRange)
\r
405 throws java.lang.IndexOutOfBoundsException {
\r
406 // check bounds for index
\r
407 if (index < 0 || index >= this._rangeList.size()) {
\r
408 throw new IndexOutOfBoundsException("setRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]");
\r
411 this._rangeList.set(index, vRange);
\r
417 * @param vRangeArray
\r
419 public void setRange(
\r
420 final uk.ac.vamsas.objects.core.Range[] vRangeArray) {
\r
422 _rangeList.clear();
\r
424 for (int i = 0; i < vRangeArray.length; i++) {
\r
425 this._rangeList.add(vRangeArray[i]);
\r
430 * Sets the value of '_rangeList' by copying the given Vector.
\r
431 * All elements will be checked for type safety.
\r
433 * @param vRangeList the Vector to copy.
\r
435 public void setRange(
\r
436 final java.util.Vector vRangeList) {
\r
438 this._rangeList.clear();
\r
440 this._rangeList.addAll(vRangeList);
\r
444 * Sets the value of '_rangeList' by setting it to the given
\r
445 * Vector. No type checking is performed.
\r
448 * @param rangeVector the Vector to set.
\r
450 public void setRangeAsReference(
\r
451 final java.util.Vector rangeVector) {
\r
452 this._rangeList = rangeVector;
\r
456 * Sets the value of field 'sequenceA'.
\r
458 * @param sequenceA the value of field 'sequenceA'.
\r
460 public void setSequenceA(
\r
461 final java.lang.Object sequenceA) {
\r
462 this._sequenceA = sequenceA;
\r
466 * Sets the value of field 'sequenceB'.
\r
468 * @param sequenceB the value of field 'sequenceB'.
\r
470 public void setSequenceB(
\r
471 final java.lang.Object sequenceB) {
\r
472 this._sequenceB = sequenceB;
\r
476 * Method unmarshal.
\r
479 * @throws org.exolab.castor.xml.MarshalException if object is
\r
480 * null or if any SAXException is thrown during marshaling
\r
481 * @throws org.exolab.castor.xml.ValidationException if this
\r
482 * object is an invalid instance according to the schema
\r
483 * @return the unmarshaled
\r
484 * uk.ac.vamsas.objects.core.SequenceMapping
\r
486 public static uk.ac.vamsas.objects.core.SequenceMapping unmarshal(
\r
487 final java.io.Reader reader)
\r
488 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
489 return (uk.ac.vamsas.objects.core.SequenceMapping) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader);
\r
495 * @throws org.exolab.castor.xml.ValidationException if this
\r
496 * object is an invalid instance according to the schema
\r
498 public void validate(
\r
500 throws org.exolab.castor.xml.ValidationException {
\r
501 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
502 validator.validate(this);
\r