6b25c6f176f6e300c6b9e3da793368af4f271ccc
[vamsas.git] / src / uk / ac / vamsas / objects / core / SequenceType.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package uk.ac.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class SequenceType.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class SequenceType extends uk.ac.vamsas.client.Vobject 
23 implements java.io.Serializable
24 {
25
26
27       //--------------------------/
28      //- Class/Member Variables -/
29     //--------------------------/
30
31     /**
32      * Field _start.
33      */
34     private long _start;
35
36     /**
37      * keeps track of state for field: _start
38      */
39     private boolean _has_start;
40
41     /**
42      * Field _end.
43      */
44     private long _end;
45
46     /**
47      * keeps track of state for field: _end
48      */
49     private boolean _has_end;
50
51     /**
52      * Field _sequence.
53      */
54     private java.lang.String _sequence;
55
56     /**
57      * Field _name.
58      */
59     private java.lang.String _name;
60
61     /**
62      * Field _description.
63      */
64     private java.lang.String _description;
65
66     /**
67      * additional typed properties 
68      */
69     private java.util.Vector _propertyList;
70
71
72       //----------------/
73      //- Constructors -/
74     //----------------/
75
76     public SequenceType() {
77         super();
78         this._propertyList = new java.util.Vector();
79     }
80
81
82       //-----------/
83      //- Methods -/
84     //-----------/
85
86     /**
87      * 
88      * 
89      * @param vProperty
90      * @throws java.lang.IndexOutOfBoundsException if the index
91      * given is outside the bounds of the collection
92      */
93     public void addProperty(
94             final uk.ac.vamsas.objects.core.Property vProperty)
95     throws java.lang.IndexOutOfBoundsException {
96         this._propertyList.addElement(vProperty);
97     }
98
99     /**
100      * 
101      * 
102      * @param index
103      * @param vProperty
104      * @throws java.lang.IndexOutOfBoundsException if the index
105      * given is outside the bounds of the collection
106      */
107     public void addProperty(
108             final int index,
109             final uk.ac.vamsas.objects.core.Property vProperty)
110     throws java.lang.IndexOutOfBoundsException {
111         this._propertyList.add(index, vProperty);
112     }
113
114     /**
115      */
116     public void deleteEnd(
117     ) {
118         this._has_end= false;
119     }
120
121     /**
122      */
123     public void deleteStart(
124     ) {
125         this._has_start= false;
126     }
127
128     /**
129      * Method enumerateProperty.
130      * 
131      * @return an Enumeration over all
132      * uk.ac.vamsas.objects.core.Property elements
133      */
134     public java.util.Enumeration enumerateProperty(
135     ) {
136         return this._propertyList.elements();
137     }
138
139     /**
140      * Overrides the java.lang.Object.equals method.
141      * 
142      * @param obj
143      * @return true if the objects are equal.
144      */
145     public boolean equals(
146             final java.lang.Object obj) {
147         if ( this == obj )
148             return true;
149         
150         if (super.equals(obj)==false)
151             return false;
152         
153         if (obj instanceof SequenceType) {
154         
155             SequenceType temp = (SequenceType)obj;
156             if (this._start != temp._start)
157                 return false;
158             if (this._has_start != temp._has_start)
159                 return false;
160             if (this._end != temp._end)
161                 return false;
162             if (this._has_end != temp._has_end)
163                 return false;
164             if (this._sequence != null) {
165                 if (temp._sequence == null) return false;
166                 else if (!(this._sequence.equals(temp._sequence))) 
167                     return false;
168             }
169             else if (temp._sequence != null)
170                 return false;
171             if (this._name != null) {
172                 if (temp._name == null) return false;
173                 else if (!(this._name.equals(temp._name))) 
174                     return false;
175             }
176             else if (temp._name != null)
177                 return false;
178             if (this._description != null) {
179                 if (temp._description == null) return false;
180                 else if (!(this._description.equals(temp._description))) 
181                     return false;
182             }
183             else if (temp._description != null)
184                 return false;
185             if (this._propertyList != null) {
186                 if (temp._propertyList == null) return false;
187                 else if (!(this._propertyList.equals(temp._propertyList))) 
188                     return false;
189             }
190             else if (temp._propertyList != null)
191                 return false;
192             return true;
193         }
194         return false;
195     }
196
197     /**
198      * Returns the value of field 'description'.
199      * 
200      * @return the value of field 'Description'.
201      */
202     public java.lang.String getDescription(
203     ) {
204         return this._description;
205     }
206
207     /**
208      * Returns the value of field 'end'.
209      * 
210      * @return the value of field 'End'.
211      */
212     public long getEnd(
213     ) {
214         return this._end;
215     }
216
217     /**
218      * Returns the value of field 'name'.
219      * 
220      * @return the value of field 'Name'.
221      */
222     public java.lang.String getName(
223     ) {
224         return this._name;
225     }
226
227     /**
228      * Method getProperty.
229      * 
230      * @param index
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
234      * at the given index
235      */
236     public uk.ac.vamsas.objects.core.Property getProperty(
237             final int index)
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) + "]");
242         }
243         
244         return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
245     }
246
247     /**
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.
253      * 
254      * @return this collection as an Array
255      */
256     public uk.ac.vamsas.objects.core.Property[] getProperty(
257     ) {
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);
260     }
261
262     /**
263      * Method getPropertyAsReference.Returns a reference to
264      * '_propertyList'. No type checking is performed on any
265      * modifications to the Vector.
266      * 
267      * @return a reference to the Vector backing this class
268      */
269     public java.util.Vector getPropertyAsReference(
270     ) {
271         return this._propertyList;
272     }
273
274     /**
275      * Method getPropertyCount.
276      * 
277      * @return the size of this collection
278      */
279     public int getPropertyCount(
280     ) {
281         return this._propertyList.size();
282     }
283
284     /**
285      * Returns the value of field 'sequence'.
286      * 
287      * @return the value of field 'Sequence'.
288      */
289     public java.lang.String getSequence(
290     ) {
291         return this._sequence;
292     }
293
294     /**
295      * Returns the value of field 'start'.
296      * 
297      * @return the value of field 'Start'.
298      */
299     public long getStart(
300     ) {
301         return this._start;
302     }
303
304     /**
305      * Method hasEnd.
306      * 
307      * @return true if at least one End has been added
308      */
309     public boolean hasEnd(
310     ) {
311         return this._has_end;
312     }
313
314     /**
315      * Method hasStart.
316      * 
317      * @return true if at least one Start has been added
318      */
319     public boolean hasStart(
320     ) {
321         return this._has_start;
322     }
323
324     /**
325      * Overrides the java.lang.Object.hashCode method.
326      * <p>
327      * The following steps came from <b>Effective Java Programming
328      * Language Guide</b> by Joshua Bloch, Chapter 3
329      * 
330      * @return a hash code value for the object.
331      */
332     public int hashCode(
333     ) {
334         int result = super.hashCode();
335         
336         long tmp;
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();
341         }
342         if (_name != null) {
343            result = 37 * result + _name.hashCode();
344         }
345         if (_description != null) {
346            result = 37 * result + _description.hashCode();
347         }
348         if (_propertyList != null) {
349            result = 37 * result + _propertyList.hashCode();
350         }
351         
352         return result;
353     }
354
355     /**
356      * Method isValid.
357      * 
358      * @return true if this object is valid according to the schema
359      */
360     public boolean isValid(
361     ) {
362         try {
363             validate();
364         } catch (org.exolab.castor.xml.ValidationException vex) {
365             return false;
366         }
367         return true;
368     }
369
370     /**
371      * 
372      * 
373      * @param out
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
378      */
379     public void marshal(
380             final java.io.Writer out)
381     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
382         Marshaller.marshal(this, out);
383     }
384
385     /**
386      * 
387      * 
388      * @param handler
389      * @throws java.io.IOException if an IOException occurs during
390      * marshaling
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
395      */
396     public void marshal(
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);
400     }
401
402     /**
403      */
404     public void removeAllProperty(
405     ) {
406         this._propertyList.clear();
407     }
408
409     /**
410      * Method removeProperty.
411      * 
412      * @param vProperty
413      * @return true if the object was removed from the collection.
414      */
415     public boolean removeProperty(
416             final uk.ac.vamsas.objects.core.Property vProperty) {
417         boolean removed = _propertyList.remove(vProperty);
418         return removed;
419     }
420
421     /**
422      * Method removePropertyAt.
423      * 
424      * @param index
425      * @return the element removed from the collection
426      */
427     public uk.ac.vamsas.objects.core.Property removePropertyAt(
428             final int index) {
429         java.lang.Object obj = this._propertyList.remove(index);
430         return (uk.ac.vamsas.objects.core.Property) obj;
431     }
432
433     /**
434      * Sets the value of field 'description'.
435      * 
436      * @param description the value of field 'description'.
437      */
438     public void setDescription(
439             final java.lang.String description) {
440         this._description = description;
441     }
442
443     /**
444      * Sets the value of field 'end'.
445      * 
446      * @param end the value of field 'end'.
447      */
448     public void setEnd(
449             final long end) {
450         this._end = end;
451         this._has_end = true;
452     }
453
454     /**
455      * Sets the value of field 'name'.
456      * 
457      * @param name the value of field 'name'.
458      */
459     public void setName(
460             final java.lang.String name) {
461         this._name = name;
462     }
463
464     /**
465      * 
466      * 
467      * @param index
468      * @param vProperty
469      * @throws java.lang.IndexOutOfBoundsException if the index
470      * given is outside the bounds of the collection
471      */
472     public void setProperty(
473             final int index,
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) + "]");
479         }
480         
481         this._propertyList.set(index, vProperty);
482     }
483
484     /**
485      * 
486      * 
487      * @param vPropertyArray
488      */
489     public void setProperty(
490             final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
491         //-- copy array
492         _propertyList.clear();
493         
494         for (int i = 0; i < vPropertyArray.length; i++) {
495                 this._propertyList.add(vPropertyArray[i]);
496         }
497     }
498
499     /**
500      * Sets the value of '_propertyList' by copying the given
501      * Vector. All elements will be checked for type safety.
502      * 
503      * @param vPropertyList the Vector to copy.
504      */
505     public void setProperty(
506             final java.util.Vector vPropertyList) {
507         // copy vector
508         this._propertyList.clear();
509         
510         this._propertyList.addAll(vPropertyList);
511     }
512
513     /**
514      * Sets the value of '_propertyList' by setting it to the given
515      * Vector. No type checking is performed.
516      * @deprecated
517      * 
518      * @param propertyVector the Vector to set.
519      */
520     public void setPropertyAsReference(
521             final java.util.Vector propertyVector) {
522         this._propertyList = propertyVector;
523     }
524
525     /**
526      * Sets the value of field 'sequence'.
527      * 
528      * @param sequence the value of field 'sequence'.
529      */
530     public void setSequence(
531             final java.lang.String sequence) {
532         this._sequence = sequence;
533     }
534
535     /**
536      * Sets the value of field 'start'.
537      * 
538      * @param start the value of field 'start'.
539      */
540     public void setStart(
541             final long start) {
542         this._start = start;
543         this._has_start = true;
544     }
545
546     /**
547      * Method unmarshal.
548      * 
549      * @param reader
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
555      */
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);
560     }
561
562     /**
563      * 
564      * 
565      * @throws org.exolab.castor.xml.ValidationException if this
566      * object is an invalid instance according to the schema
567      */
568     public void validate(
569     )
570     throws org.exolab.castor.xml.ValidationException {
571         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
572         validator.validate(this);
573     }
574
575 }