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;
29 * @version $Revision$ $Date$
31 public class Tree extends uk.ac.vamsas.client.Vobject
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Primary Key for vamsas object referencing
43 private java.lang.String _id;
48 private java.lang.String _modifiable;
53 private java.lang.String _title;
58 private java.util.Vector _newickList;
63 private java.util.Vector _propertyList;
68 private uk.ac.vamsas.objects.core.Provenance _provenance;
78 _newickList = new Vector();
79 _propertyList = new Vector();
80 } //-- uk.ac.vamsas.objects.core.Tree()
94 public void addNewick(uk.ac.vamsas.objects.core.Newick vNewick)
95 throws java.lang.IndexOutOfBoundsException
97 _newickList.addElement(vNewick);
98 } //-- void addNewick(uk.ac.vamsas.objects.core.Newick)
108 public void addNewick(int index, uk.ac.vamsas.objects.core.Newick vNewick)
109 throws java.lang.IndexOutOfBoundsException
111 _newickList.insertElementAt(vNewick, index);
112 } //-- void addNewick(int, uk.ac.vamsas.objects.core.Newick)
121 public void addProperty(uk.ac.vamsas.objects.core.Property vProperty)
122 throws java.lang.IndexOutOfBoundsException
124 _propertyList.addElement(vProperty);
125 } //-- void addProperty(uk.ac.vamsas.objects.core.Property)
135 public void addProperty(int index, uk.ac.vamsas.objects.core.Property vProperty)
136 throws java.lang.IndexOutOfBoundsException
138 _propertyList.insertElementAt(vProperty, index);
139 } //-- void addProperty(int, uk.ac.vamsas.objects.core.Property)
142 * Method enumerateNewick
146 * @return Enumeration
148 public java.util.Enumeration enumerateNewick()
150 return _newickList.elements();
151 } //-- java.util.Enumeration enumerateNewick()
154 * Method enumerateProperty
158 * @return Enumeration
160 public java.util.Enumeration enumerateProperty()
162 return _propertyList.elements();
163 } //-- java.util.Enumeration enumerateProperty()
166 * Note: hashCode() has not been overriden
171 public boolean equals(java.lang.Object obj)
176 if (super.equals(obj)==false)
179 if (obj instanceof Tree) {
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)))
187 else if (temp._id != null)
189 if (this._modifiable != null) {
190 if (temp._modifiable == null) return false;
191 else if (!(this._modifiable.equals(temp._modifiable)))
194 else if (temp._modifiable != null)
196 if (this._title != null) {
197 if (temp._title == null) return false;
198 else if (!(this._title.equals(temp._title)))
201 else if (temp._title != null)
203 if (this._newickList != null) {
204 if (temp._newickList == null) return false;
205 else if (!(this._newickList.equals(temp._newickList)))
208 else if (temp._newickList != null)
210 if (this._propertyList != null) {
211 if (temp._propertyList == null) return false;
212 else if (!(this._propertyList.equals(temp._propertyList)))
215 else if (temp._propertyList != null)
217 if (this._provenance != null) {
218 if (temp._provenance == null) return false;
219 else if (!(this._provenance.equals(temp._provenance)))
222 else if (temp._provenance != null)
227 } //-- boolean equals(java.lang.Object)
230 * Returns the value of field 'id'. The field 'id' has the
231 * following description: Primary Key for vamsas object
235 * @return the value of field 'id'.
237 public java.lang.String getId()
240 } //-- java.lang.String getId()
243 * Returns the value of field 'modifiable'.
246 * @return the value of field 'modifiable'.
248 public java.lang.String getModifiable()
250 return this._modifiable;
251 } //-- java.lang.String getModifiable()
261 public uk.ac.vamsas.objects.core.Newick getNewick(int index)
262 throws java.lang.IndexOutOfBoundsException
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()+ "]");
269 return (uk.ac.vamsas.objects.core.Newick) _newickList.elementAt(index);
270 } //-- uk.ac.vamsas.objects.core.Newick getNewick(int)
279 public uk.ac.vamsas.objects.core.Newick[] getNewick()
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);
287 } //-- uk.ac.vamsas.objects.core.Newick[] getNewick()
290 * Method getNewickCount
296 public int getNewickCount()
298 return _newickList.size();
299 } //-- int getNewickCount()
309 public uk.ac.vamsas.objects.core.Property getProperty(int index)
310 throws java.lang.IndexOutOfBoundsException
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()+ "]");
317 return (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index);
318 } //-- uk.ac.vamsas.objects.core.Property getProperty(int)
327 public uk.ac.vamsas.objects.core.Property[] getProperty()
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);
335 } //-- uk.ac.vamsas.objects.core.Property[] getProperty()
338 * Method getPropertyCount
344 public int getPropertyCount()
346 return _propertyList.size();
347 } //-- int getPropertyCount()
350 * Returns the value of field 'provenance'.
353 * @return the value of field 'provenance'.
355 public uk.ac.vamsas.objects.core.Provenance getProvenance()
357 return this._provenance;
358 } //-- uk.ac.vamsas.objects.core.Provenance getProvenance()
361 * Returns the value of field 'title'.
364 * @return the value of field 'title'.
366 public java.lang.String getTitle()
369 } //-- java.lang.String getTitle()
378 public boolean isValid()
383 catch (org.exolab.castor.xml.ValidationException vex) {
387 } //-- boolean isValid()
396 public void marshal(java.io.Writer out)
397 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
400 Marshaller.marshal(this, out);
401 } //-- void marshal(java.io.Writer)
410 public void marshal(org.xml.sax.ContentHandler handler)
411 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
414 Marshaller.marshal(this, handler);
415 } //-- void marshal(org.xml.sax.ContentHandler)
418 * Method removeAllNewick
421 public void removeAllNewick()
423 _newickList.removeAllElements();
424 } //-- void removeAllNewick()
427 * Method removeAllProperty
430 public void removeAllProperty()
432 _propertyList.removeAllElements();
433 } //-- void removeAllProperty()
436 * Method removeNewick
443 public uk.ac.vamsas.objects.core.Newick removeNewick(int index)
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)
451 * Method removeProperty
458 public uk.ac.vamsas.objects.core.Property removeProperty(int index)
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)
466 * Sets the value of field 'id'. The field 'id' has the
467 * following description: Primary Key for vamsas object
470 * @param id the value of field 'id'.
472 public void setId(java.lang.String id)
475 } //-- void setId(java.lang.String)
478 * Sets the value of field 'modifiable'.
480 * @param modifiable the value of field 'modifiable'.
482 public void setModifiable(java.lang.String modifiable)
484 this._modifiable = modifiable;
485 } //-- void setModifiable(java.lang.String)
495 public void setNewick(int index, uk.ac.vamsas.objects.core.Newick vNewick)
496 throws java.lang.IndexOutOfBoundsException
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()+ "]");
502 _newickList.setElementAt(vNewick, index);
503 } //-- void setNewick(int, uk.ac.vamsas.objects.core.Newick)
512 public void setNewick(uk.ac.vamsas.objects.core.Newick[] newickArray)
515 _newickList.removeAllElements();
516 for (int i = 0; i < newickArray.length; i++) {
517 _newickList.addElement(newickArray[i]);
519 } //-- void setNewick(uk.ac.vamsas.objects.core.Newick)
529 public void setProperty(int index, uk.ac.vamsas.objects.core.Property vProperty)
530 throws java.lang.IndexOutOfBoundsException
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()+ "]");
536 _propertyList.setElementAt(vProperty, index);
537 } //-- void setProperty(int, uk.ac.vamsas.objects.core.Property)
544 * @param propertyArray
546 public void setProperty(uk.ac.vamsas.objects.core.Property[] propertyArray)
549 _propertyList.removeAllElements();
550 for (int i = 0; i < propertyArray.length; i++) {
551 _propertyList.addElement(propertyArray[i]);
553 } //-- void setProperty(uk.ac.vamsas.objects.core.Property)
556 * Sets the value of field 'provenance'.
558 * @param provenance the value of field 'provenance'.
560 public void setProvenance(uk.ac.vamsas.objects.core.Provenance provenance)
562 this._provenance = provenance;
563 } //-- void setProvenance(uk.ac.vamsas.objects.core.Provenance)
566 * Sets the value of field 'title'.
568 * @param title the value of field 'title'.
570 public void setTitle(java.lang.String title)
573 } //-- void setTitle(java.lang.String)
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
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)
593 public void validate()
594 throws org.exolab.castor.xml.ValidationException
596 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
597 validator.validate(this);
598 } //-- void validate()