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