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;
27 * Class AlignmentSequence.
29 * @version $Revision$ $Date$
31 public class AlignmentSequence extends uk.ac.vamsas.objects.core.SequenceType
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Primary Key for vamsas object
44 private java.lang.String _id;
47 * Dataset Sequence from which
48 * this alignment sequence is taken from
51 private java.lang.Object _refid;
54 * Field _alignmentSequenceAnnotationList
56 private java.util.Vector _alignmentSequenceAnnotationList;
63 public AlignmentSequence()
66 _alignmentSequenceAnnotationList = new Vector();
67 } //-- uk.ac.vamsas.objects.core.AlignmentSequence()
75 * Method addAlignmentSequenceAnnotation
79 * @param vAlignmentSequenceAnnotation
81 public void addAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
82 throws java.lang.IndexOutOfBoundsException
84 _alignmentSequenceAnnotationList.addElement(vAlignmentSequenceAnnotation);
85 } //-- void addAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation)
88 * Method addAlignmentSequenceAnnotation
93 * @param vAlignmentSequenceAnnotation
95 public void addAlignmentSequenceAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
96 throws java.lang.IndexOutOfBoundsException
98 _alignmentSequenceAnnotationList.insertElementAt(vAlignmentSequenceAnnotation, index);
99 } //-- void addAlignmentSequenceAnnotation(int, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation)
102 * Method enumerateAlignmentSequenceAnnotation
106 * @return Enumeration
108 public java.util.Enumeration enumerateAlignmentSequenceAnnotation()
110 return _alignmentSequenceAnnotationList.elements();
111 } //-- java.util.Enumeration enumerateAlignmentSequenceAnnotation()
114 * Note: hashCode() has not been overriden
119 public boolean equals(java.lang.Object obj)
124 if (super.equals(obj)==false)
127 if (obj instanceof AlignmentSequence) {
129 AlignmentSequence temp = (AlignmentSequence)obj;
130 if (this._id != null) {
131 if (temp._id == null) return false;
132 else if (!(this._id.equals(temp._id)))
135 else if (temp._id != null)
137 if (this._refid != null) {
138 if (temp._refid == null) return false;
139 else if (!(this._refid.equals(temp._refid)))
142 else if (temp._refid != null)
144 if (this._alignmentSequenceAnnotationList != null) {
145 if (temp._alignmentSequenceAnnotationList == null) return false;
146 else if (!(this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList)))
149 else if (temp._alignmentSequenceAnnotationList != null)
154 } //-- boolean equals(java.lang.Object)
157 * Method getAlignmentSequenceAnnotation
162 * @return AlignmentSequenceAnnotation
164 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int index)
165 throws java.lang.IndexOutOfBoundsException
167 //-- check bounds for index
168 if ((index < 0) || (index > _alignmentSequenceAnnotationList.size())) {
169 throw new IndexOutOfBoundsException("getAlignmentSequenceAnnotation: Index value '"+index+"' not in range [0.."+_alignmentSequenceAnnotationList.size()+ "]");
172 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index);
173 } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int)
176 * Method getAlignmentSequenceAnnotation
180 * @return AlignmentSequenceAnnotation
182 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation()
184 int size = _alignmentSequenceAnnotationList.size();
185 uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] mArray = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[size];
186 for (int index = 0; index < size; index++) {
187 mArray[index] = (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index);
190 } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation()
193 * Method getAlignmentSequenceAnnotationCount
199 public int getAlignmentSequenceAnnotationCount()
201 return _alignmentSequenceAnnotationList.size();
202 } //-- int getAlignmentSequenceAnnotationCount()
205 * Returns the value of field 'id'. The field 'id' has the
206 * following description: Primary Key for vamsas object
210 * @return the value of field 'id'.
212 public java.lang.String getId()
215 } //-- java.lang.String getId()
218 * Returns the value of field 'refid'. The field 'refid' has
219 * the following description: Dataset Sequence from which
220 * this alignment sequence is taken from
224 * @return the value of field 'refid'.
226 public java.lang.Object getRefid()
229 } //-- java.lang.Object getRefid()
238 public boolean isValid()
243 catch (org.exolab.castor.xml.ValidationException vex) {
247 } //-- boolean isValid()
256 public void marshal(java.io.Writer out)
257 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
260 Marshaller.marshal(this, out);
261 } //-- void marshal(java.io.Writer)
270 public void marshal(org.xml.sax.ContentHandler handler)
271 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
274 Marshaller.marshal(this, handler);
275 } //-- void marshal(org.xml.sax.ContentHandler)
278 * Method removeAlignmentSequenceAnnotation
283 * @return AlignmentSequenceAnnotation
285 public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int index)
287 java.lang.Object obj = _alignmentSequenceAnnotationList.elementAt(index);
288 _alignmentSequenceAnnotationList.removeElementAt(index);
289 return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) obj;
290 } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int)
293 * Method removeAllAlignmentSequenceAnnotation
296 public void removeAllAlignmentSequenceAnnotation()
298 _alignmentSequenceAnnotationList.removeAllElements();
299 } //-- void removeAllAlignmentSequenceAnnotation()
302 * Method setAlignmentSequenceAnnotation
307 * @param vAlignmentSequenceAnnotation
309 public void setAlignmentSequenceAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
310 throws java.lang.IndexOutOfBoundsException
312 //-- check bounds for index
313 if ((index < 0) || (index > _alignmentSequenceAnnotationList.size())) {
314 throw new IndexOutOfBoundsException("setAlignmentSequenceAnnotation: Index value '"+index+"' not in range [0.."+_alignmentSequenceAnnotationList.size()+ "]");
316 _alignmentSequenceAnnotationList.setElementAt(vAlignmentSequenceAnnotation, index);
317 } //-- void setAlignmentSequenceAnnotation(int, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation)
320 * Method setAlignmentSequenceAnnotation
324 * @param alignmentSequenceAnnotationArray
326 public void setAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] alignmentSequenceAnnotationArray)
329 _alignmentSequenceAnnotationList.removeAllElements();
330 for (int i = 0; i < alignmentSequenceAnnotationArray.length; i++) {
331 _alignmentSequenceAnnotationList.addElement(alignmentSequenceAnnotationArray[i]);
333 } //-- void setAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation)
336 * Sets the value of field 'id'. The field 'id' has the
337 * following description: Primary Key for vamsas object
340 * @param id the value of field 'id'.
342 public void setId(java.lang.String id)
345 } //-- void setId(java.lang.String)
348 * Sets the value of field 'refid'. The field 'refid' has the
349 * following description: Dataset Sequence from which
350 * this alignment sequence is taken from
353 * @param refid the value of field 'refid'.
355 public void setRefid(java.lang.Object refid)
358 } //-- void setRefid(java.lang.Object)
366 * @return SequenceType
368 public static uk.ac.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
369 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
371 return (uk.ac.vamsas.objects.core.AlignmentSequence) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentSequence.class, reader);
372 } //-- uk.ac.vamsas.objects.core.SequenceType unmarshal(java.io.Reader)
378 public void validate()
379 throws org.exolab.castor.xml.ValidationException
381 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
382 validator.validate(this);
383 } //-- void validate()