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