rebult for castor-1.1(vamsas version)
[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      * Field _mappingList.
73      */
74     private java.util.Vector _mappingList;
75
76
77       //----------------/
78      //- Constructors -/
79     //----------------/
80
81     public SequenceType() {
82         super();
83         this._propertyList = new java.util.Vector();
84         this._mappingList = new java.util.Vector();
85     }
86
87
88       //-----------/
89      //- Methods -/
90     //-----------/
91
92     /**
93      * 
94      * 
95      * @param vMapping
96      * @throws java.lang.IndexOutOfBoundsException if the index
97      * given is outside the bounds of the collection
98      */
99     public void addMapping(
100             final uk.ac.vamsas.objects.core.Mapping vMapping)
101     throws java.lang.IndexOutOfBoundsException {
102         this._mappingList.addElement(vMapping);
103     }
104
105     /**
106      * 
107      * 
108      * @param index
109      * @param vMapping
110      * @throws java.lang.IndexOutOfBoundsException if the index
111      * given is outside the bounds of the collection
112      */
113     public void addMapping(
114             final int index,
115             final uk.ac.vamsas.objects.core.Mapping vMapping)
116     throws java.lang.IndexOutOfBoundsException {
117         this._mappingList.add(index, vMapping);
118     }
119
120     /**
121      * 
122      * 
123      * @param vProperty
124      * @throws java.lang.IndexOutOfBoundsException if the index
125      * given is outside the bounds of the collection
126      */
127     public void addProperty(
128             final uk.ac.vamsas.objects.core.Property vProperty)
129     throws java.lang.IndexOutOfBoundsException {
130         this._propertyList.addElement(vProperty);
131     }
132
133     /**
134      * 
135      * 
136      * @param index
137      * @param vProperty
138      * @throws java.lang.IndexOutOfBoundsException if the index
139      * given is outside the bounds of the collection
140      */
141     public void addProperty(
142             final int index,
143             final uk.ac.vamsas.objects.core.Property vProperty)
144     throws java.lang.IndexOutOfBoundsException {
145         this._propertyList.add(index, vProperty);
146     }
147
148     /**
149      */
150     public void deleteEnd(
151     ) {
152         this._has_end= false;
153     }
154
155     /**
156      */
157     public void deleteStart(
158     ) {
159         this._has_start= false;
160     }
161
162     /**
163      * Method enumerateMapping.
164      * 
165      * @return an Enumeration over all
166      * uk.ac.vamsas.objects.core.Mapping elements
167      */
168     public java.util.Enumeration enumerateMapping(
169     ) {
170         return this._mappingList.elements();
171     }
172
173     /**
174      * Method enumerateProperty.
175      * 
176      * @return an Enumeration over all
177      * uk.ac.vamsas.objects.core.Property elements
178      */
179     public java.util.Enumeration enumerateProperty(
180     ) {
181         return this._propertyList.elements();
182     }
183
184     /**
185      * Overrides the java.lang.Object.equals method.
186      * 
187      * @param obj
188      * @return true if the objects are equal.
189      */
190     public boolean equals(
191             final java.lang.Object obj) {
192         if ( this == obj )
193             return true;
194         
195         if (super.equals(obj)==false)
196             return false;
197         
198         if (obj instanceof SequenceType) {
199         
200             SequenceType temp = (SequenceType)obj;
201             if (this._start != temp._start)
202                 return false;
203             if (this._has_start != temp._has_start)
204                 return false;
205             if (this._end != temp._end)
206                 return false;
207             if (this._has_end != temp._has_end)
208                 return false;
209             if (this._sequence != null) {
210                 if (temp._sequence == null) return false;
211                 else if (!(this._sequence.equals(temp._sequence))) 
212                     return false;
213             }
214             else if (temp._sequence != null)
215                 return false;
216             if (this._name != null) {
217                 if (temp._name == null) return false;
218                 else if (!(this._name.equals(temp._name))) 
219                     return false;
220             }
221             else if (temp._name != null)
222                 return false;
223             if (this._description != null) {
224                 if (temp._description == null) return false;
225                 else if (!(this._description.equals(temp._description))) 
226                     return false;
227             }
228             else if (temp._description != null)
229                 return false;
230             if (this._propertyList != null) {
231                 if (temp._propertyList == null) return false;
232                 else if (!(this._propertyList.equals(temp._propertyList))) 
233                     return false;
234             }
235             else if (temp._propertyList != null)
236                 return false;
237             if (this._mappingList != null) {
238                 if (temp._mappingList == null) return false;
239                 else if (!(this._mappingList.equals(temp._mappingList))) 
240                     return false;
241             }
242             else if (temp._mappingList != null)
243                 return false;
244             return true;
245         }
246         return false;
247     }
248
249     /**
250      * Returns the value of field 'description'.
251      * 
252      * @return the value of field 'Description'.
253      */
254     public java.lang.String getDescription(
255     ) {
256         return this._description;
257     }
258
259     /**
260      * Returns the value of field 'end'.
261      * 
262      * @return the value of field 'End'.
263      */
264     public long getEnd(
265     ) {
266         return this._end;
267     }
268
269     /**
270      * Method getMapping.
271      * 
272      * @param index
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
276      * at the given index
277      */
278     public uk.ac.vamsas.objects.core.Mapping getMapping(
279             final int index)
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) + "]");
284         }
285         
286         return (uk.ac.vamsas.objects.core.Mapping) _mappingList.get(index);
287     }
288
289     /**
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.
295      * 
296      * @return this collection as an Array
297      */
298     public uk.ac.vamsas.objects.core.Mapping[] getMapping(
299     ) {
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);
302     }
303
304     /**
305      * Method getMappingAsReference.Returns a reference to
306      * '_mappingList'. No type checking is performed on any
307      * modifications to the Vector.
308      * 
309      * @return a reference to the Vector backing this class
310      */
311     public java.util.Vector getMappingAsReference(
312     ) {
313         return this._mappingList;
314     }
315
316     /**
317      * Method getMappingCount.
318      * 
319      * @return the size of this collection
320      */
321     public int getMappingCount(
322     ) {
323         return this._mappingList.size();
324     }
325
326     /**
327      * Returns the value of field 'name'.
328      * 
329      * @return the value of field 'Name'.
330      */
331     public java.lang.String getName(
332     ) {
333         return this._name;
334     }
335
336     /**
337      * Method getProperty.
338      * 
339      * @param index
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
343      * at the given index
344      */
345     public uk.ac.vamsas.objects.core.Property getProperty(
346             final int index)
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) + "]");
351         }
352         
353         return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
354     }
355
356     /**
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.
362      * 
363      * @return this collection as an Array
364      */
365     public uk.ac.vamsas.objects.core.Property[] getProperty(
366     ) {
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);
369     }
370
371     /**
372      * Method getPropertyAsReference.Returns a reference to
373      * '_propertyList'. No type checking is performed on any
374      * modifications to the Vector.
375      * 
376      * @return a reference to the Vector backing this class
377      */
378     public java.util.Vector getPropertyAsReference(
379     ) {
380         return this._propertyList;
381     }
382
383     /**
384      * Method getPropertyCount.
385      * 
386      * @return the size of this collection
387      */
388     public int getPropertyCount(
389     ) {
390         return this._propertyList.size();
391     }
392
393     /**
394      * Returns the value of field 'sequence'.
395      * 
396      * @return the value of field 'Sequence'.
397      */
398     public java.lang.String getSequence(
399     ) {
400         return this._sequence;
401     }
402
403     /**
404      * Returns the value of field 'start'.
405      * 
406      * @return the value of field 'Start'.
407      */
408     public long getStart(
409     ) {
410         return this._start;
411     }
412
413     /**
414      * Method hasEnd.
415      * 
416      * @return true if at least one End has been added
417      */
418     public boolean hasEnd(
419     ) {
420         return this._has_end;
421     }
422
423     /**
424      * Method hasStart.
425      * 
426      * @return true if at least one Start has been added
427      */
428     public boolean hasStart(
429     ) {
430         return this._has_start;
431     }
432
433     /**
434      * Overrides the java.lang.Object.hashCode method.
435      * <p>
436      * The following steps came from <b>Effective Java Programming
437      * Language Guide</b> by Joshua Bloch, Chapter 3
438      * 
439      * @return a hash code value for the object.
440      */
441     public int hashCode(
442     ) {
443         int result = super.hashCode();
444         
445         long tmp;
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();
450         }
451         if (_name != null) {
452            result = 37 * result + _name.hashCode();
453         }
454         if (_description != null) {
455            result = 37 * result + _description.hashCode();
456         }
457         if (_propertyList != null) {
458            result = 37 * result + _propertyList.hashCode();
459         }
460         if (_mappingList != null) {
461            result = 37 * result + _mappingList.hashCode();
462         }
463         
464         return result;
465     }
466
467     /**
468      * Method isValid.
469      * 
470      * @return true if this object is valid according to the schema
471      */
472     public boolean isValid(
473     ) {
474         try {
475             validate();
476         } catch (org.exolab.castor.xml.ValidationException vex) {
477             return false;
478         }
479         return true;
480     }
481
482     /**
483      * 
484      * 
485      * @param out
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
490      */
491     public void marshal(
492             final java.io.Writer out)
493     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
494         Marshaller.marshal(this, out);
495     }
496
497     /**
498      * 
499      * 
500      * @param handler
501      * @throws java.io.IOException if an IOException occurs during
502      * marshaling
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
507      */
508     public void marshal(
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);
512     }
513
514     /**
515      */
516     public void removeAllMapping(
517     ) {
518         this._mappingList.clear();
519     }
520
521     /**
522      */
523     public void removeAllProperty(
524     ) {
525         this._propertyList.clear();
526     }
527
528     /**
529      * Method removeMapping.
530      * 
531      * @param vMapping
532      * @return true if the object was removed from the collection.
533      */
534     public boolean removeMapping(
535             final uk.ac.vamsas.objects.core.Mapping vMapping) {
536         boolean removed = _mappingList.remove(vMapping);
537         return removed;
538     }
539
540     /**
541      * Method removeMappingAt.
542      * 
543      * @param index
544      * @return the element removed from the collection
545      */
546     public uk.ac.vamsas.objects.core.Mapping removeMappingAt(
547             final int index) {
548         java.lang.Object obj = this._mappingList.remove(index);
549         return (uk.ac.vamsas.objects.core.Mapping) obj;
550     }
551
552     /**
553      * Method removeProperty.
554      * 
555      * @param vProperty
556      * @return true if the object was removed from the collection.
557      */
558     public boolean removeProperty(
559             final uk.ac.vamsas.objects.core.Property vProperty) {
560         boolean removed = _propertyList.remove(vProperty);
561         return removed;
562     }
563
564     /**
565      * Method removePropertyAt.
566      * 
567      * @param index
568      * @return the element removed from the collection
569      */
570     public uk.ac.vamsas.objects.core.Property removePropertyAt(
571             final int index) {
572         java.lang.Object obj = this._propertyList.remove(index);
573         return (uk.ac.vamsas.objects.core.Property) obj;
574     }
575
576     /**
577      * Sets the value of field 'description'.
578      * 
579      * @param description the value of field 'description'.
580      */
581     public void setDescription(
582             final java.lang.String description) {
583         this._description = description;
584     }
585
586     /**
587      * Sets the value of field 'end'.
588      * 
589      * @param end the value of field 'end'.
590      */
591     public void setEnd(
592             final long end) {
593         this._end = end;
594         this._has_end = true;
595     }
596
597     /**
598      * 
599      * 
600      * @param index
601      * @param vMapping
602      * @throws java.lang.IndexOutOfBoundsException if the index
603      * given is outside the bounds of the collection
604      */
605     public void setMapping(
606             final int index,
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) + "]");
612         }
613         
614         this._mappingList.set(index, vMapping);
615     }
616
617     /**
618      * 
619      * 
620      * @param vMappingArray
621      */
622     public void setMapping(
623             final uk.ac.vamsas.objects.core.Mapping[] vMappingArray) {
624         //-- copy array
625         _mappingList.clear();
626         
627         for (int i = 0; i < vMappingArray.length; i++) {
628                 this._mappingList.add(vMappingArray[i]);
629         }
630     }
631
632     /**
633      * Sets the value of '_mappingList' by copying the given
634      * Vector. All elements will be checked for type safety.
635      * 
636      * @param vMappingList the Vector to copy.
637      */
638     public void setMapping(
639             final java.util.Vector vMappingList) {
640         // copy vector
641         this._mappingList.clear();
642         
643         this._mappingList.addAll(vMappingList);
644     }
645
646     /**
647      * Sets the value of '_mappingList' by setting it to the given
648      * Vector. No type checking is performed.
649      * @deprecated
650      * 
651      * @param mappingVector the Vector to set.
652      */
653     public void setMappingAsReference(
654             final java.util.Vector mappingVector) {
655         this._mappingList = mappingVector;
656     }
657
658     /**
659      * Sets the value of field 'name'.
660      * 
661      * @param name the value of field 'name'.
662      */
663     public void setName(
664             final java.lang.String name) {
665         this._name = name;
666     }
667
668     /**
669      * 
670      * 
671      * @param index
672      * @param vProperty
673      * @throws java.lang.IndexOutOfBoundsException if the index
674      * given is outside the bounds of the collection
675      */
676     public void setProperty(
677             final int index,
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) + "]");
683         }
684         
685         this._propertyList.set(index, vProperty);
686     }
687
688     /**
689      * 
690      * 
691      * @param vPropertyArray
692      */
693     public void setProperty(
694             final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
695         //-- copy array
696         _propertyList.clear();
697         
698         for (int i = 0; i < vPropertyArray.length; i++) {
699                 this._propertyList.add(vPropertyArray[i]);
700         }
701     }
702
703     /**
704      * Sets the value of '_propertyList' by copying the given
705      * Vector. All elements will be checked for type safety.
706      * 
707      * @param vPropertyList the Vector to copy.
708      */
709     public void setProperty(
710             final java.util.Vector vPropertyList) {
711         // copy vector
712         this._propertyList.clear();
713         
714         this._propertyList.addAll(vPropertyList);
715     }
716
717     /**
718      * Sets the value of '_propertyList' by setting it to the given
719      * Vector. No type checking is performed.
720      * @deprecated
721      * 
722      * @param propertyVector the Vector to set.
723      */
724     public void setPropertyAsReference(
725             final java.util.Vector propertyVector) {
726         this._propertyList = propertyVector;
727     }
728
729     /**
730      * Sets the value of field 'sequence'.
731      * 
732      * @param sequence the value of field 'sequence'.
733      */
734     public void setSequence(
735             final java.lang.String sequence) {
736         this._sequence = sequence;
737     }
738
739     /**
740      * Sets the value of field 'start'.
741      * 
742      * @param start the value of field 'start'.
743      */
744     public void setStart(
745             final long start) {
746         this._start = start;
747         this._has_start = true;
748     }
749
750     /**
751      * Method unmarshal.
752      * 
753      * @param reader
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
759      */
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);
764     }
765
766     /**
767      * 
768      * 
769      * @throws org.exolab.castor.xml.ValidationException if this
770      * object is an invalid instance according to the schema
771      */
772     public void validate(
773     )
774     throws org.exolab.castor.xml.ValidationException {
775         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
776         validator.validate(this);
777     }
778
779 }