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;
20 * @version $Revision$ $Date$
22 public class Sequence extends uk.ac.vamsas.objects.core.SequenceType
23 implements java.io.Serializable
27 //--------------------------/
28 //- Class/Member Variables -/
29 //--------------------------/
32 * Primary Key for vamsas object referencing
35 private java.lang.String _id;
38 * symbol class for sequence
41 private java.lang.String _dictionary;
44 * Store a list of database references
45 * for this sequence record - with optional mapping
46 * from database sequence to the given sequence record
48 private java.util.Vector _dbRefList;
51 * explicitly named cross reference to other objects in the
55 private java.util.Vector _vxrefList;
64 this._dbRefList = new java.util.Vector();
65 this._vxrefList = new java.util.Vector();
77 * @throws java.lang.IndexOutOfBoundsException if the index
78 * given is outside the bounds of the collection
81 final uk.ac.vamsas.objects.core.DbRef vDbRef)
82 throws java.lang.IndexOutOfBoundsException {
83 this._dbRefList.addElement(vDbRef);
91 * @throws java.lang.IndexOutOfBoundsException if the index
92 * given is outside the bounds of the collection
96 final uk.ac.vamsas.objects.core.DbRef vDbRef)
97 throws java.lang.IndexOutOfBoundsException {
98 this._dbRefList.add(index, vDbRef);
105 * @throws java.lang.IndexOutOfBoundsException if the index
106 * given is outside the bounds of the collection
108 public void addVxref(
109 final uk.ac.vamsas.objects.core.Vxref vVxref)
110 throws java.lang.IndexOutOfBoundsException {
111 this._vxrefList.addElement(vVxref);
119 * @throws java.lang.IndexOutOfBoundsException if the index
120 * given is outside the bounds of the collection
122 public void addVxref(
124 final uk.ac.vamsas.objects.core.Vxref vVxref)
125 throws java.lang.IndexOutOfBoundsException {
126 this._vxrefList.add(index, vVxref);
130 * Method enumerateDbRef.
132 * @return an Enumeration over all
133 * uk.ac.vamsas.objects.core.DbRef elements
135 public java.util.Enumeration enumerateDbRef(
137 return this._dbRefList.elements();
141 * Method enumerateVxref.
143 * @return an Enumeration over all
144 * uk.ac.vamsas.objects.core.Vxref elements
146 public java.util.Enumeration enumerateVxref(
148 return this._vxrefList.elements();
152 * Overrides the java.lang.Object.equals method.
155 * @return true if the objects are equal.
157 public boolean equals(
158 final java.lang.Object obj) {
162 if (super.equals(obj)==false)
165 if (obj instanceof Sequence) {
167 Sequence temp = (Sequence)obj;
168 if (this._id != null) {
169 if (temp._id == null) return false;
170 else if (!(this._id.equals(temp._id)))
173 else if (temp._id != null)
175 if (this._dictionary != null) {
176 if (temp._dictionary == null) return false;
177 else if (!(this._dictionary.equals(temp._dictionary)))
180 else if (temp._dictionary != null)
182 if (this._dbRefList != null) {
183 if (temp._dbRefList == null) return false;
184 else if (!(this._dbRefList.equals(temp._dbRefList)))
187 else if (temp._dbRefList != null)
189 if (this._vxrefList != null) {
190 if (temp._vxrefList == null) return false;
191 else if (!(this._vxrefList.equals(temp._vxrefList)))
194 else if (temp._vxrefList != null)
205 * @throws java.lang.IndexOutOfBoundsException if the index
206 * given is outside the bounds of the collection
207 * @return the value of the uk.ac.vamsas.objects.core.DbRef at
210 public uk.ac.vamsas.objects.core.DbRef getDbRef(
212 throws java.lang.IndexOutOfBoundsException {
213 // check bounds for index
214 if (index < 0 || index >= this._dbRefList.size()) {
215 throw new IndexOutOfBoundsException("getDbRef: Index value '" + index + "' not in range [0.." + (this._dbRefList.size() - 1) + "]");
218 return (uk.ac.vamsas.objects.core.DbRef) _dbRefList.get(index);
222 * Method getDbRef.Returns the contents of the collection in an
223 * Array. <p>Note: Just in case the collection contents are
224 * changing in another thread, we pass a 0-length Array of the
225 * correct type into the API call. This way we <i>know</i>
226 * that the Array returned is of exactly the correct length.
228 * @return this collection as an Array
230 public uk.ac.vamsas.objects.core.DbRef[] getDbRef(
232 uk.ac.vamsas.objects.core.DbRef[] array = new uk.ac.vamsas.objects.core.DbRef[0];
233 return (uk.ac.vamsas.objects.core.DbRef[]) this._dbRefList.toArray(array);
237 * Method getDbRefAsReference.Returns a reference to
238 * '_dbRefList'. No type checking is performed on any
239 * modifications to the Vector.
241 * @return a reference to the Vector backing this class
243 public java.util.Vector getDbRefAsReference(
245 return this._dbRefList;
249 * Method getDbRefCount.
251 * @return the size of this collection
253 public int getDbRefCount(
255 return this._dbRefList.size();
259 * Returns the value of field 'dictionary'. The field
260 * 'dictionary' has the following description: symbol class for
264 * @return the value of field 'Dictionary'.
266 public java.lang.String getDictionary(
268 return this._dictionary;
272 * Returns the value of field 'id'. The field 'id' has the
273 * following description: Primary Key for vamsas object
277 * @return the value of field 'Id'.
279 public java.lang.String getId(
288 * @throws java.lang.IndexOutOfBoundsException if the index
289 * given is outside the bounds of the collection
290 * @return the value of the uk.ac.vamsas.objects.core.Vxref at
293 public uk.ac.vamsas.objects.core.Vxref getVxref(
295 throws java.lang.IndexOutOfBoundsException {
296 // check bounds for index
297 if (index < 0 || index >= this._vxrefList.size()) {
298 throw new IndexOutOfBoundsException("getVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]");
301 return (uk.ac.vamsas.objects.core.Vxref) _vxrefList.get(index);
305 * Method getVxref.Returns the contents of the collection in an
306 * Array. <p>Note: Just in case the collection contents are
307 * changing in another thread, we pass a 0-length Array of the
308 * correct type into the API call. This way we <i>know</i>
309 * that the Array returned is of exactly the correct length.
311 * @return this collection as an Array
313 public uk.ac.vamsas.objects.core.Vxref[] getVxref(
315 uk.ac.vamsas.objects.core.Vxref[] array = new uk.ac.vamsas.objects.core.Vxref[0];
316 return (uk.ac.vamsas.objects.core.Vxref[]) this._vxrefList.toArray(array);
320 * Method getVxrefAsReference.Returns a reference to
321 * '_vxrefList'. No type checking is performed on any
322 * modifications to the Vector.
324 * @return a reference to the Vector backing this class
326 public java.util.Vector getVxrefAsReference(
328 return this._vxrefList;
332 * Method getVxrefCount.
334 * @return the size of this collection
336 public int getVxrefCount(
338 return this._vxrefList.size();
342 * Overrides the java.lang.Object.hashCode method.
344 * The following steps came from <b>Effective Java Programming
345 * Language Guide</b> by Joshua Bloch, Chapter 3
347 * @return a hash code value for the object.
351 int result = super.hashCode();
355 result = 37 * result + _id.hashCode();
357 if (_dictionary != null) {
358 result = 37 * result + _dictionary.hashCode();
360 if (_dbRefList != null) {
361 result = 37 * result + _dbRefList.hashCode();
363 if (_vxrefList != null) {
364 result = 37 * result + _vxrefList.hashCode();
373 * @return true if this object is valid according to the schema
375 public boolean isValid(
379 } catch (org.exolab.castor.xml.ValidationException vex) {
389 * @throws org.exolab.castor.xml.MarshalException if object is
390 * null or if any SAXException is thrown during marshaling
391 * @throws org.exolab.castor.xml.ValidationException if this
392 * object is an invalid instance according to the schema
395 final java.io.Writer out)
396 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
397 Marshaller.marshal(this, out);
404 * @throws java.io.IOException if an IOException occurs during
406 * @throws org.exolab.castor.xml.ValidationException if this
407 * object is an invalid instance according to the schema
408 * @throws org.exolab.castor.xml.MarshalException if object is
409 * null or if any SAXException is thrown during marshaling
412 final org.xml.sax.ContentHandler handler)
413 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
414 Marshaller.marshal(this, handler);
419 public void removeAllDbRef(
421 this._dbRefList.clear();
426 public void removeAllVxref(
428 this._vxrefList.clear();
432 * Method removeDbRef.
435 * @return true if the object was removed from the collection.
437 public boolean removeDbRef(
438 final uk.ac.vamsas.objects.core.DbRef vDbRef) {
439 boolean removed = _dbRefList.remove(vDbRef);
444 * Method removeDbRefAt.
447 * @return the element removed from the collection
449 public uk.ac.vamsas.objects.core.DbRef removeDbRefAt(
451 java.lang.Object obj = this._dbRefList.remove(index);
452 return (uk.ac.vamsas.objects.core.DbRef) obj;
456 * Method removeVxref.
459 * @return true if the object was removed from the collection.
461 public boolean removeVxref(
462 final uk.ac.vamsas.objects.core.Vxref vVxref) {
463 boolean removed = _vxrefList.remove(vVxref);
468 * Method removeVxrefAt.
471 * @return the element removed from the collection
473 public uk.ac.vamsas.objects.core.Vxref removeVxrefAt(
475 java.lang.Object obj = this._vxrefList.remove(index);
476 return (uk.ac.vamsas.objects.core.Vxref) obj;
484 * @throws java.lang.IndexOutOfBoundsException if the index
485 * given is outside the bounds of the collection
487 public void setDbRef(
489 final uk.ac.vamsas.objects.core.DbRef vDbRef)
490 throws java.lang.IndexOutOfBoundsException {
491 // check bounds for index
492 if (index < 0 || index >= this._dbRefList.size()) {
493 throw new IndexOutOfBoundsException("setDbRef: Index value '" + index + "' not in range [0.." + (this._dbRefList.size() - 1) + "]");
496 this._dbRefList.set(index, vDbRef);
504 public void setDbRef(
505 final uk.ac.vamsas.objects.core.DbRef[] vDbRefArray) {
509 for (int i = 0; i < vDbRefArray.length; i++) {
510 this._dbRefList.add(vDbRefArray[i]);
515 * Sets the value of '_dbRefList' by copying the given Vector.
516 * All elements will be checked for type safety.
518 * @param vDbRefList the Vector to copy.
520 public void setDbRef(
521 final java.util.Vector vDbRefList) {
523 this._dbRefList.clear();
525 this._dbRefList.addAll(vDbRefList);
529 * Sets the value of '_dbRefList' by setting it to the given
530 * Vector. No type checking is performed.
533 * @param dbRefVector the Vector to set.
535 public void setDbRefAsReference(
536 final java.util.Vector dbRefVector) {
537 this._dbRefList = dbRefVector;
541 * Sets the value of field 'dictionary'. The field 'dictionary'
542 * has the following description: symbol class for sequence
545 * @param dictionary the value of field 'dictionary'.
547 public void setDictionary(
548 final java.lang.String dictionary) {
549 this._dictionary = dictionary;
553 * Sets the value of field 'id'. The field 'id' has the
554 * following description: Primary Key for vamsas object
558 * @param id the value of field 'id'.
561 final java.lang.String id) {
570 * @throws java.lang.IndexOutOfBoundsException if the index
571 * given is outside the bounds of the collection
573 public void setVxref(
575 final uk.ac.vamsas.objects.core.Vxref vVxref)
576 throws java.lang.IndexOutOfBoundsException {
577 // check bounds for index
578 if (index < 0 || index >= this._vxrefList.size()) {
579 throw new IndexOutOfBoundsException("setVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]");
582 this._vxrefList.set(index, vVxref);
590 public void setVxref(
591 final uk.ac.vamsas.objects.core.Vxref[] vVxrefArray) {
595 for (int i = 0; i < vVxrefArray.length; i++) {
596 this._vxrefList.add(vVxrefArray[i]);
601 * Sets the value of '_vxrefList' by copying the given Vector.
602 * All elements will be checked for type safety.
604 * @param vVxrefList the Vector to copy.
606 public void setVxref(
607 final java.util.Vector vVxrefList) {
609 this._vxrefList.clear();
611 this._vxrefList.addAll(vVxrefList);
615 * Sets the value of '_vxrefList' by setting it to the given
616 * Vector. No type checking is performed.
619 * @param vxrefVector the Vector to set.
621 public void setVxrefAsReference(
622 final java.util.Vector vxrefVector) {
623 this._vxrefList = vxrefVector;
630 * @throws org.exolab.castor.xml.MarshalException if object is
631 * null or if any SAXException is thrown during marshaling
632 * @throws org.exolab.castor.xml.ValidationException if this
633 * object is an invalid instance according to the schema
634 * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
636 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
637 final java.io.Reader reader)
638 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
639 return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Sequence.class, reader);
645 * @throws org.exolab.castor.xml.ValidationException if this
646 * object is an invalid instance according to the schema
648 public void validate(
650 throws org.exolab.castor.xml.ValidationException {
651 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
652 validator.validate(this);