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 SequenceType extends uk.ac.vamsas.client.Vobject
23 implements java.io.Serializable
27 //--------------------------/
28 //- Class/Member Variables -/
29 //--------------------------/
37 * keeps track of state for field: _start
39 private boolean _has_start;
47 * keeps track of state for field: _end
49 private boolean _has_end;
54 private java.lang.String _sequence;
59 private java.lang.String _name;
64 private java.lang.String _description;
67 * additional typed properties
69 private java.util.Vector _propertyList;
74 private java.util.Vector _mappingList;
81 public SequenceType() {
83 this._propertyList = new java.util.Vector();
84 this._mappingList = new java.util.Vector();
96 * @throws java.lang.IndexOutOfBoundsException if the index
97 * given is outside the bounds of the collection
99 public void addMapping(
100 final uk.ac.vamsas.objects.core.Mapping vMapping)
101 throws java.lang.IndexOutOfBoundsException {
102 this._mappingList.addElement(vMapping);
110 * @throws java.lang.IndexOutOfBoundsException if the index
111 * given is outside the bounds of the collection
113 public void addMapping(
115 final uk.ac.vamsas.objects.core.Mapping vMapping)
116 throws java.lang.IndexOutOfBoundsException {
117 this._mappingList.add(index, vMapping);
124 * @throws java.lang.IndexOutOfBoundsException if the index
125 * given is outside the bounds of the collection
127 public void addProperty(
128 final uk.ac.vamsas.objects.core.Property vProperty)
129 throws java.lang.IndexOutOfBoundsException {
130 this._propertyList.addElement(vProperty);
138 * @throws java.lang.IndexOutOfBoundsException if the index
139 * given is outside the bounds of the collection
141 public void addProperty(
143 final uk.ac.vamsas.objects.core.Property vProperty)
144 throws java.lang.IndexOutOfBoundsException {
145 this._propertyList.add(index, vProperty);
150 public void deleteEnd(
152 this._has_end= false;
157 public void deleteStart(
159 this._has_start= false;
163 * Method enumerateMapping.
165 * @return an Enumeration over all
166 * uk.ac.vamsas.objects.core.Mapping elements
168 public java.util.Enumeration enumerateMapping(
170 return this._mappingList.elements();
174 * Method enumerateProperty.
176 * @return an Enumeration over all
177 * uk.ac.vamsas.objects.core.Property elements
179 public java.util.Enumeration enumerateProperty(
181 return this._propertyList.elements();
185 * Overrides the java.lang.Object.equals method.
188 * @return true if the objects are equal.
190 public boolean equals(
191 final java.lang.Object obj) {
195 if (super.equals(obj)==false)
198 if (obj instanceof SequenceType) {
200 SequenceType temp = (SequenceType)obj;
201 if (this._start != temp._start)
203 if (this._has_start != temp._has_start)
205 if (this._end != temp._end)
207 if (this._has_end != temp._has_end)
209 if (this._sequence != null) {
210 if (temp._sequence == null) return false;
211 else if (!(this._sequence.equals(temp._sequence)))
214 else if (temp._sequence != null)
216 if (this._name != null) {
217 if (temp._name == null) return false;
218 else if (!(this._name.equals(temp._name)))
221 else if (temp._name != null)
223 if (this._description != null) {
224 if (temp._description == null) return false;
225 else if (!(this._description.equals(temp._description)))
228 else if (temp._description != null)
230 if (this._propertyList != null) {
231 if (temp._propertyList == null) return false;
232 else if (!(this._propertyList.equals(temp._propertyList)))
235 else if (temp._propertyList != null)
237 if (this._mappingList != null) {
238 if (temp._mappingList == null) return false;
239 else if (!(this._mappingList.equals(temp._mappingList)))
242 else if (temp._mappingList != null)
250 * Returns the value of field 'description'.
252 * @return the value of field 'Description'.
254 public java.lang.String getDescription(
256 return this._description;
260 * Returns the value of field 'end'.
262 * @return the value of field 'End'.
273 * @throws java.lang.IndexOutOfBoundsException if the index
274 * given is outside the bounds of the collection
275 * @return the value of the uk.ac.vamsas.objects.core.Mapping
278 public uk.ac.vamsas.objects.core.Mapping getMapping(
280 throws java.lang.IndexOutOfBoundsException {
281 // check bounds for index
282 if (index < 0 || index >= this._mappingList.size()) {
283 throw new IndexOutOfBoundsException("getMapping: Index value '" + index + "' not in range [0.." + (this._mappingList.size() - 1) + "]");
286 return (uk.ac.vamsas.objects.core.Mapping) _mappingList.get(index);
290 * Method getMapping.Returns the contents of the collection in
291 * an Array. <p>Note: Just in case the collection contents
292 * are changing in another thread, we pass a 0-length Array of
293 * the correct type into the API call. This way we <i>know</i>
294 * that the Array returned is of exactly the correct length.
296 * @return this collection as an Array
298 public uk.ac.vamsas.objects.core.Mapping[] getMapping(
300 uk.ac.vamsas.objects.core.Mapping[] array = new uk.ac.vamsas.objects.core.Mapping[0];
301 return (uk.ac.vamsas.objects.core.Mapping[]) this._mappingList.toArray(array);
305 * Method getMappingAsReference.Returns a reference to
306 * '_mappingList'. No type checking is performed on any
307 * modifications to the Vector.
309 * @return a reference to the Vector backing this class
311 public java.util.Vector getMappingAsReference(
313 return this._mappingList;
317 * Method getMappingCount.
319 * @return the size of this collection
321 public int getMappingCount(
323 return this._mappingList.size();
327 * Returns the value of field 'name'.
329 * @return the value of field 'Name'.
331 public java.lang.String getName(
337 * Method getProperty.
340 * @throws java.lang.IndexOutOfBoundsException if the index
341 * given is outside the bounds of the collection
342 * @return the value of the uk.ac.vamsas.objects.core.Property
345 public uk.ac.vamsas.objects.core.Property getProperty(
347 throws java.lang.IndexOutOfBoundsException {
348 // check bounds for index
349 if (index < 0 || index >= this._propertyList.size()) {
350 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
353 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
357 * Method getProperty.Returns the contents of the collection in
358 * an Array. <p>Note: Just in case the collection contents
359 * are changing in another thread, we pass a 0-length Array of
360 * the correct type into the API call. This way we <i>know</i>
361 * that the Array returned is of exactly the correct length.
363 * @return this collection as an Array
365 public uk.ac.vamsas.objects.core.Property[] getProperty(
367 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
368 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
372 * Method getPropertyAsReference.Returns a reference to
373 * '_propertyList'. No type checking is performed on any
374 * modifications to the Vector.
376 * @return a reference to the Vector backing this class
378 public java.util.Vector getPropertyAsReference(
380 return this._propertyList;
384 * Method getPropertyCount.
386 * @return the size of this collection
388 public int getPropertyCount(
390 return this._propertyList.size();
394 * Returns the value of field 'sequence'.
396 * @return the value of field 'Sequence'.
398 public java.lang.String getSequence(
400 return this._sequence;
404 * Returns the value of field 'start'.
406 * @return the value of field 'Start'.
408 public long getStart(
416 * @return true if at least one End has been added
418 public boolean hasEnd(
420 return this._has_end;
426 * @return true if at least one Start has been added
428 public boolean hasStart(
430 return this._has_start;
434 * Overrides the java.lang.Object.hashCode method.
436 * The following steps came from <b>Effective Java Programming
437 * Language Guide</b> by Joshua Bloch, Chapter 3
439 * @return a hash code value for the object.
443 int result = super.hashCode();
446 result = 37 * result + (int)(_start^(_start>>>32));
447 result = 37 * result + (int)(_end^(_end>>>32));
448 if (_sequence != null) {
449 result = 37 * result + _sequence.hashCode();
452 result = 37 * result + _name.hashCode();
454 if (_description != null) {
455 result = 37 * result + _description.hashCode();
457 if (_propertyList != null) {
458 result = 37 * result + _propertyList.hashCode();
460 if (_mappingList != null) {
461 result = 37 * result + _mappingList.hashCode();
470 * @return true if this object is valid according to the schema
472 public boolean isValid(
476 } catch (org.exolab.castor.xml.ValidationException vex) {
486 * @throws org.exolab.castor.xml.MarshalException if object is
487 * null or if any SAXException is thrown during marshaling
488 * @throws org.exolab.castor.xml.ValidationException if this
489 * object is an invalid instance according to the schema
492 final java.io.Writer out)
493 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
494 Marshaller.marshal(this, out);
501 * @throws java.io.IOException if an IOException occurs during
503 * @throws org.exolab.castor.xml.ValidationException if this
504 * object is an invalid instance according to the schema
505 * @throws org.exolab.castor.xml.MarshalException if object is
506 * null or if any SAXException is thrown during marshaling
509 final org.xml.sax.ContentHandler handler)
510 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
511 Marshaller.marshal(this, handler);
516 public void removeAllMapping(
518 this._mappingList.clear();
523 public void removeAllProperty(
525 this._propertyList.clear();
529 * Method removeMapping.
532 * @return true if the object was removed from the collection.
534 public boolean removeMapping(
535 final uk.ac.vamsas.objects.core.Mapping vMapping) {
536 boolean removed = _mappingList.remove(vMapping);
541 * Method removeMappingAt.
544 * @return the element removed from the collection
546 public uk.ac.vamsas.objects.core.Mapping removeMappingAt(
548 java.lang.Object obj = this._mappingList.remove(index);
549 return (uk.ac.vamsas.objects.core.Mapping) obj;
553 * Method removeProperty.
556 * @return true if the object was removed from the collection.
558 public boolean removeProperty(
559 final uk.ac.vamsas.objects.core.Property vProperty) {
560 boolean removed = _propertyList.remove(vProperty);
565 * Method removePropertyAt.
568 * @return the element removed from the collection
570 public uk.ac.vamsas.objects.core.Property removePropertyAt(
572 java.lang.Object obj = this._propertyList.remove(index);
573 return (uk.ac.vamsas.objects.core.Property) obj;
577 * Sets the value of field 'description'.
579 * @param description the value of field 'description'.
581 public void setDescription(
582 final java.lang.String description) {
583 this._description = description;
587 * Sets the value of field 'end'.
589 * @param end the value of field 'end'.
594 this._has_end = true;
602 * @throws java.lang.IndexOutOfBoundsException if the index
603 * given is outside the bounds of the collection
605 public void setMapping(
607 final uk.ac.vamsas.objects.core.Mapping vMapping)
608 throws java.lang.IndexOutOfBoundsException {
609 // check bounds for index
610 if (index < 0 || index >= this._mappingList.size()) {
611 throw new IndexOutOfBoundsException("setMapping: Index value '" + index + "' not in range [0.." + (this._mappingList.size() - 1) + "]");
614 this._mappingList.set(index, vMapping);
620 * @param vMappingArray
622 public void setMapping(
623 final uk.ac.vamsas.objects.core.Mapping[] vMappingArray) {
625 _mappingList.clear();
627 for (int i = 0; i < vMappingArray.length; i++) {
628 this._mappingList.add(vMappingArray[i]);
633 * Sets the value of '_mappingList' by copying the given
634 * Vector. All elements will be checked for type safety.
636 * @param vMappingList the Vector to copy.
638 public void setMapping(
639 final java.util.Vector vMappingList) {
641 this._mappingList.clear();
643 this._mappingList.addAll(vMappingList);
647 * Sets the value of '_mappingList' by setting it to the given
648 * Vector. No type checking is performed.
651 * @param mappingVector the Vector to set.
653 public void setMappingAsReference(
654 final java.util.Vector mappingVector) {
655 this._mappingList = mappingVector;
659 * Sets the value of field 'name'.
661 * @param name the value of field 'name'.
664 final java.lang.String name) {
673 * @throws java.lang.IndexOutOfBoundsException if the index
674 * given is outside the bounds of the collection
676 public void setProperty(
678 final uk.ac.vamsas.objects.core.Property vProperty)
679 throws java.lang.IndexOutOfBoundsException {
680 // check bounds for index
681 if (index < 0 || index >= this._propertyList.size()) {
682 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
685 this._propertyList.set(index, vProperty);
691 * @param vPropertyArray
693 public void setProperty(
694 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
696 _propertyList.clear();
698 for (int i = 0; i < vPropertyArray.length; i++) {
699 this._propertyList.add(vPropertyArray[i]);
704 * Sets the value of '_propertyList' by copying the given
705 * Vector. All elements will be checked for type safety.
707 * @param vPropertyList the Vector to copy.
709 public void setProperty(
710 final java.util.Vector vPropertyList) {
712 this._propertyList.clear();
714 this._propertyList.addAll(vPropertyList);
718 * Sets the value of '_propertyList' by setting it to the given
719 * Vector. No type checking is performed.
722 * @param propertyVector the Vector to set.
724 public void setPropertyAsReference(
725 final java.util.Vector propertyVector) {
726 this._propertyList = propertyVector;
730 * Sets the value of field 'sequence'.
732 * @param sequence the value of field 'sequence'.
734 public void setSequence(
735 final java.lang.String sequence) {
736 this._sequence = sequence;
740 * Sets the value of field 'start'.
742 * @param start the value of field 'start'.
744 public void setStart(
747 this._has_start = true;
754 * @throws org.exolab.castor.xml.MarshalException if object is
755 * null or if any SAXException is thrown during marshaling
756 * @throws org.exolab.castor.xml.ValidationException if this
757 * object is an invalid instance according to the schema
758 * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
760 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
761 final java.io.Reader reader)
762 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
763 return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceType.class, reader);
769 * @throws org.exolab.castor.xml.ValidationException if this
770 * object is an invalid instance according to the schema
772 public void validate(
774 throws org.exolab.castor.xml.ValidationException {
775 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
776 validator.validate(this);