2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package org.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 org.vamsas.client.Vobject
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Primary Key for vamsas object referencing
44 private java.lang.String _id;
47 * objects with modifiable=false will not be
48 * modified by a vamsas client update
51 private boolean _modifiable = true;
54 * keeps track of state for field: _modifiable
56 private boolean _has_modifiable;
61 private java.lang.String _title;
66 private java.util.Vector _newickList;
71 private java.util.Vector _propertyList;
76 private org.vamsas.objects.core.Provenance _provenance;
86 _newickList = new Vector();
87 _propertyList = new Vector();
88 } //-- org.vamsas.objects.core.Tree()
102 public void addNewick(org.vamsas.objects.core.Newick vNewick)
103 throws java.lang.IndexOutOfBoundsException
105 _newickList.addElement(vNewick);
106 } //-- void addNewick(org.vamsas.objects.core.Newick)
116 public void addNewick(int index, org.vamsas.objects.core.Newick vNewick)
117 throws java.lang.IndexOutOfBoundsException
119 _newickList.insertElementAt(vNewick, index);
120 } //-- void addNewick(int, org.vamsas.objects.core.Newick)
129 public void addProperty(org.vamsas.objects.core.Property vProperty)
130 throws java.lang.IndexOutOfBoundsException
132 _propertyList.addElement(vProperty);
133 } //-- void addProperty(org.vamsas.objects.core.Property)
143 public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
144 throws java.lang.IndexOutOfBoundsException
146 _propertyList.insertElementAt(vProperty, index);
147 } //-- void addProperty(int, org.vamsas.objects.core.Property)
150 * Method deleteModifiable
153 public void deleteModifiable()
155 this._has_modifiable= false;
156 } //-- void deleteModifiable()
159 * Method enumerateNewick
163 * @return Enumeration
165 public java.util.Enumeration enumerateNewick()
167 return _newickList.elements();
168 } //-- java.util.Enumeration enumerateNewick()
171 * Method enumerateProperty
175 * @return Enumeration
177 public java.util.Enumeration enumerateProperty()
179 return _propertyList.elements();
180 } //-- java.util.Enumeration enumerateProperty()
183 * Note: hashCode() has not been overriden
188 public boolean equals(java.lang.Object obj)
193 if (super.equals(obj)==false)
196 if (obj instanceof Tree) {
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)))
204 else if (temp._id != null)
206 if (this._modifiable != temp._modifiable)
208 if (this._has_modifiable != temp._has_modifiable)
210 if (this._title != null) {
211 if (temp._title == null) return false;
212 else if (!(this._title.equals(temp._title)))
215 else if (temp._title != null)
217 if (this._newickList != null) {
218 if (temp._newickList == null) return false;
219 else if (!(this._newickList.equals(temp._newickList)))
222 else if (temp._newickList != null)
224 if (this._propertyList != null) {
225 if (temp._propertyList == null) return false;
226 else if (!(this._propertyList.equals(temp._propertyList)))
229 else if (temp._propertyList != null)
231 if (this._provenance != null) {
232 if (temp._provenance == null) return false;
233 else if (!(this._provenance.equals(temp._provenance)))
236 else if (temp._provenance != null)
241 } //-- boolean equals(java.lang.Object)
244 * Returns the value of field 'id'. The field 'id' has the
245 * following description: Primary Key for vamsas object
250 * @return the value of field 'id'.
252 public java.lang.String getId()
255 } //-- java.lang.String getId()
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
265 * @return the value of field 'modifiable'.
267 public boolean getModifiable()
269 return this._modifiable;
270 } //-- boolean getModifiable()
280 public org.vamsas.objects.core.Newick getNewick(int index)
281 throws java.lang.IndexOutOfBoundsException
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()+ "]");
288 return (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
289 } //-- org.vamsas.objects.core.Newick getNewick(int)
298 public org.vamsas.objects.core.Newick[] getNewick()
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);
306 } //-- org.vamsas.objects.core.Newick[] getNewick()
309 * Method getNewickCount
315 public int getNewickCount()
317 return _newickList.size();
318 } //-- int getNewickCount()
328 public org.vamsas.objects.core.Property getProperty(int index)
329 throws java.lang.IndexOutOfBoundsException
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()+ "]");
336 return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
337 } //-- org.vamsas.objects.core.Property getProperty(int)
346 public org.vamsas.objects.core.Property[] getProperty()
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);
354 } //-- org.vamsas.objects.core.Property[] getProperty()
357 * Method getPropertyCount
363 public int getPropertyCount()
365 return _propertyList.size();
366 } //-- int getPropertyCount()
369 * Returns the value of field 'provenance'.
372 * @return the value of field 'provenance'.
374 public org.vamsas.objects.core.Provenance getProvenance()
376 return this._provenance;
377 } //-- org.vamsas.objects.core.Provenance getProvenance()
380 * Returns the value of field 'title'.
383 * @return the value of field 'title'.
385 public java.lang.String getTitle()
388 } //-- java.lang.String getTitle()
391 * Method hasModifiable
397 public boolean hasModifiable()
399 return this._has_modifiable;
400 } //-- boolean hasModifiable()
409 public boolean isValid()
414 catch (org.exolab.castor.xml.ValidationException vex) {
418 } //-- boolean isValid()
427 public void marshal(java.io.Writer out)
428 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
431 Marshaller.marshal(this, out);
432 } //-- void marshal(java.io.Writer)
441 public void marshal(org.xml.sax.ContentHandler handler)
442 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
445 Marshaller.marshal(this, handler);
446 } //-- void marshal(org.xml.sax.ContentHandler)
449 * Method removeAllNewick
452 public void removeAllNewick()
454 _newickList.removeAllElements();
455 } //-- void removeAllNewick()
458 * Method removeAllProperty
461 public void removeAllProperty()
463 _propertyList.removeAllElements();
464 } //-- void removeAllProperty()
467 * Method removeNewick
474 public org.vamsas.objects.core.Newick removeNewick(int index)
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)
482 * Method removeProperty
489 public org.vamsas.objects.core.Property removeProperty(int index)
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)
497 * Sets the value of field 'id'. The field 'id' has the
498 * following description: Primary Key for vamsas object
502 * @param id the value of field 'id'.
504 public void setId(java.lang.String id)
507 } //-- void setId(java.lang.String)
510 * Sets the value of field 'modifiable'. The field 'modifiable'
511 * has the following description: objects with modifiable=false
513 * modified by a vamsas client update
516 * @param modifiable the value of field 'modifiable'.
518 public void setModifiable(boolean modifiable)
520 this._modifiable = modifiable;
521 this._has_modifiable = true;
522 } //-- void setModifiable(boolean)
532 public void setNewick(int index, org.vamsas.objects.core.Newick vNewick)
533 throws java.lang.IndexOutOfBoundsException
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()+ "]");
539 _newickList.setElementAt(vNewick, index);
540 } //-- void setNewick(int, org.vamsas.objects.core.Newick)
549 public void setNewick(org.vamsas.objects.core.Newick[] newickArray)
552 _newickList.removeAllElements();
553 for (int i = 0; i < newickArray.length; i++) {
554 _newickList.addElement(newickArray[i]);
556 } //-- void setNewick(org.vamsas.objects.core.Newick)
566 public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
567 throws java.lang.IndexOutOfBoundsException
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()+ "]");
573 _propertyList.setElementAt(vProperty, index);
574 } //-- void setProperty(int, org.vamsas.objects.core.Property)
581 * @param propertyArray
583 public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
586 _propertyList.removeAllElements();
587 for (int i = 0; i < propertyArray.length; i++) {
588 _propertyList.addElement(propertyArray[i]);
590 } //-- void setProperty(org.vamsas.objects.core.Property)
593 * Sets the value of field 'provenance'.
595 * @param provenance the value of field 'provenance'.
597 public void setProvenance(org.vamsas.objects.core.Provenance provenance)
599 this._provenance = provenance;
600 } //-- void setProvenance(org.vamsas.objects.core.Provenance)
603 * Sets the value of field 'title'.
605 * @param title the value of field 'title'.
607 public void setTitle(java.lang.String title)
610 } //-- void setTitle(java.lang.String)
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
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)
630 public void validate()
631 throws org.exolab.castor.xml.ValidationException
633 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
634 validator.validate(this);
635 } //-- void validate()