refactored org to uk
[vamsas.git] / src / uk / ac / vamsas / objects / core / AlignmentSequence.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:AlignmentSequence.java 264 2006-12-14 17:42:54Z JimP $
6  */
7
8 package uk.ac.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 AlignmentSequence.
28  * 
29  * @version $Revision:264 $ $Date:2006-12-14 17:42:54 +0000 (Thu, 14 Dec 2006) $
30  */
31 public class AlignmentSequence extends uk.ac.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 object
42      *  referencing 
43      */
44     private java.lang.String _id;
45
46     /**
47      * Dataset Sequence from which
48      *  this alignment sequence is taken from
49      *  
50      */
51     private java.lang.Object _refid;
52
53     /**
54      * Field _alignmentSequenceAnnotationList
55      */
56     private java.util.Vector _alignmentSequenceAnnotationList;
57
58
59       //----------------/
60      //- Constructors -/
61     //----------------/
62
63     public AlignmentSequence() 
64      {
65         super();
66         _alignmentSequenceAnnotationList = new Vector();
67     } //-- uk.ac.vamsas.objects.core.AlignmentSequence()
68
69
70       //-----------/
71      //- Methods -/
72     //-----------/
73
74     /**
75      * Method addAlignmentSequenceAnnotation
76      * 
77      * 
78      * 
79      * @param vAlignmentSequenceAnnotation
80      */
81     public void addAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
82         throws java.lang.IndexOutOfBoundsException
83     {
84         _alignmentSequenceAnnotationList.addElement(vAlignmentSequenceAnnotation);
85     } //-- void addAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) 
86
87     /**
88      * Method addAlignmentSequenceAnnotation
89      * 
90      * 
91      * 
92      * @param index
93      * @param vAlignmentSequenceAnnotation
94      */
95     public void addAlignmentSequenceAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
96         throws java.lang.IndexOutOfBoundsException
97     {
98         _alignmentSequenceAnnotationList.insertElementAt(vAlignmentSequenceAnnotation, index);
99     } //-- void addAlignmentSequenceAnnotation(int, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) 
100
101     /**
102      * Method enumerateAlignmentSequenceAnnotation
103      * 
104      * 
105      * 
106      * @return Enumeration
107      */
108     public java.util.Enumeration enumerateAlignmentSequenceAnnotation()
109     {
110         return _alignmentSequenceAnnotationList.elements();
111     } //-- java.util.Enumeration enumerateAlignmentSequenceAnnotation() 
112
113     /**
114      * Note: hashCode() has not been overriden
115      * 
116      * @param obj
117      * @return boolean
118      */
119     public boolean equals(java.lang.Object obj)
120     {
121         if ( this == obj )
122             return true;
123         
124         if (super.equals(obj)==false)
125             return false;
126         
127         if (obj instanceof AlignmentSequence) {
128         
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))) 
133                     return false;
134             }
135             else if (temp._id != null)
136                 return false;
137             if (this._refid != null) {
138                 if (temp._refid == null) return false;
139                 else if (!(this._refid.equals(temp._refid))) 
140                     return false;
141             }
142             else if (temp._refid != null)
143                 return false;
144             if (this._alignmentSequenceAnnotationList != null) {
145                 if (temp._alignmentSequenceAnnotationList == null) return false;
146                 else if (!(this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList))) 
147                     return false;
148             }
149             else if (temp._alignmentSequenceAnnotationList != null)
150                 return false;
151             return true;
152         }
153         return false;
154     } //-- boolean equals(java.lang.Object) 
155
156     /**
157      * Method getAlignmentSequenceAnnotation
158      * 
159      * 
160      * 
161      * @param index
162      * @return AlignmentSequenceAnnotation
163      */
164     public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int index)
165         throws java.lang.IndexOutOfBoundsException
166     {
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()+ "]");
170         }
171         
172         return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index);
173     } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int) 
174
175     /**
176      * Method getAlignmentSequenceAnnotation
177      * 
178      * 
179      * 
180      * @return AlignmentSequenceAnnotation
181      */
182     public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation()
183     {
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);
188         }
189         return mArray;
190     } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation() 
191
192     /**
193      * Method getAlignmentSequenceAnnotationCount
194      * 
195      * 
196      * 
197      * @return int
198      */
199     public int getAlignmentSequenceAnnotationCount()
200     {
201         return _alignmentSequenceAnnotationList.size();
202     } //-- int getAlignmentSequenceAnnotationCount() 
203
204     /**
205      * Returns the value of field 'id'. The field 'id' has the
206      * following description: Primary Key for vamsas object
207      *  referencing 
208      * 
209      * @return String
210      * @return the value of field 'id'.
211      */
212     public java.lang.String getId()
213     {
214         return this._id;
215     } //-- java.lang.String getId() 
216
217     /**
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
221      *  
222      * 
223      * @return Object
224      * @return the value of field 'refid'.
225      */
226     public java.lang.Object getRefid()
227     {
228         return this._refid;
229     } //-- java.lang.Object getRefid() 
230
231     /**
232      * Method isValid
233      * 
234      * 
235      * 
236      * @return boolean
237      */
238     public boolean isValid()
239     {
240         try {
241             validate();
242         }
243         catch (org.exolab.castor.xml.ValidationException vex) {
244             return false;
245         }
246         return true;
247     } //-- boolean isValid() 
248
249     /**
250      * Method marshal
251      * 
252      * 
253      * 
254      * @param out
255      */
256     public void marshal(java.io.Writer out)
257         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
258     {
259         
260         Marshaller.marshal(this, out);
261     } //-- void marshal(java.io.Writer) 
262
263     /**
264      * Method marshal
265      * 
266      * 
267      * 
268      * @param handler
269      */
270     public void marshal(org.xml.sax.ContentHandler handler)
271         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
272     {
273         
274         Marshaller.marshal(this, handler);
275     } //-- void marshal(org.xml.sax.ContentHandler) 
276
277     /**
278      * Method removeAlignmentSequenceAnnotation
279      * 
280      * 
281      * 
282      * @param index
283      * @return AlignmentSequenceAnnotation
284      */
285     public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int index)
286     {
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) 
291
292     /**
293      * Method removeAllAlignmentSequenceAnnotation
294      * 
295      */
296     public void removeAllAlignmentSequenceAnnotation()
297     {
298         _alignmentSequenceAnnotationList.removeAllElements();
299     } //-- void removeAllAlignmentSequenceAnnotation() 
300
301     /**
302      * Method setAlignmentSequenceAnnotation
303      * 
304      * 
305      * 
306      * @param index
307      * @param vAlignmentSequenceAnnotation
308      */
309     public void setAlignmentSequenceAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
310         throws java.lang.IndexOutOfBoundsException
311     {
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()+ "]");
315         }
316         _alignmentSequenceAnnotationList.setElementAt(vAlignmentSequenceAnnotation, index);
317     } //-- void setAlignmentSequenceAnnotation(int, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) 
318
319     /**
320      * Method setAlignmentSequenceAnnotation
321      * 
322      * 
323      * 
324      * @param alignmentSequenceAnnotationArray
325      */
326     public void setAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] alignmentSequenceAnnotationArray)
327     {
328         //-- copy array
329         _alignmentSequenceAnnotationList.removeAllElements();
330         for (int i = 0; i < alignmentSequenceAnnotationArray.length; i++) {
331             _alignmentSequenceAnnotationList.addElement(alignmentSequenceAnnotationArray[i]);
332         }
333     } //-- void setAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) 
334
335     /**
336      * Sets the value of field 'id'. The field 'id' has the
337      * following description: Primary Key for vamsas object
338      *  referencing 
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      * 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
351      *  
352      * 
353      * @param refid the value of field 'refid'.
354      */
355     public void setRefid(java.lang.Object refid)
356     {
357         this._refid = refid;
358     } //-- void setRefid(java.lang.Object) 
359
360     /**
361      * Method unmarshal
362      * 
363      * 
364      * 
365      * @param reader
366      * @return SequenceType
367      */
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
370     {
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) 
373
374     /**
375      * Method validate
376      * 
377      */
378     public void validate()
379         throws org.exolab.castor.xml.ValidationException
380     {
381         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
382         validator.validate(this);
383     } //-- void validate() 
384
385 }