objects from refactored schema.
[vamsas.git] / src / org / vamsas / objects / core / Tree.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 Tree.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class Tree extends org.vamsas.client.object 
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 _newickFormatList
47      */
48     private java.util.Vector _newickFormatList;
49
50     /**
51      * Field _provenance
52      */
53     private org.vamsas.objects.core.Provenance _provenance;
54
55
56       //----------------/
57      //- Constructors -/
58     //----------------/
59
60     public Tree() 
61      {
62         super();
63         _newickFormatList = new Vector();
64     } //-- org.vamsas.objects.core.Tree()
65
66
67       //-----------/
68      //- Methods -/
69     //-----------/
70
71     /**
72      * Method addNewickFormat
73      * 
74      * 
75      * 
76      * @param vNewickFormat
77      */
78     public void addNewickFormat(java.lang.String vNewickFormat)
79         throws java.lang.IndexOutOfBoundsException
80     {
81         _newickFormatList.addElement(vNewickFormat);
82     } //-- void addNewickFormat(java.lang.String) 
83
84     /**
85      * Method addNewickFormat
86      * 
87      * 
88      * 
89      * @param index
90      * @param vNewickFormat
91      */
92     public void addNewickFormat(int index, java.lang.String vNewickFormat)
93         throws java.lang.IndexOutOfBoundsException
94     {
95         _newickFormatList.insertElementAt(vNewickFormat, index);
96     } //-- void addNewickFormat(int, java.lang.String) 
97
98     /**
99      * Method enumerateNewickFormat
100      * 
101      * 
102      * 
103      * @return Enumeration
104      */
105     public java.util.Enumeration enumerateNewickFormat()
106     {
107         return _newickFormatList.elements();
108     } //-- java.util.Enumeration enumerateNewickFormat() 
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 Tree) {
125         
126             Tree temp = (Tree)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._newickFormatList != null) {
135                 if (temp._newickFormatList == null) return false;
136                 else if (!(this._newickFormatList.equals(temp._newickFormatList))) 
137                     return false;
138             }
139             else if (temp._newickFormatList != null)
140                 return false;
141             if (this._provenance != null) {
142                 if (temp._provenance == null) return false;
143                 else if (!(this._provenance.equals(temp._provenance))) 
144                     return false;
145             }
146             else if (temp._provenance != null)
147                 return false;
148             return true;
149         }
150         return false;
151     } //-- boolean equals(java.lang.Object) 
152
153     /**
154      * Returns the value of field 'id'.
155      * 
156      * @return String
157      * @return the value of field 'id'.
158      */
159     public java.lang.String getId()
160     {
161         return this._id;
162     } //-- java.lang.String getId() 
163
164     /**
165      * Method getNewickFormat
166      * 
167      * 
168      * 
169      * @param index
170      * @return String
171      */
172     public java.lang.String getNewickFormat(int index)
173         throws java.lang.IndexOutOfBoundsException
174     {
175         //-- check bounds for index
176         if ((index < 0) || (index > _newickFormatList.size())) {
177             throw new IndexOutOfBoundsException("getNewickFormat: Index value '"+index+"' not in range [0.."+_newickFormatList.size()+ "]");
178         }
179         
180         return (String)_newickFormatList.elementAt(index);
181     } //-- java.lang.String getNewickFormat(int) 
182
183     /**
184      * Method getNewickFormat
185      * 
186      * 
187      * 
188      * @return String
189      */
190     public java.lang.String[] getNewickFormat()
191     {
192         int size = _newickFormatList.size();
193         java.lang.String[] mArray = new java.lang.String[size];
194         for (int index = 0; index < size; index++) {
195             mArray[index] = (String)_newickFormatList.elementAt(index);
196         }
197         return mArray;
198     } //-- java.lang.String[] getNewickFormat() 
199
200     /**
201      * Method getNewickFormatCount
202      * 
203      * 
204      * 
205      * @return int
206      */
207     public int getNewickFormatCount()
208     {
209         return _newickFormatList.size();
210     } //-- int getNewickFormatCount() 
211
212     /**
213      * Returns the value of field 'provenance'.
214      * 
215      * @return Provenance
216      * @return the value of field 'provenance'.
217      */
218     public org.vamsas.objects.core.Provenance getProvenance()
219     {
220         return this._provenance;
221     } //-- org.vamsas.objects.core.Provenance getProvenance() 
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 removeAllNewickFormat
271      * 
272      */
273     public void removeAllNewickFormat()
274     {
275         _newickFormatList.removeAllElements();
276     } //-- void removeAllNewickFormat() 
277
278     /**
279      * Method removeNewickFormat
280      * 
281      * 
282      * 
283      * @param index
284      * @return String
285      */
286     public java.lang.String removeNewickFormat(int index)
287     {
288         java.lang.Object obj = _newickFormatList.elementAt(index);
289         _newickFormatList.removeElementAt(index);
290         return (String)obj;
291     } //-- java.lang.String removeNewickFormat(int) 
292
293     /**
294      * Sets the value of field 'id'.
295      * 
296      * @param id the value of field 'id'.
297      */
298     public void setId(java.lang.String id)
299     {
300         this._id = id;
301     } //-- void setId(java.lang.String) 
302
303     /**
304      * Method setNewickFormat
305      * 
306      * 
307      * 
308      * @param index
309      * @param vNewickFormat
310      */
311     public void setNewickFormat(int index, java.lang.String vNewickFormat)
312         throws java.lang.IndexOutOfBoundsException
313     {
314         //-- check bounds for index
315         if ((index < 0) || (index > _newickFormatList.size())) {
316             throw new IndexOutOfBoundsException("setNewickFormat: Index value '"+index+"' not in range [0.."+_newickFormatList.size()+ "]");
317         }
318         _newickFormatList.setElementAt(vNewickFormat, index);
319     } //-- void setNewickFormat(int, java.lang.String) 
320
321     /**
322      * Method setNewickFormat
323      * 
324      * 
325      * 
326      * @param newickFormatArray
327      */
328     public void setNewickFormat(java.lang.String[] newickFormatArray)
329     {
330         //-- copy array
331         _newickFormatList.removeAllElements();
332         for (int i = 0; i < newickFormatArray.length; i++) {
333             _newickFormatList.addElement(newickFormatArray[i]);
334         }
335     } //-- void setNewickFormat(java.lang.String) 
336
337     /**
338      * Sets the value of field 'provenance'.
339      * 
340      * @param provenance the value of field 'provenance'.
341      */
342     public void setProvenance(org.vamsas.objects.core.Provenance provenance)
343     {
344         this._provenance = provenance;
345     } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
346
347     /**
348      * Method unmarshal
349      * 
350      * 
351      * 
352      * @param reader
353      * @return Tree
354      */
355     public static org.vamsas.objects.core.Tree unmarshal(java.io.Reader reader)
356         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
357     {
358         return (org.vamsas.objects.core.Tree) Unmarshaller.unmarshal(org.vamsas.objects.core.Tree.class, reader);
359     } //-- org.vamsas.objects.core.Tree 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 }