2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package uk.ac.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 uk.ac.vamsas.objects.core.SequenceType
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Primary Key for vamsas object referencing
44 private java.lang.String _id;
47 * symbol class for sequence
50 private java.lang.String _dictionary;
53 * Store a list of database references
54 * for this sequence record - with optional mapping
55 * from database sequence to the given sequence record
57 private java.util.Vector _dbRefList;
67 _dbRefList = new Vector();
68 } //-- uk.ac.vamsas.objects.core.Sequence()
82 public void addDbRef(uk.ac.vamsas.objects.core.DbRef vDbRef)
83 throws java.lang.IndexOutOfBoundsException
85 _dbRefList.addElement(vDbRef);
86 } //-- void addDbRef(uk.ac.vamsas.objects.core.DbRef)
96 public void addDbRef(int index, uk.ac.vamsas.objects.core.DbRef vDbRef)
97 throws java.lang.IndexOutOfBoundsException
99 _dbRefList.insertElementAt(vDbRef, index);
100 } //-- void addDbRef(int, uk.ac.vamsas.objects.core.DbRef)
103 * Method enumerateDbRef
107 * @return Enumeration
109 public java.util.Enumeration enumerateDbRef()
111 return _dbRefList.elements();
112 } //-- java.util.Enumeration enumerateDbRef()
115 * Note: hashCode() has not been overriden
120 public boolean equals(java.lang.Object obj)
125 if (super.equals(obj)==false)
128 if (obj instanceof Sequence) {
130 Sequence temp = (Sequence)obj;
131 if (this._id != null) {
132 if (temp._id == null) return false;
133 else if (!(this._id.equals(temp._id)))
136 else if (temp._id != null)
138 if (this._dictionary != null) {
139 if (temp._dictionary == null) return false;
140 else if (!(this._dictionary.equals(temp._dictionary)))
143 else if (temp._dictionary != null)
145 if (this._dbRefList != null) {
146 if (temp._dbRefList == null) return false;
147 else if (!(this._dbRefList.equals(temp._dbRefList)))
150 else if (temp._dbRefList != null)
155 } //-- boolean equals(java.lang.Object)
165 public uk.ac.vamsas.objects.core.DbRef getDbRef(int index)
166 throws java.lang.IndexOutOfBoundsException
168 //-- check bounds for index
169 if ((index < 0) || (index > _dbRefList.size())) {
170 throw new IndexOutOfBoundsException("getDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
173 return (uk.ac.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
174 } //-- uk.ac.vamsas.objects.core.DbRef getDbRef(int)
183 public uk.ac.vamsas.objects.core.DbRef[] getDbRef()
185 int size = _dbRefList.size();
186 uk.ac.vamsas.objects.core.DbRef[] mArray = new uk.ac.vamsas.objects.core.DbRef[size];
187 for (int index = 0; index < size; index++) {
188 mArray[index] = (uk.ac.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
191 } //-- uk.ac.vamsas.objects.core.DbRef[] getDbRef()
194 * Method getDbRefCount
200 public int getDbRefCount()
202 return _dbRefList.size();
203 } //-- int getDbRefCount()
206 * Returns the value of field 'dictionary'. The field
207 * 'dictionary' has the following description: symbol class for
212 * @return the value of field 'dictionary'.
214 public java.lang.String getDictionary()
216 return this._dictionary;
217 } //-- java.lang.String getDictionary()
220 * Returns the value of field 'id'. The field 'id' has the
221 * following description: Primary Key for vamsas object
226 * @return the value of field 'id'.
228 public java.lang.String getId()
231 } //-- java.lang.String getId()
240 public boolean isValid()
245 catch (org.exolab.castor.xml.ValidationException vex) {
249 } //-- boolean isValid()
258 public void marshal(java.io.Writer out)
259 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
262 Marshaller.marshal(this, out);
263 } //-- void marshal(java.io.Writer)
272 public void marshal(org.xml.sax.ContentHandler handler)
273 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
276 Marshaller.marshal(this, handler);
277 } //-- void marshal(org.xml.sax.ContentHandler)
280 * Method removeAllDbRef
283 public void removeAllDbRef()
285 _dbRefList.removeAllElements();
286 } //-- void removeAllDbRef()
296 public uk.ac.vamsas.objects.core.DbRef removeDbRef(int index)
298 java.lang.Object obj = _dbRefList.elementAt(index);
299 _dbRefList.removeElementAt(index);
300 return (uk.ac.vamsas.objects.core.DbRef) obj;
301 } //-- uk.ac.vamsas.objects.core.DbRef removeDbRef(int)
311 public void setDbRef(int index, uk.ac.vamsas.objects.core.DbRef vDbRef)
312 throws java.lang.IndexOutOfBoundsException
314 //-- check bounds for index
315 if ((index < 0) || (index > _dbRefList.size())) {
316 throw new IndexOutOfBoundsException("setDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
318 _dbRefList.setElementAt(vDbRef, index);
319 } //-- void setDbRef(int, uk.ac.vamsas.objects.core.DbRef)
328 public void setDbRef(uk.ac.vamsas.objects.core.DbRef[] dbRefArray)
331 _dbRefList.removeAllElements();
332 for (int i = 0; i < dbRefArray.length; i++) {
333 _dbRefList.addElement(dbRefArray[i]);
335 } //-- void setDbRef(uk.ac.vamsas.objects.core.DbRef)
338 * Sets the value of field 'dictionary'. The field 'dictionary'
339 * has the following description: symbol class for sequence
342 * @param dictionary the value of field 'dictionary'.
344 public void setDictionary(java.lang.String dictionary)
346 this._dictionary = dictionary;
347 } //-- void setDictionary(java.lang.String)
350 * Sets the value of field 'id'. The field 'id' has the
351 * following description: Primary Key for vamsas object
355 * @param id the value of field 'id'.
357 public void setId(java.lang.String id)
360 } //-- void setId(java.lang.String)
368 * @return SequenceType
370 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
371 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
373 return (uk.ac.vamsas.objects.core.Sequence) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Sequence.class, reader);
374 } //-- uk.ac.vamsas.objects.core.SequenceType unmarshal(java.io.Reader)
380 public void validate()
381 throws org.exolab.castor.xml.ValidationException
383 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
384 validator.validate(this);
385 } //-- void validate()