2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package uk.ac.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
20 * @version $Revision$ $Date$
22 public class Tree extends uk.ac.vamsas.client.Vobject
23 implements java.io.Serializable
27 //--------------------------/
28 //- Class/Member Variables -/
29 //--------------------------/
32 * Primary Key for vamsas object referencing
34 private java.lang.String _id;
39 private java.lang.String _modifiable;
44 private java.lang.String _title;
49 private java.util.Vector _newickList;
52 * Field _propertyList.
54 private java.util.Vector _propertyList;
59 private uk.ac.vamsas.objects.core.Provenance _provenance;
68 this._newickList = new java.util.Vector();
69 this._propertyList = new java.util.Vector();
81 * @throws java.lang.IndexOutOfBoundsException if the index
82 * given is outside the bounds of the collection
84 public void addNewick(
85 final uk.ac.vamsas.objects.core.Newick vNewick)
86 throws java.lang.IndexOutOfBoundsException {
87 this._newickList.addElement(vNewick);
95 * @throws java.lang.IndexOutOfBoundsException if the index
96 * given is outside the bounds of the collection
98 public void addNewick(
100 final uk.ac.vamsas.objects.core.Newick vNewick)
101 throws java.lang.IndexOutOfBoundsException {
102 this._newickList.add(index, vNewick);
109 * @throws java.lang.IndexOutOfBoundsException if the index
110 * given is outside the bounds of the collection
112 public void addProperty(
113 final uk.ac.vamsas.objects.core.Property vProperty)
114 throws java.lang.IndexOutOfBoundsException {
115 this._propertyList.addElement(vProperty);
123 * @throws java.lang.IndexOutOfBoundsException if the index
124 * given is outside the bounds of the collection
126 public void addProperty(
128 final uk.ac.vamsas.objects.core.Property vProperty)
129 throws java.lang.IndexOutOfBoundsException {
130 this._propertyList.add(index, vProperty);
134 * Method enumerateNewick.
136 * @return an Enumeration over all
137 * uk.ac.vamsas.objects.core.Newick elements
139 public java.util.Enumeration enumerateNewick(
141 return this._newickList.elements();
145 * Method enumerateProperty.
147 * @return an Enumeration over all
148 * uk.ac.vamsas.objects.core.Property elements
150 public java.util.Enumeration enumerateProperty(
152 return this._propertyList.elements();
156 * Overrides the java.lang.Object.equals method.
159 * @return true if the objects are equal.
161 public boolean equals(
162 final java.lang.Object obj) {
166 if (super.equals(obj)==false)
169 if (obj instanceof Tree) {
171 Tree temp = (Tree)obj;
172 if (this._id != null) {
173 if (temp._id == null) return false;
174 else if (!(this._id.equals(temp._id)))
177 else if (temp._id != null)
179 if (this._modifiable != null) {
180 if (temp._modifiable == null) return false;
181 else if (!(this._modifiable.equals(temp._modifiable)))
184 else if (temp._modifiable != null)
186 if (this._title != null) {
187 if (temp._title == null) return false;
188 else if (!(this._title.equals(temp._title)))
191 else if (temp._title != null)
193 if (this._newickList != null) {
194 if (temp._newickList == null) return false;
195 else if (!(this._newickList.equals(temp._newickList)))
198 else if (temp._newickList != null)
200 if (this._propertyList != null) {
201 if (temp._propertyList == null) return false;
202 else if (!(this._propertyList.equals(temp._propertyList)))
205 else if (temp._propertyList != null)
207 if (this._provenance != null) {
208 if (temp._provenance == null) return false;
209 else if (!(this._provenance.equals(temp._provenance)))
212 else if (temp._provenance != null)
220 * Returns the value of field 'id'. The field 'id' has the
221 * following description: Primary Key for vamsas object
224 * @return the value of field 'Id'.
226 public java.lang.String getId(
232 * Returns the value of field 'modifiable'.
234 * @return the value of field 'Modifiable'.
236 public java.lang.String getModifiable(
238 return this._modifiable;
245 * @throws java.lang.IndexOutOfBoundsException if the index
246 * given is outside the bounds of the collection
247 * @return the value of the uk.ac.vamsas.objects.core.Newick at
250 public uk.ac.vamsas.objects.core.Newick getNewick(
252 throws java.lang.IndexOutOfBoundsException {
253 // check bounds for index
254 if (index < 0 || index >= this._newickList.size()) {
255 throw new IndexOutOfBoundsException("getNewick: Index value '" + index + "' not in range [0.." + (this._newickList.size() - 1) + "]");
258 return (uk.ac.vamsas.objects.core.Newick) _newickList.get(index);
262 * Method getNewick.Returns the contents of the collection in
263 * an Array. <p>Note: Just in case the collection contents
264 * are changing in another thread, we pass a 0-length Array of
265 * the correct type into the API call. This way we <i>know</i>
266 * that the Array returned is of exactly the correct length.
268 * @return this collection as an Array
270 public uk.ac.vamsas.objects.core.Newick[] getNewick(
272 uk.ac.vamsas.objects.core.Newick[] array = new uk.ac.vamsas.objects.core.Newick[0];
273 return (uk.ac.vamsas.objects.core.Newick[]) this._newickList.toArray(array);
277 * Method getNewickAsReference.Returns a reference to
278 * '_newickList'. No type checking is performed on any
279 * modifications to the Vector.
281 * @return a reference to the Vector backing this class
283 public java.util.Vector getNewickAsReference(
285 return this._newickList;
289 * Method getNewickCount.
291 * @return the size of this collection
293 public int getNewickCount(
295 return this._newickList.size();
299 * Method getProperty.
302 * @throws java.lang.IndexOutOfBoundsException if the index
303 * given is outside the bounds of the collection
304 * @return the value of the uk.ac.vamsas.objects.core.Property
307 public uk.ac.vamsas.objects.core.Property getProperty(
309 throws java.lang.IndexOutOfBoundsException {
310 // check bounds for index
311 if (index < 0 || index >= this._propertyList.size()) {
312 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
315 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
319 * Method getProperty.Returns the contents of the collection in
320 * an Array. <p>Note: Just in case the collection contents
321 * are changing in another thread, we pass a 0-length Array of
322 * the correct type into the API call. This way we <i>know</i>
323 * that the Array returned is of exactly the correct length.
325 * @return this collection as an Array
327 public uk.ac.vamsas.objects.core.Property[] getProperty(
329 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
330 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
334 * Method getPropertyAsReference.Returns a reference to
335 * '_propertyList'. No type checking is performed on any
336 * modifications to the Vector.
338 * @return a reference to the Vector backing this class
340 public java.util.Vector getPropertyAsReference(
342 return this._propertyList;
346 * Method getPropertyCount.
348 * @return the size of this collection
350 public int getPropertyCount(
352 return this._propertyList.size();
356 * Returns the value of field 'provenance'.
358 * @return the value of field 'Provenance'.
360 public uk.ac.vamsas.objects.core.Provenance getProvenance(
362 return this._provenance;
366 * Returns the value of field 'title'.
368 * @return the value of field 'Title'.
370 public java.lang.String getTitle(
376 * Overrides the java.lang.Object.hashCode method.
378 * The following steps came from <b>Effective Java Programming
379 * Language Guide</b> by Joshua Bloch, Chapter 3
381 * @return a hash code value for the object.
385 int result = super.hashCode();
389 result = 37 * result + _id.hashCode();
391 if (_modifiable != null) {
392 result = 37 * result + _modifiable.hashCode();
394 if (_title != null) {
395 result = 37 * result + _title.hashCode();
397 if (_newickList != null) {
398 result = 37 * result + _newickList.hashCode();
400 if (_propertyList != null) {
401 result = 37 * result + _propertyList.hashCode();
403 if (_provenance != null) {
404 result = 37 * result + _provenance.hashCode();
413 * @return true if this object is valid according to the schema
415 public boolean isValid(
419 } catch (org.exolab.castor.xml.ValidationException vex) {
429 * @throws org.exolab.castor.xml.MarshalException if object is
430 * null or if any SAXException is thrown during marshaling
431 * @throws org.exolab.castor.xml.ValidationException if this
432 * object is an invalid instance according to the schema
435 final java.io.Writer out)
436 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
437 Marshaller.marshal(this, out);
444 * @throws java.io.IOException if an IOException occurs during
446 * @throws org.exolab.castor.xml.ValidationException if this
447 * object is an invalid instance according to the schema
448 * @throws org.exolab.castor.xml.MarshalException if object is
449 * null or if any SAXException is thrown during marshaling
452 final org.xml.sax.ContentHandler handler)
453 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
454 Marshaller.marshal(this, handler);
459 public void removeAllNewick(
461 this._newickList.clear();
466 public void removeAllProperty(
468 this._propertyList.clear();
472 * Method removeNewick.
475 * @return true if the object was removed from the collection.
477 public boolean removeNewick(
478 final uk.ac.vamsas.objects.core.Newick vNewick) {
479 boolean removed = _newickList.remove(vNewick);
484 * Method removeNewickAt.
487 * @return the element removed from the collection
489 public uk.ac.vamsas.objects.core.Newick removeNewickAt(
491 java.lang.Object obj = this._newickList.remove(index);
492 return (uk.ac.vamsas.objects.core.Newick) obj;
496 * Method removeProperty.
499 * @return true if the object was removed from the collection.
501 public boolean removeProperty(
502 final uk.ac.vamsas.objects.core.Property vProperty) {
503 boolean removed = _propertyList.remove(vProperty);
508 * Method removePropertyAt.
511 * @return the element removed from the collection
513 public uk.ac.vamsas.objects.core.Property removePropertyAt(
515 java.lang.Object obj = this._propertyList.remove(index);
516 return (uk.ac.vamsas.objects.core.Property) obj;
520 * Sets the value of field 'id'. The field 'id' has the
521 * following description: Primary Key for vamsas object
524 * @param id the value of field 'id'.
527 final java.lang.String id) {
532 * Sets the value of field 'modifiable'.
534 * @param modifiable the value of field 'modifiable'.
536 public void setModifiable(
537 final java.lang.String modifiable) {
538 this._modifiable = modifiable;
546 * @throws java.lang.IndexOutOfBoundsException if the index
547 * given is outside the bounds of the collection
549 public void setNewick(
551 final uk.ac.vamsas.objects.core.Newick vNewick)
552 throws java.lang.IndexOutOfBoundsException {
553 // check bounds for index
554 if (index < 0 || index >= this._newickList.size()) {
555 throw new IndexOutOfBoundsException("setNewick: Index value '" + index + "' not in range [0.." + (this._newickList.size() - 1) + "]");
558 this._newickList.set(index, vNewick);
564 * @param vNewickArray
566 public void setNewick(
567 final uk.ac.vamsas.objects.core.Newick[] vNewickArray) {
571 for (int i = 0; i < vNewickArray.length; i++) {
572 this._newickList.add(vNewickArray[i]);
577 * Sets the value of '_newickList' by copying the given Vector.
578 * All elements will be checked for type safety.
580 * @param vNewickList the Vector to copy.
582 public void setNewick(
583 final java.util.Vector vNewickList) {
585 this._newickList.clear();
587 this._newickList.addAll(vNewickList);
591 * Sets the value of '_newickList' by setting it to the given
592 * Vector. No type checking is performed.
595 * @param newickVector the Vector to set.
597 public void setNewickAsReference(
598 final java.util.Vector newickVector) {
599 this._newickList = newickVector;
607 * @throws java.lang.IndexOutOfBoundsException if the index
608 * given is outside the bounds of the collection
610 public void setProperty(
612 final uk.ac.vamsas.objects.core.Property vProperty)
613 throws java.lang.IndexOutOfBoundsException {
614 // check bounds for index
615 if (index < 0 || index >= this._propertyList.size()) {
616 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
619 this._propertyList.set(index, vProperty);
625 * @param vPropertyArray
627 public void setProperty(
628 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
630 _propertyList.clear();
632 for (int i = 0; i < vPropertyArray.length; i++) {
633 this._propertyList.add(vPropertyArray[i]);
638 * Sets the value of '_propertyList' by copying the given
639 * Vector. All elements will be checked for type safety.
641 * @param vPropertyList the Vector to copy.
643 public void setProperty(
644 final java.util.Vector vPropertyList) {
646 this._propertyList.clear();
648 this._propertyList.addAll(vPropertyList);
652 * Sets the value of '_propertyList' by setting it to the given
653 * Vector. No type checking is performed.
656 * @param propertyVector the Vector to set.
658 public void setPropertyAsReference(
659 final java.util.Vector propertyVector) {
660 this._propertyList = propertyVector;
664 * Sets the value of field 'provenance'.
666 * @param provenance the value of field 'provenance'.
668 public void setProvenance(
669 final uk.ac.vamsas.objects.core.Provenance provenance) {
670 this._provenance = provenance;
674 * Sets the value of field 'title'.
676 * @param title the value of field 'title'.
678 public void setTitle(
679 final java.lang.String title) {
687 * @throws org.exolab.castor.xml.MarshalException if object is
688 * null or if any SAXException is thrown during marshaling
689 * @throws org.exolab.castor.xml.ValidationException if this
690 * object is an invalid instance according to the schema
691 * @return the unmarshaled uk.ac.vamsas.objects.core.Tree
693 public static uk.ac.vamsas.objects.core.Tree unmarshal(
694 final java.io.Reader reader)
695 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
696 return (uk.ac.vamsas.objects.core.Tree) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Tree.class, reader);
702 * @throws org.exolab.castor.xml.ValidationException if this
703 * object is an invalid instance according to the schema
705 public void validate(
707 throws org.exolab.castor.xml.ValidationException {
708 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
709 validator.validate(this);