autogenerated java classes for current 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.Vobject 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Primary Key for vamsas object referencing
42      *  
43      */
44     private java.lang.String _id;
45
46     /**
47      * objects with modifiable=false will not be
48      *  modified by a vamsas client update
49      *  
50      */
51     private boolean _modifiable = true;
52
53     /**
54      * keeps track of state for field: _modifiable
55      */
56     private boolean _has_modifiable;
57
58     /**
59      * Field _title
60      */
61     private java.lang.String _title;
62
63     /**
64      * Field _newickList
65      */
66     private java.util.Vector _newickList;
67
68     /**
69      * Field _propertyList
70      */
71     private java.util.Vector _propertyList;
72
73     /**
74      * Field _provenance
75      */
76     private org.vamsas.objects.core.Provenance _provenance;
77
78
79       //----------------/
80      //- Constructors -/
81     //----------------/
82
83     public Tree() 
84      {
85         super();
86         _newickList = new Vector();
87         _propertyList = new Vector();
88     } //-- org.vamsas.objects.core.Tree()
89
90
91       //-----------/
92      //- Methods -/
93     //-----------/
94
95     /**
96      * Method addNewick
97      * 
98      * 
99      * 
100      * @param vNewick
101      */
102     public void addNewick(org.vamsas.objects.core.Newick vNewick)
103         throws java.lang.IndexOutOfBoundsException
104     {
105         _newickList.addElement(vNewick);
106     } //-- void addNewick(org.vamsas.objects.core.Newick) 
107
108     /**
109      * Method addNewick
110      * 
111      * 
112      * 
113      * @param index
114      * @param vNewick
115      */
116     public void addNewick(int index, org.vamsas.objects.core.Newick vNewick)
117         throws java.lang.IndexOutOfBoundsException
118     {
119         _newickList.insertElementAt(vNewick, index);
120     } //-- void addNewick(int, org.vamsas.objects.core.Newick) 
121
122     /**
123      * Method addProperty
124      * 
125      * 
126      * 
127      * @param vProperty
128      */
129     public void addProperty(org.vamsas.objects.core.Property vProperty)
130         throws java.lang.IndexOutOfBoundsException
131     {
132         _propertyList.addElement(vProperty);
133     } //-- void addProperty(org.vamsas.objects.core.Property) 
134
135     /**
136      * Method addProperty
137      * 
138      * 
139      * 
140      * @param index
141      * @param vProperty
142      */
143     public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
144         throws java.lang.IndexOutOfBoundsException
145     {
146         _propertyList.insertElementAt(vProperty, index);
147     } //-- void addProperty(int, org.vamsas.objects.core.Property) 
148
149     /**
150      * Method deleteModifiable
151      * 
152      */
153     public void deleteModifiable()
154     {
155         this._has_modifiable= false;
156     } //-- void deleteModifiable() 
157
158     /**
159      * Method enumerateNewick
160      * 
161      * 
162      * 
163      * @return Enumeration
164      */
165     public java.util.Enumeration enumerateNewick()
166     {
167         return _newickList.elements();
168     } //-- java.util.Enumeration enumerateNewick() 
169
170     /**
171      * Method enumerateProperty
172      * 
173      * 
174      * 
175      * @return Enumeration
176      */
177     public java.util.Enumeration enumerateProperty()
178     {
179         return _propertyList.elements();
180     } //-- java.util.Enumeration enumerateProperty() 
181
182     /**
183      * Note: hashCode() has not been overriden
184      * 
185      * @param obj
186      * @return boolean
187      */
188     public boolean equals(java.lang.Object obj)
189     {
190         if ( this == obj )
191             return true;
192         
193         if (super.equals(obj)==false)
194             return false;
195         
196         if (obj instanceof Tree) {
197         
198             Tree temp = (Tree)obj;
199             if (this._id != null) {
200                 if (temp._id == null) return false;
201                 else if (!(this._id.equals(temp._id))) 
202                     return false;
203             }
204             else if (temp._id != null)
205                 return false;
206             if (this._modifiable != temp._modifiable)
207                 return false;
208             if (this._has_modifiable != temp._has_modifiable)
209                 return false;
210             if (this._title != null) {
211                 if (temp._title == null) return false;
212                 else if (!(this._title.equals(temp._title))) 
213                     return false;
214             }
215             else if (temp._title != null)
216                 return false;
217             if (this._newickList != null) {
218                 if (temp._newickList == null) return false;
219                 else if (!(this._newickList.equals(temp._newickList))) 
220                     return false;
221             }
222             else if (temp._newickList != null)
223                 return false;
224             if (this._propertyList != null) {
225                 if (temp._propertyList == null) return false;
226                 else if (!(this._propertyList.equals(temp._propertyList))) 
227                     return false;
228             }
229             else if (temp._propertyList != null)
230                 return false;
231             if (this._provenance != null) {
232                 if (temp._provenance == null) return false;
233                 else if (!(this._provenance.equals(temp._provenance))) 
234                     return false;
235             }
236             else if (temp._provenance != null)
237                 return false;
238             return true;
239         }
240         return false;
241     } //-- boolean equals(java.lang.Object) 
242
243     /**
244      * Returns the value of field 'id'. The field 'id' has the
245      * following description: Primary Key for vamsas object
246      * referencing
247      *  
248      * 
249      * @return String
250      * @return the value of field 'id'.
251      */
252     public java.lang.String getId()
253     {
254         return this._id;
255     } //-- java.lang.String getId() 
256
257     /**
258      * Returns the value of field 'modifiable'. The field
259      * 'modifiable' has the following description: objects with
260      * modifiable=false will not be
261      *  modified by a vamsas client update
262      *  
263      * 
264      * @return boolean
265      * @return the value of field 'modifiable'.
266      */
267     public boolean getModifiable()
268     {
269         return this._modifiable;
270     } //-- boolean getModifiable() 
271
272     /**
273      * Method getNewick
274      * 
275      * 
276      * 
277      * @param index
278      * @return Newick
279      */
280     public org.vamsas.objects.core.Newick getNewick(int index)
281         throws java.lang.IndexOutOfBoundsException
282     {
283         //-- check bounds for index
284         if ((index < 0) || (index > _newickList.size())) {
285             throw new IndexOutOfBoundsException("getNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]");
286         }
287         
288         return (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
289     } //-- org.vamsas.objects.core.Newick getNewick(int) 
290
291     /**
292      * Method getNewick
293      * 
294      * 
295      * 
296      * @return Newick
297      */
298     public org.vamsas.objects.core.Newick[] getNewick()
299     {
300         int size = _newickList.size();
301         org.vamsas.objects.core.Newick[] mArray = new org.vamsas.objects.core.Newick[size];
302         for (int index = 0; index < size; index++) {
303             mArray[index] = (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
304         }
305         return mArray;
306     } //-- org.vamsas.objects.core.Newick[] getNewick() 
307
308     /**
309      * Method getNewickCount
310      * 
311      * 
312      * 
313      * @return int
314      */
315     public int getNewickCount()
316     {
317         return _newickList.size();
318     } //-- int getNewickCount() 
319
320     /**
321      * Method getProperty
322      * 
323      * 
324      * 
325      * @param index
326      * @return Property
327      */
328     public org.vamsas.objects.core.Property getProperty(int index)
329         throws java.lang.IndexOutOfBoundsException
330     {
331         //-- check bounds for index
332         if ((index < 0) || (index > _propertyList.size())) {
333             throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
334         }
335         
336         return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
337     } //-- org.vamsas.objects.core.Property getProperty(int) 
338
339     /**
340      * Method getProperty
341      * 
342      * 
343      * 
344      * @return Property
345      */
346     public org.vamsas.objects.core.Property[] getProperty()
347     {
348         int size = _propertyList.size();
349         org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
350         for (int index = 0; index < size; index++) {
351             mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
352         }
353         return mArray;
354     } //-- org.vamsas.objects.core.Property[] getProperty() 
355
356     /**
357      * Method getPropertyCount
358      * 
359      * 
360      * 
361      * @return int
362      */
363     public int getPropertyCount()
364     {
365         return _propertyList.size();
366     } //-- int getPropertyCount() 
367
368     /**
369      * Returns the value of field 'provenance'.
370      * 
371      * @return Provenance
372      * @return the value of field 'provenance'.
373      */
374     public org.vamsas.objects.core.Provenance getProvenance()
375     {
376         return this._provenance;
377     } //-- org.vamsas.objects.core.Provenance getProvenance() 
378
379     /**
380      * Returns the value of field 'title'.
381      * 
382      * @return String
383      * @return the value of field 'title'.
384      */
385     public java.lang.String getTitle()
386     {
387         return this._title;
388     } //-- java.lang.String getTitle() 
389
390     /**
391      * Method hasModifiable
392      * 
393      * 
394      * 
395      * @return boolean
396      */
397     public boolean hasModifiable()
398     {
399         return this._has_modifiable;
400     } //-- boolean hasModifiable() 
401
402     /**
403      * Method isValid
404      * 
405      * 
406      * 
407      * @return boolean
408      */
409     public boolean isValid()
410     {
411         try {
412             validate();
413         }
414         catch (org.exolab.castor.xml.ValidationException vex) {
415             return false;
416         }
417         return true;
418     } //-- boolean isValid() 
419
420     /**
421      * Method marshal
422      * 
423      * 
424      * 
425      * @param out
426      */
427     public void marshal(java.io.Writer out)
428         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
429     {
430         
431         Marshaller.marshal(this, out);
432     } //-- void marshal(java.io.Writer) 
433
434     /**
435      * Method marshal
436      * 
437      * 
438      * 
439      * @param handler
440      */
441     public void marshal(org.xml.sax.ContentHandler handler)
442         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
443     {
444         
445         Marshaller.marshal(this, handler);
446     } //-- void marshal(org.xml.sax.ContentHandler) 
447
448     /**
449      * Method removeAllNewick
450      * 
451      */
452     public void removeAllNewick()
453     {
454         _newickList.removeAllElements();
455     } //-- void removeAllNewick() 
456
457     /**
458      * Method removeAllProperty
459      * 
460      */
461     public void removeAllProperty()
462     {
463         _propertyList.removeAllElements();
464     } //-- void removeAllProperty() 
465
466     /**
467      * Method removeNewick
468      * 
469      * 
470      * 
471      * @param index
472      * @return Newick
473      */
474     public org.vamsas.objects.core.Newick removeNewick(int index)
475     {
476         java.lang.Object obj = _newickList.elementAt(index);
477         _newickList.removeElementAt(index);
478         return (org.vamsas.objects.core.Newick) obj;
479     } //-- org.vamsas.objects.core.Newick removeNewick(int) 
480
481     /**
482      * Method removeProperty
483      * 
484      * 
485      * 
486      * @param index
487      * @return Property
488      */
489     public org.vamsas.objects.core.Property removeProperty(int index)
490     {
491         java.lang.Object obj = _propertyList.elementAt(index);
492         _propertyList.removeElementAt(index);
493         return (org.vamsas.objects.core.Property) obj;
494     } //-- org.vamsas.objects.core.Property removeProperty(int) 
495
496     /**
497      * Sets the value of field 'id'. The field 'id' has the
498      * following description: Primary Key for vamsas object
499      * referencing
500      *  
501      * 
502      * @param id the value of field 'id'.
503      */
504     public void setId(java.lang.String id)
505     {
506         this._id = id;
507     } //-- void setId(java.lang.String) 
508
509     /**
510      * Sets the value of field 'modifiable'. The field 'modifiable'
511      * has the following description: objects with modifiable=false
512      * will not be
513      *  modified by a vamsas client update
514      *  
515      * 
516      * @param modifiable the value of field 'modifiable'.
517      */
518     public void setModifiable(boolean modifiable)
519     {
520         this._modifiable = modifiable;
521         this._has_modifiable = true;
522     } //-- void setModifiable(boolean) 
523
524     /**
525      * Method setNewick
526      * 
527      * 
528      * 
529      * @param index
530      * @param vNewick
531      */
532     public void setNewick(int index, org.vamsas.objects.core.Newick vNewick)
533         throws java.lang.IndexOutOfBoundsException
534     {
535         //-- check bounds for index
536         if ((index < 0) || (index > _newickList.size())) {
537             throw new IndexOutOfBoundsException("setNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]");
538         }
539         _newickList.setElementAt(vNewick, index);
540     } //-- void setNewick(int, org.vamsas.objects.core.Newick) 
541
542     /**
543      * Method setNewick
544      * 
545      * 
546      * 
547      * @param newickArray
548      */
549     public void setNewick(org.vamsas.objects.core.Newick[] newickArray)
550     {
551         //-- copy array
552         _newickList.removeAllElements();
553         for (int i = 0; i < newickArray.length; i++) {
554             _newickList.addElement(newickArray[i]);
555         }
556     } //-- void setNewick(org.vamsas.objects.core.Newick) 
557
558     /**
559      * Method setProperty
560      * 
561      * 
562      * 
563      * @param index
564      * @param vProperty
565      */
566     public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
567         throws java.lang.IndexOutOfBoundsException
568     {
569         //-- check bounds for index
570         if ((index < 0) || (index > _propertyList.size())) {
571             throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
572         }
573         _propertyList.setElementAt(vProperty, index);
574     } //-- void setProperty(int, org.vamsas.objects.core.Property) 
575
576     /**
577      * Method setProperty
578      * 
579      * 
580      * 
581      * @param propertyArray
582      */
583     public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
584     {
585         //-- copy array
586         _propertyList.removeAllElements();
587         for (int i = 0; i < propertyArray.length; i++) {
588             _propertyList.addElement(propertyArray[i]);
589         }
590     } //-- void setProperty(org.vamsas.objects.core.Property) 
591
592     /**
593      * Sets the value of field 'provenance'.
594      * 
595      * @param provenance the value of field 'provenance'.
596      */
597     public void setProvenance(org.vamsas.objects.core.Provenance provenance)
598     {
599         this._provenance = provenance;
600     } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
601
602     /**
603      * Sets the value of field 'title'.
604      * 
605      * @param title the value of field 'title'.
606      */
607     public void setTitle(java.lang.String title)
608     {
609         this._title = title;
610     } //-- void setTitle(java.lang.String) 
611
612     /**
613      * Method unmarshal
614      * 
615      * 
616      * 
617      * @param reader
618      * @return Tree
619      */
620     public static org.vamsas.objects.core.Tree unmarshal(java.io.Reader reader)
621         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
622     {
623         return (org.vamsas.objects.core.Tree) Unmarshaller.unmarshal(org.vamsas.objects.core.Tree.class, reader);
624     } //-- org.vamsas.objects.core.Tree unmarshal(java.io.Reader) 
625
626     /**
627      * Method validate
628      * 
629      */
630     public void validate()
631         throws org.exolab.castor.xml.ValidationException
632     {
633         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
634         validator.validate(this);
635     } //-- void validate() 
636
637 }