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;
76 public SequenceType() {
78 this._propertyList = new java.util.Vector();
90 * @throws java.lang.IndexOutOfBoundsException if the index
91 * given is outside the bounds of the collection
93 public void addProperty(
94 final uk.ac.vamsas.objects.core.Property vProperty)
95 throws java.lang.IndexOutOfBoundsException {
96 this._propertyList.addElement(vProperty);
104 * @throws java.lang.IndexOutOfBoundsException if the index
105 * given is outside the bounds of the collection
107 public void addProperty(
109 final uk.ac.vamsas.objects.core.Property vProperty)
110 throws java.lang.IndexOutOfBoundsException {
111 this._propertyList.add(index, vProperty);
116 public void deleteEnd(
118 this._has_end= false;
123 public void deleteStart(
125 this._has_start= false;
129 * Method enumerateProperty.
131 * @return an Enumeration over all
132 * uk.ac.vamsas.objects.core.Property elements
134 public java.util.Enumeration enumerateProperty(
136 return this._propertyList.elements();
140 * Overrides the java.lang.Object.equals method.
143 * @return true if the objects are equal.
145 public boolean equals(
146 final java.lang.Object obj) {
150 if (super.equals(obj)==false)
153 if (obj instanceof SequenceType) {
155 SequenceType temp = (SequenceType)obj;
158 if (this._start != temp._start)
160 if (this._has_start != temp._has_start)
162 if (this._end != temp._end)
164 if (this._has_end != temp._has_end)
166 if (this._sequence != null) {
167 if (temp._sequence == null) return false;
168 if (this._sequence != temp._sequence) {
169 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._sequence);
170 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._sequence);
171 if (thcycle!=tmcycle) {
172 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence); };
173 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence); };
177 if (!this._sequence.equals(temp._sequence)) {
178 org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
179 org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
182 org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
183 org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
186 } else if (temp._sequence != null)
188 if (this._name != null) {
189 if (temp._name == null) return false;
190 if (this._name != temp._name) {
191 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);
192 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);
193 if (thcycle!=tmcycle) {
194 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };
195 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };
199 if (!this._name.equals(temp._name)) {
200 org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
201 org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
204 org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
205 org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
208 } else if (temp._name != null)
210 if (this._description != null) {
211 if (temp._description == null) return false;
212 if (this._description != temp._description) {
213 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._description);
214 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._description);
215 if (thcycle!=tmcycle) {
216 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._description); };
217 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._description); };
221 if (!this._description.equals(temp._description)) {
222 org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
223 org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
226 org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
227 org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
230 } else if (temp._description != null)
232 if (this._propertyList != null) {
233 if (temp._propertyList == null) return false;
234 if (this._propertyList != temp._propertyList) {
235 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
236 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
237 if (thcycle!=tmcycle) {
238 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
239 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
243 if (!this._propertyList.equals(temp._propertyList)) {
244 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
245 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
248 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
249 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
252 } else if (temp._propertyList != null)
260 * Returns the value of field 'description'.
262 * @return the value of field 'Description'.
264 public java.lang.String getDescription(
266 return this._description;
270 * Returns the value of field 'end'.
272 * @return the value of field 'End'.
280 * Returns the value of field 'name'.
282 * @return the value of field 'Name'.
284 public java.lang.String getName(
290 * Method getProperty.
293 * @throws java.lang.IndexOutOfBoundsException if the index
294 * given is outside the bounds of the collection
295 * @return the value of the uk.ac.vamsas.objects.core.Property
298 public uk.ac.vamsas.objects.core.Property getProperty(
300 throws java.lang.IndexOutOfBoundsException {
301 // check bounds for index
302 if (index < 0 || index >= this._propertyList.size()) {
303 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
306 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
310 * Method getProperty.Returns the contents of the collection in
311 * an Array. <p>Note: Just in case the collection contents
312 * are changing in another thread, we pass a 0-length Array of
313 * the correct type into the API call. This way we <i>know</i>
314 * that the Array returned is of exactly the correct length.
316 * @return this collection as an Array
318 public uk.ac.vamsas.objects.core.Property[] getProperty(
320 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
321 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
325 * Method getPropertyAsReference.Returns a reference to
326 * '_propertyList'. No type checking is performed on any
327 * modifications to the Vector.
329 * @return a reference to the Vector backing this class
331 public java.util.Vector getPropertyAsReference(
333 return this._propertyList;
337 * Method getPropertyCount.
339 * @return the size of this collection
341 public int getPropertyCount(
343 return this._propertyList.size();
347 * Returns the value of field 'sequence'.
349 * @return the value of field 'Sequence'.
351 public java.lang.String getSequence(
353 return this._sequence;
357 * Returns the value of field 'start'.
359 * @return the value of field 'Start'.
361 public long getStart(
369 * @return true if at least one End has been added
371 public boolean hasEnd(
373 return this._has_end;
379 * @return true if at least one Start has been added
381 public boolean hasStart(
383 return this._has_start;
387 * Overrides the java.lang.Object.hashCode method.
389 * The following steps came from <b>Effective Java Programming
390 * Language Guide</b> by Joshua Bloch, Chapter 3
392 * @return a hash code value for the object.
396 int result = super.hashCode();
399 result = 37 * result + (int)(_start^(_start>>>32));
400 result = 37 * result + (int)(_end^(_end>>>32));
401 if (_sequence != null
402 && !org.castor.util.CycleBreaker.startingToCycle(_sequence)) {
403 result = 37 * result + _sequence.hashCode();
404 org.castor.util.CycleBreaker.releaseCycleHandle(_sequence);
407 && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
408 result = 37 * result + _name.hashCode();
409 org.castor.util.CycleBreaker.releaseCycleHandle(_name);
411 if (_description != null
412 && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
413 result = 37 * result + _description.hashCode();
414 org.castor.util.CycleBreaker.releaseCycleHandle(_description);
416 if (_propertyList != null
417 && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
418 result = 37 * result + _propertyList.hashCode();
419 org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
428 * @return true if this object is valid according to the schema
430 public boolean isValid(
434 } catch (org.exolab.castor.xml.ValidationException vex) {
444 * @throws org.exolab.castor.xml.MarshalException if object is
445 * null or if any SAXException is thrown during marshaling
446 * @throws org.exolab.castor.xml.ValidationException if this
447 * object is an invalid instance according to the schema
450 final java.io.Writer out)
451 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
452 Marshaller.marshal(this, out);
459 * @throws java.io.IOException if an IOException occurs during
461 * @throws org.exolab.castor.xml.ValidationException if this
462 * object is an invalid instance according to the schema
463 * @throws org.exolab.castor.xml.MarshalException if object is
464 * null or if any SAXException is thrown during marshaling
467 final org.xml.sax.ContentHandler handler)
468 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
469 Marshaller.marshal(this, handler);
474 public void removeAllProperty(
476 this._propertyList.clear();
480 * Method removeProperty.
483 * @return true if the object was removed from the collection.
485 public boolean removeProperty(
486 final uk.ac.vamsas.objects.core.Property vProperty) {
487 boolean removed = _propertyList.remove(vProperty);
492 * Method removePropertyAt.
495 * @return the element removed from the collection
497 public uk.ac.vamsas.objects.core.Property removePropertyAt(
499 java.lang.Object obj = this._propertyList.remove(index);
500 return (uk.ac.vamsas.objects.core.Property) obj;
504 * Sets the value of field 'description'.
506 * @param description the value of field 'description'.
508 public void setDescription(
509 final java.lang.String description) {
510 this._description = description;
514 * Sets the value of field 'end'.
516 * @param end the value of field 'end'.
521 this._has_end = true;
525 * Sets the value of field 'name'.
527 * @param name the value of field 'name'.
530 final java.lang.String name) {
539 * @throws java.lang.IndexOutOfBoundsException if the index
540 * given is outside the bounds of the collection
542 public void setProperty(
544 final uk.ac.vamsas.objects.core.Property vProperty)
545 throws java.lang.IndexOutOfBoundsException {
546 // check bounds for index
547 if (index < 0 || index >= this._propertyList.size()) {
548 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
551 this._propertyList.set(index, vProperty);
557 * @param vPropertyArray
559 public void setProperty(
560 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
562 _propertyList.clear();
564 for (int i = 0; i < vPropertyArray.length; i++) {
565 this._propertyList.add(vPropertyArray[i]);
570 * Sets the value of '_propertyList' by copying the given
571 * Vector. All elements will be checked for type safety.
573 * @param vPropertyList the Vector to copy.
575 public void setProperty(
576 final java.util.Vector vPropertyList) {
578 this._propertyList.clear();
580 this._propertyList.addAll(vPropertyList);
584 * Sets the value of '_propertyList' by setting it to the given
585 * Vector. No type checking is performed.
588 * @param propertyVector the Vector to set.
590 public void setPropertyAsReference(
591 final java.util.Vector propertyVector) {
592 this._propertyList = propertyVector;
596 * Sets the value of field 'sequence'.
598 * @param sequence the value of field 'sequence'.
600 public void setSequence(
601 final java.lang.String sequence) {
602 this._sequence = sequence;
606 * Sets the value of field 'start'.
608 * @param start the value of field 'start'.
610 public void setStart(
613 this._has_start = true;
620 * @throws org.exolab.castor.xml.MarshalException if object is
621 * null or if any SAXException is thrown during marshaling
622 * @throws org.exolab.castor.xml.ValidationException if this
623 * object is an invalid instance according to the schema
624 * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
626 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
627 final java.io.Reader reader)
628 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
629 return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceType.class, reader);
635 * @throws org.exolab.castor.xml.ValidationException if this
636 * object is an invalid instance according to the schema
638 public void validate(
640 throws org.exolab.castor.xml.ValidationException {
641 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
642 validator.validate(this);