4c16ba3155163f267a1eea11598e8adcfa545cba
[vamsas.git] / src / org / vamsas / objects / core / SequenceType.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package org.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26 /**
27  * Class SequenceType.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class SequenceType extends org.vamsas.client.object 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _start
42      */
43     private int _start;
44
45     /**
46      * keeps track of state for field: _start
47      */
48     private boolean _has_start;
49
50     /**
51      * Field _end
52      */
53     private int _end;
54
55     /**
56      * keeps track of state for field: _end
57      */
58     private boolean _has_end;
59
60     /**
61      * Field _sequence
62      */
63     private java.lang.String _sequence;
64
65     /**
66      * Field _name
67      */
68     private java.lang.String _name;
69
70     /**
71      * Field _dbRefList
72      */
73     private java.util.Vector _dbRefList;
74
75
76       //----------------/
77      //- Constructors -/
78     //----------------/
79
80     public SequenceType() 
81      {
82         super();
83         _dbRefList = new Vector();
84     } //-- org.vamsas.objects.core.SequenceType()
85
86
87       //-----------/
88      //- Methods -/
89     //-----------/
90
91     /**
92      * Method addDbRef
93      * 
94      * 
95      * 
96      * @param vDbRef
97      */
98     public void addDbRef(org.vamsas.objects.core.DbRef vDbRef)
99         throws java.lang.IndexOutOfBoundsException
100     {
101         _dbRefList.addElement(vDbRef);
102     } //-- void addDbRef(org.vamsas.objects.core.DbRef) 
103
104     /**
105      * Method addDbRef
106      * 
107      * 
108      * 
109      * @param index
110      * @param vDbRef
111      */
112     public void addDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
113         throws java.lang.IndexOutOfBoundsException
114     {
115         _dbRefList.insertElementAt(vDbRef, index);
116     } //-- void addDbRef(int, org.vamsas.objects.core.DbRef) 
117
118     /**
119      * Method deleteEnd
120      * 
121      */
122     public void deleteEnd()
123     {
124         this._has_end= false;
125     } //-- void deleteEnd() 
126
127     /**
128      * Method deleteStart
129      * 
130      */
131     public void deleteStart()
132     {
133         this._has_start= false;
134     } //-- void deleteStart() 
135
136     /**
137      * Method enumerateDbRef
138      * 
139      * 
140      * 
141      * @return Enumeration
142      */
143     public java.util.Enumeration enumerateDbRef()
144     {
145         return _dbRefList.elements();
146     } //-- java.util.Enumeration enumerateDbRef() 
147
148     /**
149      * Note: hashCode() has not been overriden
150      * 
151      * @param obj
152      * @return boolean
153      */
154     public boolean equals(java.lang.Object obj)
155     {
156         if ( this == obj )
157             return true;
158         
159         if (super.equals(obj)==false)
160             return false;
161         
162         if (obj instanceof SequenceType) {
163         
164             SequenceType temp = (SequenceType)obj;
165             if (this._start != temp._start)
166                 return false;
167             if (this._has_start != temp._has_start)
168                 return false;
169             if (this._end != temp._end)
170                 return false;
171             if (this._has_end != temp._has_end)
172                 return false;
173             if (this._sequence != null) {
174                 if (temp._sequence == null) return false;
175                 else if (!(this._sequence.equals(temp._sequence))) 
176                     return false;
177             }
178             else if (temp._sequence != null)
179                 return false;
180             if (this._name != null) {
181                 if (temp._name == null) return false;
182                 else if (!(this._name.equals(temp._name))) 
183                     return false;
184             }
185             else if (temp._name != null)
186                 return false;
187             if (this._dbRefList != null) {
188                 if (temp._dbRefList == null) return false;
189                 else if (!(this._dbRefList.equals(temp._dbRefList))) 
190                     return false;
191             }
192             else if (temp._dbRefList != null)
193                 return false;
194             return true;
195         }
196         return false;
197     } //-- boolean equals(java.lang.Object) 
198
199     /**
200      * Method getDbRef
201      * 
202      * 
203      * 
204      * @param index
205      * @return DbRef
206      */
207     public org.vamsas.objects.core.DbRef getDbRef(int index)
208         throws java.lang.IndexOutOfBoundsException
209     {
210         //-- check bounds for index
211         if ((index < 0) || (index > _dbRefList.size())) {
212             throw new IndexOutOfBoundsException("getDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
213         }
214         
215         return (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
216     } //-- org.vamsas.objects.core.DbRef getDbRef(int) 
217
218     /**
219      * Method getDbRef
220      * 
221      * 
222      * 
223      * @return DbRef
224      */
225     public org.vamsas.objects.core.DbRef[] getDbRef()
226     {
227         int size = _dbRefList.size();
228         org.vamsas.objects.core.DbRef[] mArray = new org.vamsas.objects.core.DbRef[size];
229         for (int index = 0; index < size; index++) {
230             mArray[index] = (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
231         }
232         return mArray;
233     } //-- org.vamsas.objects.core.DbRef[] getDbRef() 
234
235     /**
236      * Method getDbRefCount
237      * 
238      * 
239      * 
240      * @return int
241      */
242     public int getDbRefCount()
243     {
244         return _dbRefList.size();
245     } //-- int getDbRefCount() 
246
247     /**
248      * Returns the value of field 'end'.
249      * 
250      * @return int
251      * @return the value of field 'end'.
252      */
253     public int getEnd()
254     {
255         return this._end;
256     } //-- int getEnd() 
257
258     /**
259      * Returns the value of field 'name'.
260      * 
261      * @return String
262      * @return the value of field 'name'.
263      */
264     public java.lang.String getName()
265     {
266         return this._name;
267     } //-- java.lang.String getName() 
268
269     /**
270      * Returns the value of field 'sequence'.
271      * 
272      * @return String
273      * @return the value of field 'sequence'.
274      */
275     public java.lang.String getSequence()
276     {
277         return this._sequence;
278     } //-- java.lang.String getSequence() 
279
280     /**
281      * Returns the value of field 'start'.
282      * 
283      * @return int
284      * @return the value of field 'start'.
285      */
286     public int getStart()
287     {
288         return this._start;
289     } //-- int getStart() 
290
291     /**
292      * Method hasEnd
293      * 
294      * 
295      * 
296      * @return boolean
297      */
298     public boolean hasEnd()
299     {
300         return this._has_end;
301     } //-- boolean hasEnd() 
302
303     /**
304      * Method hasStart
305      * 
306      * 
307      * 
308      * @return boolean
309      */
310     public boolean hasStart()
311     {
312         return this._has_start;
313     } //-- boolean hasStart() 
314
315     /**
316      * Method isValid
317      * 
318      * 
319      * 
320      * @return boolean
321      */
322     public boolean isValid()
323     {
324         try {
325             validate();
326         }
327         catch (org.exolab.castor.xml.ValidationException vex) {
328             return false;
329         }
330         return true;
331     } //-- boolean isValid() 
332
333     /**
334      * Method marshal
335      * 
336      * 
337      * 
338      * @param out
339      */
340     public void marshal(java.io.Writer out)
341         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
342     {
343         
344         Marshaller.marshal(this, out);
345     } //-- void marshal(java.io.Writer) 
346
347     /**
348      * Method marshal
349      * 
350      * 
351      * 
352      * @param handler
353      */
354     public void marshal(org.xml.sax.ContentHandler handler)
355         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
356     {
357         
358         Marshaller.marshal(this, handler);
359     } //-- void marshal(org.xml.sax.ContentHandler) 
360
361     /**
362      * Method removeAllDbRef
363      * 
364      */
365     public void removeAllDbRef()
366     {
367         _dbRefList.removeAllElements();
368     } //-- void removeAllDbRef() 
369
370     /**
371      * Method removeDbRef
372      * 
373      * 
374      * 
375      * @param index
376      * @return DbRef
377      */
378     public org.vamsas.objects.core.DbRef removeDbRef(int index)
379     {
380         java.lang.Object obj = _dbRefList.elementAt(index);
381         _dbRefList.removeElementAt(index);
382         return (org.vamsas.objects.core.DbRef) obj;
383     } //-- org.vamsas.objects.core.DbRef removeDbRef(int) 
384
385     /**
386      * Method setDbRef
387      * 
388      * 
389      * 
390      * @param index
391      * @param vDbRef
392      */
393     public void setDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
394         throws java.lang.IndexOutOfBoundsException
395     {
396         //-- check bounds for index
397         if ((index < 0) || (index > _dbRefList.size())) {
398             throw new IndexOutOfBoundsException("setDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
399         }
400         _dbRefList.setElementAt(vDbRef, index);
401     } //-- void setDbRef(int, org.vamsas.objects.core.DbRef) 
402
403     /**
404      * Method setDbRef
405      * 
406      * 
407      * 
408      * @param dbRefArray
409      */
410     public void setDbRef(org.vamsas.objects.core.DbRef[] dbRefArray)
411     {
412         //-- copy array
413         _dbRefList.removeAllElements();
414         for (int i = 0; i < dbRefArray.length; i++) {
415             _dbRefList.addElement(dbRefArray[i]);
416         }
417     } //-- void setDbRef(org.vamsas.objects.core.DbRef) 
418
419     /**
420      * Sets the value of field 'end'.
421      * 
422      * @param end the value of field 'end'.
423      */
424     public void setEnd(int end)
425     {
426         this._end = end;
427         this._has_end = true;
428     } //-- void setEnd(int) 
429
430     /**
431      * Sets the value of field 'name'.
432      * 
433      * @param name the value of field 'name'.
434      */
435     public void setName(java.lang.String name)
436     {
437         this._name = name;
438     } //-- void setName(java.lang.String) 
439
440     /**
441      * Sets the value of field 'sequence'.
442      * 
443      * @param sequence the value of field 'sequence'.
444      */
445     public void setSequence(java.lang.String sequence)
446     {
447         this._sequence = sequence;
448     } //-- void setSequence(java.lang.String) 
449
450     /**
451      * Sets the value of field 'start'.
452      * 
453      * @param start the value of field 'start'.
454      */
455     public void setStart(int start)
456     {
457         this._start = start;
458         this._has_start = true;
459     } //-- void setStart(int) 
460
461     /**
462      * Method unmarshal
463      * 
464      * 
465      * 
466      * @param reader
467      * @return SequenceType
468      */
469     public static org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
470         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
471     {
472         return (org.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(org.vamsas.objects.core.SequenceType.class, reader);
473     } //-- org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader) 
474
475     /**
476      * Method validate
477      * 
478      */
479     public void validate()
480         throws org.exolab.castor.xml.ValidationException
481     {
482         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
483         validator.validate(this);
484     } //-- void validate() 
485
486 }