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;
156 if (this._start != temp._start)
158 if (this._has_start != temp._has_start)
160 if (this._end != temp._end)
162 if (this._has_end != temp._has_end)
164 if (this._sequence != null) {
165 if (temp._sequence == null) return false;
166 else if (!(this._sequence.equals(temp._sequence)))
169 else if (temp._sequence != null)
171 if (this._name != null) {
172 if (temp._name == null) return false;
173 else if (!(this._name.equals(temp._name)))
176 else if (temp._name != null)
178 if (this._description != null) {
179 if (temp._description == null) return false;
180 else if (!(this._description.equals(temp._description)))
183 else if (temp._description != null)
185 if (this._propertyList != null) {
186 if (temp._propertyList == null) return false;
187 else if (!(this._propertyList.equals(temp._propertyList)))
190 else if (temp._propertyList != null)
198 * Returns the value of field 'description'.
200 * @return the value of field 'Description'.
202 public java.lang.String getDescription(
204 return this._description;
208 * Returns the value of field 'end'.
210 * @return the value of field 'End'.
218 * Returns the value of field 'name'.
220 * @return the value of field 'Name'.
222 public java.lang.String getName(
228 * Method getProperty.
231 * @throws java.lang.IndexOutOfBoundsException if the index
232 * given is outside the bounds of the collection
233 * @return the value of the uk.ac.vamsas.objects.core.Property
236 public uk.ac.vamsas.objects.core.Property getProperty(
238 throws java.lang.IndexOutOfBoundsException {
239 // check bounds for index
240 if (index < 0 || index >= this._propertyList.size()) {
241 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
244 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
248 * Method getProperty.Returns the contents of the collection in
249 * an Array. <p>Note: Just in case the collection contents
250 * are changing in another thread, we pass a 0-length Array of
251 * the correct type into the API call. This way we <i>know</i>
252 * that the Array returned is of exactly the correct length.
254 * @return this collection as an Array
256 public uk.ac.vamsas.objects.core.Property[] getProperty(
258 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
259 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
263 * Method getPropertyAsReference.Returns a reference to
264 * '_propertyList'. No type checking is performed on any
265 * modifications to the Vector.
267 * @return a reference to the Vector backing this class
269 public java.util.Vector getPropertyAsReference(
271 return this._propertyList;
275 * Method getPropertyCount.
277 * @return the size of this collection
279 public int getPropertyCount(
281 return this._propertyList.size();
285 * Returns the value of field 'sequence'.
287 * @return the value of field 'Sequence'.
289 public java.lang.String getSequence(
291 return this._sequence;
295 * Returns the value of field 'start'.
297 * @return the value of field 'Start'.
299 public long getStart(
307 * @return true if at least one End has been added
309 public boolean hasEnd(
311 return this._has_end;
317 * @return true if at least one Start has been added
319 public boolean hasStart(
321 return this._has_start;
325 * Overrides the java.lang.Object.hashCode method.
327 * The following steps came from <b>Effective Java Programming
328 * Language Guide</b> by Joshua Bloch, Chapter 3
330 * @return a hash code value for the object.
334 int result = super.hashCode();
337 result = 37 * result + (int)(_start^(_start>>>32));
338 result = 37 * result + (int)(_end^(_end>>>32));
339 if (_sequence != null) {
340 result = 37 * result + _sequence.hashCode();
343 result = 37 * result + _name.hashCode();
345 if (_description != null) {
346 result = 37 * result + _description.hashCode();
348 if (_propertyList != null) {
349 result = 37 * result + _propertyList.hashCode();
358 * @return true if this object is valid according to the schema
360 public boolean isValid(
364 } catch (org.exolab.castor.xml.ValidationException vex) {
374 * @throws org.exolab.castor.xml.MarshalException if object is
375 * null or if any SAXException is thrown during marshaling
376 * @throws org.exolab.castor.xml.ValidationException if this
377 * object is an invalid instance according to the schema
380 final java.io.Writer out)
381 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
382 Marshaller.marshal(this, out);
389 * @throws java.io.IOException if an IOException occurs during
391 * @throws org.exolab.castor.xml.ValidationException if this
392 * object is an invalid instance according to the schema
393 * @throws org.exolab.castor.xml.MarshalException if object is
394 * null or if any SAXException is thrown during marshaling
397 final org.xml.sax.ContentHandler handler)
398 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
399 Marshaller.marshal(this, handler);
404 public void removeAllProperty(
406 this._propertyList.clear();
410 * Method removeProperty.
413 * @return true if the object was removed from the collection.
415 public boolean removeProperty(
416 final uk.ac.vamsas.objects.core.Property vProperty) {
417 boolean removed = _propertyList.remove(vProperty);
422 * Method removePropertyAt.
425 * @return the element removed from the collection
427 public uk.ac.vamsas.objects.core.Property removePropertyAt(
429 java.lang.Object obj = this._propertyList.remove(index);
430 return (uk.ac.vamsas.objects.core.Property) obj;
434 * Sets the value of field 'description'.
436 * @param description the value of field 'description'.
438 public void setDescription(
439 final java.lang.String description) {
440 this._description = description;
444 * Sets the value of field 'end'.
446 * @param end the value of field 'end'.
451 this._has_end = true;
455 * Sets the value of field 'name'.
457 * @param name the value of field 'name'.
460 final java.lang.String name) {
469 * @throws java.lang.IndexOutOfBoundsException if the index
470 * given is outside the bounds of the collection
472 public void setProperty(
474 final uk.ac.vamsas.objects.core.Property vProperty)
475 throws java.lang.IndexOutOfBoundsException {
476 // check bounds for index
477 if (index < 0 || index >= this._propertyList.size()) {
478 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
481 this._propertyList.set(index, vProperty);
487 * @param vPropertyArray
489 public void setProperty(
490 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
492 _propertyList.clear();
494 for (int i = 0; i < vPropertyArray.length; i++) {
495 this._propertyList.add(vPropertyArray[i]);
500 * Sets the value of '_propertyList' by copying the given
501 * Vector. All elements will be checked for type safety.
503 * @param vPropertyList the Vector to copy.
505 public void setProperty(
506 final java.util.Vector vPropertyList) {
508 this._propertyList.clear();
510 this._propertyList.addAll(vPropertyList);
514 * Sets the value of '_propertyList' by setting it to the given
515 * Vector. No type checking is performed.
518 * @param propertyVector the Vector to set.
520 public void setPropertyAsReference(
521 final java.util.Vector propertyVector) {
522 this._propertyList = propertyVector;
526 * Sets the value of field 'sequence'.
528 * @param sequence the value of field 'sequence'.
530 public void setSequence(
531 final java.lang.String sequence) {
532 this._sequence = sequence;
536 * Sets the value of field 'start'.
538 * @param start the value of field 'start'.
540 public void setStart(
543 this._has_start = true;
550 * @throws org.exolab.castor.xml.MarshalException if object is
551 * null or if any SAXException is thrown during marshaling
552 * @throws org.exolab.castor.xml.ValidationException if this
553 * object is an invalid instance according to the schema
554 * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
556 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
557 final java.io.Reader reader)
558 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
559 return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceType.class, reader);
565 * @throws org.exolab.castor.xml.ValidationException if this
566 * object is an invalid instance according to the schema
568 public void validate(
570 throws org.exolab.castor.xml.ValidationException {
571 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
572 validator.validate(this);