autogenerated java classes for current schema
[vamsas.git] / src / org / vamsas / objects / core / Sequence.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.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 Sequence.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class Sequence extends org.vamsas.objects.core.SequenceType 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Primary Key for vamsas
42      *  object referencing
43      *  
44      */
45     private java.lang.String _id;
46
47     /**
48      * symbol class for sequence
49      *  
50      */
51     private java.lang.String _dictionary;
52
53     /**
54      * Store a list of database
55      *  references for this
56      *  sequence record - with
57      *  optional mapping from
58      *  database sequence to the
59      *  given sequence record
60      *  
61      */
62     private java.util.Vector _dbRefList;
63
64
65       //----------------/
66      //- Constructors -/
67     //----------------/
68
69     public Sequence() 
70      {
71         super();
72         _dbRefList = new Vector();
73     } //-- org.vamsas.objects.core.Sequence()
74
75
76       //-----------/
77      //- Methods -/
78     //-----------/
79
80     /**
81      * Method addDbRef
82      * 
83      * 
84      * 
85      * @param vDbRef
86      */
87     public void addDbRef(org.vamsas.objects.core.DbRef vDbRef)
88         throws java.lang.IndexOutOfBoundsException
89     {
90         _dbRefList.addElement(vDbRef);
91     } //-- void addDbRef(org.vamsas.objects.core.DbRef) 
92
93     /**
94      * Method addDbRef
95      * 
96      * 
97      * 
98      * @param index
99      * @param vDbRef
100      */
101     public void addDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
102         throws java.lang.IndexOutOfBoundsException
103     {
104         _dbRefList.insertElementAt(vDbRef, index);
105     } //-- void addDbRef(int, org.vamsas.objects.core.DbRef) 
106
107     /**
108      * Method enumerateDbRef
109      * 
110      * 
111      * 
112      * @return Enumeration
113      */
114     public java.util.Enumeration enumerateDbRef()
115     {
116         return _dbRefList.elements();
117     } //-- java.util.Enumeration enumerateDbRef() 
118
119     /**
120      * Note: hashCode() has not been overriden
121      * 
122      * @param obj
123      * @return boolean
124      */
125     public boolean equals(java.lang.Object obj)
126     {
127         if ( this == obj )
128             return true;
129         
130         if (super.equals(obj)==false)
131             return false;
132         
133         if (obj instanceof Sequence) {
134         
135             Sequence temp = (Sequence)obj;
136             if (this._id != null) {
137                 if (temp._id == null) return false;
138                 else if (!(this._id.equals(temp._id))) 
139                     return false;
140             }
141             else if (temp._id != null)
142                 return false;
143             if (this._dictionary != null) {
144                 if (temp._dictionary == null) return false;
145                 else if (!(this._dictionary.equals(temp._dictionary))) 
146                     return false;
147             }
148             else if (temp._dictionary != null)
149                 return false;
150             if (this._dbRefList != null) {
151                 if (temp._dbRefList == null) return false;
152                 else if (!(this._dbRefList.equals(temp._dbRefList))) 
153                     return false;
154             }
155             else if (temp._dbRefList != null)
156                 return false;
157             return true;
158         }
159         return false;
160     } //-- boolean equals(java.lang.Object) 
161
162     /**
163      * Method getDbRef
164      * 
165      * 
166      * 
167      * @param index
168      * @return DbRef
169      */
170     public org.vamsas.objects.core.DbRef getDbRef(int index)
171         throws java.lang.IndexOutOfBoundsException
172     {
173         //-- check bounds for index
174         if ((index < 0) || (index > _dbRefList.size())) {
175             throw new IndexOutOfBoundsException("getDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
176         }
177         
178         return (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
179     } //-- org.vamsas.objects.core.DbRef getDbRef(int) 
180
181     /**
182      * Method getDbRef
183      * 
184      * 
185      * 
186      * @return DbRef
187      */
188     public org.vamsas.objects.core.DbRef[] getDbRef()
189     {
190         int size = _dbRefList.size();
191         org.vamsas.objects.core.DbRef[] mArray = new org.vamsas.objects.core.DbRef[size];
192         for (int index = 0; index < size; index++) {
193             mArray[index] = (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
194         }
195         return mArray;
196     } //-- org.vamsas.objects.core.DbRef[] getDbRef() 
197
198     /**
199      * Method getDbRefCount
200      * 
201      * 
202      * 
203      * @return int
204      */
205     public int getDbRefCount()
206     {
207         return _dbRefList.size();
208     } //-- int getDbRefCount() 
209
210     /**
211      * Returns the value of field 'dictionary'. The field
212      * 'dictionary' has the following description: symbol class for
213      * sequence
214      *  
215      * 
216      * @return String
217      * @return the value of field 'dictionary'.
218      */
219     public java.lang.String getDictionary()
220     {
221         return this._dictionary;
222     } //-- java.lang.String getDictionary() 
223
224     /**
225      * Returns the value of field 'id'. The field 'id' has the
226      * following description: Primary Key for vamsas
227      *  object referencing
228      *  
229      * 
230      * @return String
231      * @return the value of field 'id'.
232      */
233     public java.lang.String getId()
234     {
235         return this._id;
236     } //-- java.lang.String getId() 
237
238     /**
239      * Method isValid
240      * 
241      * 
242      * 
243      * @return boolean
244      */
245     public boolean isValid()
246     {
247         try {
248             validate();
249         }
250         catch (org.exolab.castor.xml.ValidationException vex) {
251             return false;
252         }
253         return true;
254     } //-- boolean isValid() 
255
256     /**
257      * Method marshal
258      * 
259      * 
260      * 
261      * @param out
262      */
263     public void marshal(java.io.Writer out)
264         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
265     {
266         
267         Marshaller.marshal(this, out);
268     } //-- void marshal(java.io.Writer) 
269
270     /**
271      * Method marshal
272      * 
273      * 
274      * 
275      * @param handler
276      */
277     public void marshal(org.xml.sax.ContentHandler handler)
278         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
279     {
280         
281         Marshaller.marshal(this, handler);
282     } //-- void marshal(org.xml.sax.ContentHandler) 
283
284     /**
285      * Method removeAllDbRef
286      * 
287      */
288     public void removeAllDbRef()
289     {
290         _dbRefList.removeAllElements();
291     } //-- void removeAllDbRef() 
292
293     /**
294      * Method removeDbRef
295      * 
296      * 
297      * 
298      * @param index
299      * @return DbRef
300      */
301     public org.vamsas.objects.core.DbRef removeDbRef(int index)
302     {
303         java.lang.Object obj = _dbRefList.elementAt(index);
304         _dbRefList.removeElementAt(index);
305         return (org.vamsas.objects.core.DbRef) obj;
306     } //-- org.vamsas.objects.core.DbRef removeDbRef(int) 
307
308     /**
309      * Method setDbRef
310      * 
311      * 
312      * 
313      * @param index
314      * @param vDbRef
315      */
316     public void setDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
317         throws java.lang.IndexOutOfBoundsException
318     {
319         //-- check bounds for index
320         if ((index < 0) || (index > _dbRefList.size())) {
321             throw new IndexOutOfBoundsException("setDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
322         }
323         _dbRefList.setElementAt(vDbRef, index);
324     } //-- void setDbRef(int, org.vamsas.objects.core.DbRef) 
325
326     /**
327      * Method setDbRef
328      * 
329      * 
330      * 
331      * @param dbRefArray
332      */
333     public void setDbRef(org.vamsas.objects.core.DbRef[] dbRefArray)
334     {
335         //-- copy array
336         _dbRefList.removeAllElements();
337         for (int i = 0; i < dbRefArray.length; i++) {
338             _dbRefList.addElement(dbRefArray[i]);
339         }
340     } //-- void setDbRef(org.vamsas.objects.core.DbRef) 
341
342     /**
343      * Sets the value of field 'dictionary'. The field 'dictionary'
344      * has the following description: symbol class for sequence
345      *  
346      * 
347      * @param dictionary the value of field 'dictionary'.
348      */
349     public void setDictionary(java.lang.String dictionary)
350     {
351         this._dictionary = dictionary;
352     } //-- void setDictionary(java.lang.String) 
353
354     /**
355      * Sets the value of field 'id'. The field 'id' has the
356      * following description: Primary Key for vamsas
357      *  object referencing
358      *  
359      * 
360      * @param id the value of field 'id'.
361      */
362     public void setId(java.lang.String id)
363     {
364         this._id = id;
365     } //-- void setId(java.lang.String) 
366
367     /**
368      * Method unmarshal
369      * 
370      * 
371      * 
372      * @param reader
373      * @return SequenceType
374      */
375     public static org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
376         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
377     {
378         return (org.vamsas.objects.core.Sequence) Unmarshaller.unmarshal(org.vamsas.objects.core.Sequence.class, reader);
379     } //-- org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader) 
380
381     /**
382      * Method validate
383      * 
384      */
385     public void validate()
386         throws org.exolab.castor.xml.ValidationException
387     {
388         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
389         validator.validate(this);
390     } //-- void validate() 
391
392 }