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;
18 * contains unassociated trees and a number of analysis sets
21 * @version $Revision$ $Date$
23 public class VAMSAS extends uk.ac.vamsas.client.Vobject
24 implements java.io.Serializable
28 //--------------------------/
29 //- Class/Member Variables -/
30 //--------------------------/
33 * Primary Key for vamsas object referencing
35 private java.lang.String _id;
40 private java.lang.String _modifiable;
45 private java.util.Vector _treeList;
50 private java.util.Vector _dataSetList;
59 this._treeList = new java.util.Vector();
60 this._dataSetList = new java.util.Vector();
72 * @throws java.lang.IndexOutOfBoundsException if the index
73 * given is outside the bounds of the collection
75 public void addDataSet(
76 final uk.ac.vamsas.objects.core.DataSet vDataSet)
77 throws java.lang.IndexOutOfBoundsException {
78 this._dataSetList.addElement(vDataSet);
86 * @throws java.lang.IndexOutOfBoundsException if the index
87 * given is outside the bounds of the collection
89 public void addDataSet(
91 final uk.ac.vamsas.objects.core.DataSet vDataSet)
92 throws java.lang.IndexOutOfBoundsException {
93 this._dataSetList.add(index, vDataSet);
100 * @throws java.lang.IndexOutOfBoundsException if the index
101 * given is outside the bounds of the collection
104 final uk.ac.vamsas.objects.core.Tree vTree)
105 throws java.lang.IndexOutOfBoundsException {
106 this._treeList.addElement(vTree);
114 * @throws java.lang.IndexOutOfBoundsException if the index
115 * given is outside the bounds of the collection
119 final uk.ac.vamsas.objects.core.Tree vTree)
120 throws java.lang.IndexOutOfBoundsException {
121 this._treeList.add(index, vTree);
125 * Method enumerateDataSet.
127 * @return an Enumeration over all
128 * uk.ac.vamsas.objects.core.DataSet elements
130 public java.util.Enumeration enumerateDataSet(
132 return this._dataSetList.elements();
136 * Method enumerateTree.
138 * @return an Enumeration over all
139 * uk.ac.vamsas.objects.core.Tree elements
141 public java.util.Enumeration enumerateTree(
143 return this._treeList.elements();
147 * Overrides the java.lang.Object.equals method.
150 * @return true if the objects are equal.
152 public boolean equals(
153 final java.lang.Object obj) {
157 if (super.equals(obj)==false)
160 if (obj instanceof VAMSAS) {
162 VAMSAS temp = (VAMSAS)obj;
163 if (this._id != null) {
164 if (temp._id == null) return false;
165 else if (!(this._id.equals(temp._id)))
168 else if (temp._id != null)
170 if (this._modifiable != null) {
171 if (temp._modifiable == null) return false;
172 else if (!(this._modifiable.equals(temp._modifiable)))
175 else if (temp._modifiable != null)
177 if (this._treeList != null) {
178 if (temp._treeList == null) return false;
179 else if (!(this._treeList.equals(temp._treeList)))
182 else if (temp._treeList != null)
184 if (this._dataSetList != null) {
185 if (temp._dataSetList == null) return false;
186 else if (!(this._dataSetList.equals(temp._dataSetList)))
189 else if (temp._dataSetList != null)
200 * @throws java.lang.IndexOutOfBoundsException if the index
201 * given is outside the bounds of the collection
202 * @return the value of the uk.ac.vamsas.objects.core.DataSet
205 public uk.ac.vamsas.objects.core.DataSet getDataSet(
207 throws java.lang.IndexOutOfBoundsException {
208 // check bounds for index
209 if (index < 0 || index >= this._dataSetList.size()) {
210 throw new IndexOutOfBoundsException("getDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
213 return (uk.ac.vamsas.objects.core.DataSet) _dataSetList.get(index);
217 * Method getDataSet.Returns the contents of the collection in
218 * an Array. <p>Note: Just in case the collection contents
219 * are changing in another thread, we pass a 0-length Array of
220 * the correct type into the API call. This way we <i>know</i>
221 * that the Array returned is of exactly the correct length.
223 * @return this collection as an Array
225 public uk.ac.vamsas.objects.core.DataSet[] getDataSet(
227 uk.ac.vamsas.objects.core.DataSet[] array = new uk.ac.vamsas.objects.core.DataSet[0];
228 return (uk.ac.vamsas.objects.core.DataSet[]) this._dataSetList.toArray(array);
232 * Method getDataSetAsReference.Returns a reference to
233 * '_dataSetList'. No type checking is performed on any
234 * modifications to the Vector.
236 * @return a reference to the Vector backing this class
238 public java.util.Vector getDataSetAsReference(
240 return this._dataSetList;
244 * Method getDataSetCount.
246 * @return the size of this collection
248 public int getDataSetCount(
250 return this._dataSetList.size();
254 * Returns the value of field 'id'. The field 'id' has the
255 * following description: Primary Key for vamsas object
258 * @return the value of field 'Id'.
260 public java.lang.String getId(
266 * Returns the value of field 'modifiable'.
268 * @return the value of field 'Modifiable'.
270 public java.lang.String getModifiable(
272 return this._modifiable;
279 * @throws java.lang.IndexOutOfBoundsException if the index
280 * given is outside the bounds of the collection
281 * @return the value of the uk.ac.vamsas.objects.core.Tree at
284 public uk.ac.vamsas.objects.core.Tree getTree(
286 throws java.lang.IndexOutOfBoundsException {
287 // check bounds for index
288 if (index < 0 || index >= this._treeList.size()) {
289 throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
292 return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
296 * Method getTree.Returns the contents of the collection in an
297 * Array. <p>Note: Just in case the collection contents are
298 * changing in another thread, we pass a 0-length Array of the
299 * correct type into the API call. This way we <i>know</i>
300 * that the Array returned is of exactly the correct length.
302 * @return this collection as an Array
304 public uk.ac.vamsas.objects.core.Tree[] getTree(
306 uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
307 return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
311 * Method getTreeAsReference.Returns a reference to
312 * '_treeList'. No type checking is performed on any
313 * modifications to the Vector.
315 * @return a reference to the Vector backing this class
317 public java.util.Vector getTreeAsReference(
319 return this._treeList;
323 * Method getTreeCount.
325 * @return the size of this collection
327 public int getTreeCount(
329 return this._treeList.size();
333 * Overrides the java.lang.Object.hashCode method.
335 * The following steps came from <b>Effective Java Programming
336 * Language Guide</b> by Joshua Bloch, Chapter 3
338 * @return a hash code value for the object.
342 int result = super.hashCode();
346 result = 37 * result + _id.hashCode();
348 if (_modifiable != null) {
349 result = 37 * result + _modifiable.hashCode();
351 if (_treeList != null) {
352 result = 37 * result + _treeList.hashCode();
354 if (_dataSetList != null) {
355 result = 37 * result + _dataSetList.hashCode();
364 * @return true if this object is valid according to the schema
366 public boolean isValid(
370 } catch (org.exolab.castor.xml.ValidationException vex) {
380 * @throws org.exolab.castor.xml.MarshalException if object is
381 * null or if any SAXException is thrown during marshaling
382 * @throws org.exolab.castor.xml.ValidationException if this
383 * object is an invalid instance according to the schema
386 final java.io.Writer out)
387 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
388 Marshaller.marshal(this, out);
395 * @throws java.io.IOException if an IOException occurs during
397 * @throws org.exolab.castor.xml.ValidationException if this
398 * object is an invalid instance according to the schema
399 * @throws org.exolab.castor.xml.MarshalException if object is
400 * null or if any SAXException is thrown during marshaling
403 final org.xml.sax.ContentHandler handler)
404 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
405 Marshaller.marshal(this, handler);
410 public void removeAllDataSet(
412 this._dataSetList.clear();
417 public void removeAllTree(
419 this._treeList.clear();
423 * Method removeDataSet.
426 * @return true if the object was removed from the collection.
428 public boolean removeDataSet(
429 final uk.ac.vamsas.objects.core.DataSet vDataSet) {
430 boolean removed = _dataSetList.remove(vDataSet);
435 * Method removeDataSetAt.
438 * @return the element removed from the collection
440 public uk.ac.vamsas.objects.core.DataSet removeDataSetAt(
442 java.lang.Object obj = this._dataSetList.remove(index);
443 return (uk.ac.vamsas.objects.core.DataSet) obj;
450 * @return true if the object was removed from the collection.
452 public boolean removeTree(
453 final uk.ac.vamsas.objects.core.Tree vTree) {
454 boolean removed = _treeList.remove(vTree);
459 * Method removeTreeAt.
462 * @return the element removed from the collection
464 public uk.ac.vamsas.objects.core.Tree removeTreeAt(
466 java.lang.Object obj = this._treeList.remove(index);
467 return (uk.ac.vamsas.objects.core.Tree) obj;
475 * @throws java.lang.IndexOutOfBoundsException if the index
476 * given is outside the bounds of the collection
478 public void setDataSet(
480 final uk.ac.vamsas.objects.core.DataSet vDataSet)
481 throws java.lang.IndexOutOfBoundsException {
482 // check bounds for index
483 if (index < 0 || index >= this._dataSetList.size()) {
484 throw new IndexOutOfBoundsException("setDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
487 this._dataSetList.set(index, vDataSet);
493 * @param vDataSetArray
495 public void setDataSet(
496 final uk.ac.vamsas.objects.core.DataSet[] vDataSetArray) {
498 _dataSetList.clear();
500 for (int i = 0; i < vDataSetArray.length; i++) {
501 this._dataSetList.add(vDataSetArray[i]);
506 * Sets the value of '_dataSetList' by copying the given
507 * Vector. All elements will be checked for type safety.
509 * @param vDataSetList the Vector to copy.
511 public void setDataSet(
512 final java.util.Vector vDataSetList) {
514 this._dataSetList.clear();
516 this._dataSetList.addAll(vDataSetList);
520 * Sets the value of '_dataSetList' by setting it to the given
521 * Vector. No type checking is performed.
524 * @param dataSetVector the Vector to set.
526 public void setDataSetAsReference(
527 final java.util.Vector dataSetVector) {
528 this._dataSetList = dataSetVector;
532 * Sets the value of field 'id'. The field 'id' has the
533 * following description: Primary Key for vamsas object
536 * @param id the value of field 'id'.
539 final java.lang.String id) {
544 * Sets the value of field 'modifiable'.
546 * @param modifiable the value of field 'modifiable'.
548 public void setModifiable(
549 final java.lang.String modifiable) {
550 this._modifiable = modifiable;
558 * @throws java.lang.IndexOutOfBoundsException if the index
559 * given is outside the bounds of the collection
563 final uk.ac.vamsas.objects.core.Tree vTree)
564 throws java.lang.IndexOutOfBoundsException {
565 // check bounds for index
566 if (index < 0 || index >= this._treeList.size()) {
567 throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
570 this._treeList.set(index, vTree);
579 final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
583 for (int i = 0; i < vTreeArray.length; i++) {
584 this._treeList.add(vTreeArray[i]);
589 * Sets the value of '_treeList' by copying the given Vector.
590 * All elements will be checked for type safety.
592 * @param vTreeList the Vector to copy.
595 final java.util.Vector vTreeList) {
597 this._treeList.clear();
599 this._treeList.addAll(vTreeList);
603 * Sets the value of '_treeList' by setting it to the given
604 * Vector. No type checking is performed.
607 * @param treeVector the Vector to set.
609 public void setTreeAsReference(
610 final java.util.Vector treeVector) {
611 this._treeList = treeVector;
618 * @throws org.exolab.castor.xml.MarshalException if object is
619 * null or if any SAXException is thrown during marshaling
620 * @throws org.exolab.castor.xml.ValidationException if this
621 * object is an invalid instance according to the schema
622 * @return the unmarshaled uk.ac.vamsas.objects.core.VAMSAS
624 public static uk.ac.vamsas.objects.core.VAMSAS unmarshal(
625 final java.io.Reader reader)
626 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
627 return (uk.ac.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VAMSAS.class, reader);
633 * @throws org.exolab.castor.xml.ValidationException if this
634 * object is an invalid instance according to the schema
636 public void validate(
638 throws org.exolab.castor.xml.ValidationException {
639 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
640 validator.validate(this);