2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package org.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
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;
29 * @version $Revision$ $Date$
31 public class Sequence extends org.vamsas.objects.core.SequenceType
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Primary Key for vamsas
45 private java.lang.String _id;
48 * symbol class for sequence
51 private java.lang.String _dictionary;
54 * Store a list of database
56 * sequence record - with
57 * optional mapping from
58 * database sequence to the
59 * given sequence record
62 private java.util.Vector _dbRefList;
72 _dbRefList = new Vector();
73 } //-- org.vamsas.objects.core.Sequence()
87 public void addDbRef(org.vamsas.objects.core.DbRef vDbRef)
88 throws java.lang.IndexOutOfBoundsException
90 _dbRefList.addElement(vDbRef);
91 } //-- void addDbRef(org.vamsas.objects.core.DbRef)
101 public void addDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
102 throws java.lang.IndexOutOfBoundsException
104 _dbRefList.insertElementAt(vDbRef, index);
105 } //-- void addDbRef(int, org.vamsas.objects.core.DbRef)
108 * Method enumerateDbRef
112 * @return Enumeration
114 public java.util.Enumeration enumerateDbRef()
116 return _dbRefList.elements();
117 } //-- java.util.Enumeration enumerateDbRef()
120 * Note: hashCode() has not been overriden
125 public boolean equals(java.lang.Object obj)
130 if (super.equals(obj)==false)
133 if (obj instanceof Sequence) {
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)))
141 else if (temp._id != null)
143 if (this._dictionary != null) {
144 if (temp._dictionary == null) return false;
145 else if (!(this._dictionary.equals(temp._dictionary)))
148 else if (temp._dictionary != null)
150 if (this._dbRefList != null) {
151 if (temp._dbRefList == null) return false;
152 else if (!(this._dbRefList.equals(temp._dbRefList)))
155 else if (temp._dbRefList != null)
160 } //-- boolean equals(java.lang.Object)
170 public org.vamsas.objects.core.DbRef getDbRef(int index)
171 throws java.lang.IndexOutOfBoundsException
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()+ "]");
178 return (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
179 } //-- org.vamsas.objects.core.DbRef getDbRef(int)
188 public org.vamsas.objects.core.DbRef[] getDbRef()
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);
196 } //-- org.vamsas.objects.core.DbRef[] getDbRef()
199 * Method getDbRefCount
205 public int getDbRefCount()
207 return _dbRefList.size();
208 } //-- int getDbRefCount()
211 * Returns the value of field 'dictionary'. The field
212 * 'dictionary' has the following description: symbol class for
217 * @return the value of field 'dictionary'.
219 public java.lang.String getDictionary()
221 return this._dictionary;
222 } //-- java.lang.String getDictionary()
225 * Returns the value of field 'id'. The field 'id' has the
226 * following description: Primary Key for vamsas
231 * @return the value of field 'id'.
233 public java.lang.String getId()
236 } //-- java.lang.String getId()
245 public boolean isValid()
250 catch (org.exolab.castor.xml.ValidationException vex) {
254 } //-- boolean isValid()
263 public void marshal(java.io.Writer out)
264 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
267 Marshaller.marshal(this, out);
268 } //-- void marshal(java.io.Writer)
277 public void marshal(org.xml.sax.ContentHandler handler)
278 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
281 Marshaller.marshal(this, handler);
282 } //-- void marshal(org.xml.sax.ContentHandler)
285 * Method removeAllDbRef
288 public void removeAllDbRef()
290 _dbRefList.removeAllElements();
291 } //-- void removeAllDbRef()
301 public org.vamsas.objects.core.DbRef removeDbRef(int index)
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)
316 public void setDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
317 throws java.lang.IndexOutOfBoundsException
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()+ "]");
323 _dbRefList.setElementAt(vDbRef, index);
324 } //-- void setDbRef(int, org.vamsas.objects.core.DbRef)
333 public void setDbRef(org.vamsas.objects.core.DbRef[] dbRefArray)
336 _dbRefList.removeAllElements();
337 for (int i = 0; i < dbRefArray.length; i++) {
338 _dbRefList.addElement(dbRefArray[i]);
340 } //-- void setDbRef(org.vamsas.objects.core.DbRef)
343 * Sets the value of field 'dictionary'. The field 'dictionary'
344 * has the following description: symbol class for sequence
347 * @param dictionary the value of field 'dictionary'.
349 public void setDictionary(java.lang.String dictionary)
351 this._dictionary = dictionary;
352 } //-- void setDictionary(java.lang.String)
355 * Sets the value of field 'id'. The field 'id' has the
356 * following description: Primary Key for vamsas
360 * @param id the value of field 'id'.
362 public void setId(java.lang.String id)
365 } //-- void setId(java.lang.String)
373 * @return SequenceType
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
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)
385 public void validate()
386 throws org.exolab.castor.xml.ValidationException
388 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
389 validator.validate(this);
390 } //-- void validate()