autogenerated java classes for current schema
[vamsas.git] / src / org / vamsas / objects / core / RangeType.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M2</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.Reader;
15 import java.io.Serializable;
16 import java.io.Writer;
17 import java.util.Enumeration;
18 import java.util.Vector;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22
23 /**
24  * Specify an ordered set of positions and/or regions on the
25  * principle
26  *  dimension of some associated vamsas object
27  *  
28  *  Keeping to jaxb-1.0 specification for the moment - this
29  *  choice should become a substitution group when we use
30  *  jaxb-2.0 capable bindings
31  *  
32  * 
33  * @version $Revision$ $Date$
34  */
35 public abstract class RangeType extends org.vamsas.client.Vobject 
36 implements java.io.Serializable
37 {
38
39
40       //--------------------------/
41      //- Class/Member Variables -/
42     //--------------------------/
43
44     /**
45      * Internal choice value storage
46      */
47     private java.lang.Object _choiceValue;
48
49     /**
50      * a position within the associated object's
51      *  coordinate system
52      *  
53      */
54     private java.util.Vector _posList;
55
56     /**
57      * a region from start to end, with flag for
58      *  inclusivity of terminii
59      *  
60      */
61     private java.util.Vector _segList;
62
63
64       //----------------/
65      //- Constructors -/
66     //----------------/
67
68     public RangeType() 
69      {
70         super();
71         _posList = new Vector();
72         _segList = new Vector();
73     } //-- org.vamsas.objects.core.RangeType()
74
75
76       //-----------/
77      //- Methods -/
78     //-----------/
79
80     /**
81      * Method addPos
82      * 
83      * 
84      * 
85      * @param vPos
86      */
87     public void addPos(org.vamsas.objects.core.Pos vPos)
88         throws java.lang.IndexOutOfBoundsException
89     {
90         _posList.addElement(vPos);
91     } //-- void addPos(org.vamsas.objects.core.Pos) 
92
93     /**
94      * Method addPos
95      * 
96      * 
97      * 
98      * @param index
99      * @param vPos
100      */
101     public void addPos(int index, org.vamsas.objects.core.Pos vPos)
102         throws java.lang.IndexOutOfBoundsException
103     {
104         _posList.insertElementAt(vPos, index);
105     } //-- void addPos(int, org.vamsas.objects.core.Pos) 
106
107     /**
108      * Method addSeg
109      * 
110      * 
111      * 
112      * @param vSeg
113      */
114     public void addSeg(org.vamsas.objects.core.Seg vSeg)
115         throws java.lang.IndexOutOfBoundsException
116     {
117         _segList.addElement(vSeg);
118     } //-- void addSeg(org.vamsas.objects.core.Seg) 
119
120     /**
121      * Method addSeg
122      * 
123      * 
124      * 
125      * @param index
126      * @param vSeg
127      */
128     public void addSeg(int index, org.vamsas.objects.core.Seg vSeg)
129         throws java.lang.IndexOutOfBoundsException
130     {
131         _segList.insertElementAt(vSeg, index);
132     } //-- void addSeg(int, org.vamsas.objects.core.Seg) 
133
134     /**
135      * Method enumeratePos
136      * 
137      * 
138      * 
139      * @return Enumeration
140      */
141     public java.util.Enumeration enumeratePos()
142     {
143         return _posList.elements();
144     } //-- java.util.Enumeration enumeratePos() 
145
146     /**
147      * Method enumerateSeg
148      * 
149      * 
150      * 
151      * @return Enumeration
152      */
153     public java.util.Enumeration enumerateSeg()
154     {
155         return _segList.elements();
156     } //-- java.util.Enumeration enumerateSeg() 
157
158     /**
159      * Note: hashCode() has not been overriden
160      * 
161      * @param obj
162      * @return boolean
163      */
164     public boolean equals(java.lang.Object obj)
165     {
166         if ( this == obj )
167             return true;
168         
169         if (super.equals(obj)==false)
170             return false;
171         
172         if (obj instanceof RangeType) {
173         
174             RangeType temp = (RangeType)obj;
175             if (this._choiceValue != null) {
176                 if (temp._choiceValue == null) return false;
177                 else if (!(this._choiceValue.equals(temp._choiceValue))) 
178                     return false;
179             }
180             else if (temp._choiceValue != null)
181                 return false;
182             if (this._posList != null) {
183                 if (temp._posList == null) return false;
184                 else if (!(this._posList.equals(temp._posList))) 
185                     return false;
186             }
187             else if (temp._posList != null)
188                 return false;
189             if (this._segList != null) {
190                 if (temp._segList == null) return false;
191                 else if (!(this._segList.equals(temp._segList))) 
192                     return false;
193             }
194             else if (temp._segList != null)
195                 return false;
196             return true;
197         }
198         return false;
199     } //-- boolean equals(java.lang.Object) 
200
201     /**
202      * Returns the value of field 'choiceValue'. The field
203      * 'choiceValue' has the following description: Internal choice
204      * value storage
205      * 
206      * @return Object
207      * @return the value of field 'choiceValue'.
208      */
209     public java.lang.Object getChoiceValue()
210     {
211         return this._choiceValue;
212     } //-- java.lang.Object getChoiceValue() 
213
214     /**
215      * Method getPos
216      * 
217      * 
218      * 
219      * @param index
220      * @return Pos
221      */
222     public org.vamsas.objects.core.Pos getPos(int index)
223         throws java.lang.IndexOutOfBoundsException
224     {
225         //-- check bounds for index
226         if ((index < 0) || (index > _posList.size())) {
227             throw new IndexOutOfBoundsException("getPos: Index value '"+index+"' not in range [0.."+_posList.size()+ "]");
228         }
229         
230         return (org.vamsas.objects.core.Pos) _posList.elementAt(index);
231     } //-- org.vamsas.objects.core.Pos getPos(int) 
232
233     /**
234      * Method getPos
235      * 
236      * 
237      * 
238      * @return Pos
239      */
240     public org.vamsas.objects.core.Pos[] getPos()
241     {
242         int size = _posList.size();
243         org.vamsas.objects.core.Pos[] mArray = new org.vamsas.objects.core.Pos[size];
244         for (int index = 0; index < size; index++) {
245             mArray[index] = (org.vamsas.objects.core.Pos) _posList.elementAt(index);
246         }
247         return mArray;
248     } //-- org.vamsas.objects.core.Pos[] getPos() 
249
250     /**
251      * Method getPosCount
252      * 
253      * 
254      * 
255      * @return int
256      */
257     public int getPosCount()
258     {
259         return _posList.size();
260     } //-- int getPosCount() 
261
262     /**
263      * Method getSeg
264      * 
265      * 
266      * 
267      * @param index
268      * @return Seg
269      */
270     public org.vamsas.objects.core.Seg getSeg(int index)
271         throws java.lang.IndexOutOfBoundsException
272     {
273         //-- check bounds for index
274         if ((index < 0) || (index > _segList.size())) {
275             throw new IndexOutOfBoundsException("getSeg: Index value '"+index+"' not in range [0.."+_segList.size()+ "]");
276         }
277         
278         return (org.vamsas.objects.core.Seg) _segList.elementAt(index);
279     } //-- org.vamsas.objects.core.Seg getSeg(int) 
280
281     /**
282      * Method getSeg
283      * 
284      * 
285      * 
286      * @return Seg
287      */
288     public org.vamsas.objects.core.Seg[] getSeg()
289     {
290         int size = _segList.size();
291         org.vamsas.objects.core.Seg[] mArray = new org.vamsas.objects.core.Seg[size];
292         for (int index = 0; index < size; index++) {
293             mArray[index] = (org.vamsas.objects.core.Seg) _segList.elementAt(index);
294         }
295         return mArray;
296     } //-- org.vamsas.objects.core.Seg[] getSeg() 
297
298     /**
299      * Method getSegCount
300      * 
301      * 
302      * 
303      * @return int
304      */
305     public int getSegCount()
306     {
307         return _segList.size();
308     } //-- int getSegCount() 
309
310     /**
311      * Method isValid
312      * 
313      * 
314      * 
315      * @return boolean
316      */
317     public boolean isValid()
318     {
319         try {
320             validate();
321         }
322         catch (org.exolab.castor.xml.ValidationException vex) {
323             return false;
324         }
325         return true;
326     } //-- boolean isValid() 
327
328     /**
329      * Method removeAllPos
330      * 
331      */
332     public void removeAllPos()
333     {
334         _posList.removeAllElements();
335     } //-- void removeAllPos() 
336
337     /**
338      * Method removeAllSeg
339      * 
340      */
341     public void removeAllSeg()
342     {
343         _segList.removeAllElements();
344     } //-- void removeAllSeg() 
345
346     /**
347      * Method removePos
348      * 
349      * 
350      * 
351      * @param index
352      * @return Pos
353      */
354     public org.vamsas.objects.core.Pos removePos(int index)
355     {
356         java.lang.Object obj = _posList.elementAt(index);
357         _posList.removeElementAt(index);
358         return (org.vamsas.objects.core.Pos) obj;
359     } //-- org.vamsas.objects.core.Pos removePos(int) 
360
361     /**
362      * Method removeSeg
363      * 
364      * 
365      * 
366      * @param index
367      * @return Seg
368      */
369     public org.vamsas.objects.core.Seg removeSeg(int index)
370     {
371         java.lang.Object obj = _segList.elementAt(index);
372         _segList.removeElementAt(index);
373         return (org.vamsas.objects.core.Seg) obj;
374     } //-- org.vamsas.objects.core.Seg removeSeg(int) 
375
376     /**
377      * Method setPos
378      * 
379      * 
380      * 
381      * @param index
382      * @param vPos
383      */
384     public void setPos(int index, org.vamsas.objects.core.Pos vPos)
385         throws java.lang.IndexOutOfBoundsException
386     {
387         //-- check bounds for index
388         if ((index < 0) || (index > _posList.size())) {
389             throw new IndexOutOfBoundsException("setPos: Index value '"+index+"' not in range [0.."+_posList.size()+ "]");
390         }
391         _posList.setElementAt(vPos, index);
392     } //-- void setPos(int, org.vamsas.objects.core.Pos) 
393
394     /**
395      * Method setPos
396      * 
397      * 
398      * 
399      * @param posArray
400      */
401     public void setPos(org.vamsas.objects.core.Pos[] posArray)
402     {
403         //-- copy array
404         _posList.removeAllElements();
405         for (int i = 0; i < posArray.length; i++) {
406             _posList.addElement(posArray[i]);
407         }
408     } //-- void setPos(org.vamsas.objects.core.Pos) 
409
410     /**
411      * Method setSeg
412      * 
413      * 
414      * 
415      * @param index
416      * @param vSeg
417      */
418     public void setSeg(int index, org.vamsas.objects.core.Seg vSeg)
419         throws java.lang.IndexOutOfBoundsException
420     {
421         //-- check bounds for index
422         if ((index < 0) || (index > _segList.size())) {
423             throw new IndexOutOfBoundsException("setSeg: Index value '"+index+"' not in range [0.."+_segList.size()+ "]");
424         }
425         _segList.setElementAt(vSeg, index);
426     } //-- void setSeg(int, org.vamsas.objects.core.Seg) 
427
428     /**
429      * Method setSeg
430      * 
431      * 
432      * 
433      * @param segArray
434      */
435     public void setSeg(org.vamsas.objects.core.Seg[] segArray)
436     {
437         //-- copy array
438         _segList.removeAllElements();
439         for (int i = 0; i < segArray.length; i++) {
440             _segList.addElement(segArray[i]);
441         }
442     } //-- void setSeg(org.vamsas.objects.core.Seg) 
443
444     /**
445      * Method validate
446      * 
447      */
448     public void validate()
449         throws org.exolab.castor.xml.ValidationException
450     {
451         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
452         validator.validate(this);
453     } //-- void validate() 
454
455 }