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;
165 if (this._id != null) {
166 if (temp._id == null) return false;
167 if (this._id != temp._id) {
168 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
169 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
170 if (thcycle!=tmcycle) {
171 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
172 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
176 if (!this._id.equals(temp._id)) {
177 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
178 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
181 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
182 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
185 } else if (temp._id != null)
187 if (this._modifiable != null) {
188 if (temp._modifiable == null) return false;
189 if (this._modifiable != temp._modifiable) {
190 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
191 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
192 if (thcycle!=tmcycle) {
193 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
194 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
198 if (!this._modifiable.equals(temp._modifiable)) {
199 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
200 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
203 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
204 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
207 } else if (temp._modifiable != null)
209 if (this._treeList != null) {
210 if (temp._treeList == null) return false;
211 if (this._treeList != temp._treeList) {
212 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._treeList);
213 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._treeList);
214 if (thcycle!=tmcycle) {
215 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList); };
216 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList); };
220 if (!this._treeList.equals(temp._treeList)) {
221 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
222 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
225 org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
226 org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
229 } else if (temp._treeList != null)
231 if (this._dataSetList != null) {
232 if (temp._dataSetList == null) return false;
233 if (this._dataSetList != temp._dataSetList) {
234 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dataSetList);
235 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dataSetList);
236 if (thcycle!=tmcycle) {
237 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList); };
238 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList); };
242 if (!this._dataSetList.equals(temp._dataSetList)) {
243 org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList);
244 org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList);
247 org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList);
248 org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList);
251 } else if (temp._dataSetList != null)
262 * @throws java.lang.IndexOutOfBoundsException if the index
263 * given is outside the bounds of the collection
264 * @return the value of the uk.ac.vamsas.objects.core.DataSet
267 public uk.ac.vamsas.objects.core.DataSet getDataSet(
269 throws java.lang.IndexOutOfBoundsException {
270 // check bounds for index
271 if (index < 0 || index >= this._dataSetList.size()) {
272 throw new IndexOutOfBoundsException("getDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
275 return (uk.ac.vamsas.objects.core.DataSet) _dataSetList.get(index);
279 * Method getDataSet.Returns the contents of the collection in
280 * an Array. <p>Note: Just in case the collection contents
281 * are changing in another thread, we pass a 0-length Array of
282 * the correct type into the API call. This way we <i>know</i>
283 * that the Array returned is of exactly the correct length.
285 * @return this collection as an Array
287 public uk.ac.vamsas.objects.core.DataSet[] getDataSet(
289 uk.ac.vamsas.objects.core.DataSet[] array = new uk.ac.vamsas.objects.core.DataSet[0];
290 return (uk.ac.vamsas.objects.core.DataSet[]) this._dataSetList.toArray(array);
294 * Method getDataSetAsReference.Returns a reference to
295 * '_dataSetList'. No type checking is performed on any
296 * modifications to the Vector.
298 * @return a reference to the Vector backing this class
300 public java.util.Vector getDataSetAsReference(
302 return this._dataSetList;
306 * Method getDataSetCount.
308 * @return the size of this collection
310 public int getDataSetCount(
312 return this._dataSetList.size();
316 * Returns the value of field 'id'. The field 'id' has the
317 * following description: Primary Key for vamsas object
320 * @return the value of field 'Id'.
322 public java.lang.String getId(
328 * Returns the value of field 'modifiable'.
330 * @return the value of field 'Modifiable'.
332 public java.lang.String getModifiable(
334 return this._modifiable;
341 * @throws java.lang.IndexOutOfBoundsException if the index
342 * given is outside the bounds of the collection
343 * @return the value of the uk.ac.vamsas.objects.core.Tree at
346 public uk.ac.vamsas.objects.core.Tree getTree(
348 throws java.lang.IndexOutOfBoundsException {
349 // check bounds for index
350 if (index < 0 || index >= this._treeList.size()) {
351 throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
354 return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
358 * Method getTree.Returns the contents of the collection in an
359 * Array. <p>Note: Just in case the collection contents are
360 * changing in another thread, we pass a 0-length Array of the
361 * correct type into the API call. This way we <i>know</i>
362 * that the Array returned is of exactly the correct length.
364 * @return this collection as an Array
366 public uk.ac.vamsas.objects.core.Tree[] getTree(
368 uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
369 return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
373 * Method getTreeAsReference.Returns a reference to
374 * '_treeList'. No type checking is performed on any
375 * modifications to the Vector.
377 * @return a reference to the Vector backing this class
379 public java.util.Vector getTreeAsReference(
381 return this._treeList;
385 * Method getTreeCount.
387 * @return the size of this collection
389 public int getTreeCount(
391 return this._treeList.size();
395 * Overrides the java.lang.Object.hashCode method.
397 * The following steps came from <b>Effective Java Programming
398 * Language Guide</b> by Joshua Bloch, Chapter 3
400 * @return a hash code value for the object.
404 int result = super.hashCode();
408 && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
409 result = 37 * result + _id.hashCode();
410 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
412 if (_modifiable != null
413 && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
414 result = 37 * result + _modifiable.hashCode();
415 org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
417 if (_treeList != null
418 && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
419 result = 37 * result + _treeList.hashCode();
420 org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
422 if (_dataSetList != null
423 && !org.castor.util.CycleBreaker.startingToCycle(_dataSetList)) {
424 result = 37 * result + _dataSetList.hashCode();
425 org.castor.util.CycleBreaker.releaseCycleHandle(_dataSetList);
434 * @return true if this object is valid according to the schema
436 public boolean isValid(
440 } catch (org.exolab.castor.xml.ValidationException vex) {
450 * @throws org.exolab.castor.xml.MarshalException if object is
451 * null or if any SAXException is thrown during marshaling
452 * @throws org.exolab.castor.xml.ValidationException if this
453 * object is an invalid instance according to the schema
456 final java.io.Writer out)
457 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
458 Marshaller.marshal(this, out);
465 * @throws java.io.IOException if an IOException occurs during
467 * @throws org.exolab.castor.xml.ValidationException if this
468 * object is an invalid instance according to the schema
469 * @throws org.exolab.castor.xml.MarshalException if object is
470 * null or if any SAXException is thrown during marshaling
473 final org.xml.sax.ContentHandler handler)
474 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
475 Marshaller.marshal(this, handler);
480 public void removeAllDataSet(
482 this._dataSetList.clear();
487 public void removeAllTree(
489 this._treeList.clear();
493 * Method removeDataSet.
496 * @return true if the object was removed from the collection.
498 public boolean removeDataSet(
499 final uk.ac.vamsas.objects.core.DataSet vDataSet) {
500 boolean removed = _dataSetList.remove(vDataSet);
505 * Method removeDataSetAt.
508 * @return the element removed from the collection
510 public uk.ac.vamsas.objects.core.DataSet removeDataSetAt(
512 java.lang.Object obj = this._dataSetList.remove(index);
513 return (uk.ac.vamsas.objects.core.DataSet) obj;
520 * @return true if the object was removed from the collection.
522 public boolean removeTree(
523 final uk.ac.vamsas.objects.core.Tree vTree) {
524 boolean removed = _treeList.remove(vTree);
529 * Method removeTreeAt.
532 * @return the element removed from the collection
534 public uk.ac.vamsas.objects.core.Tree removeTreeAt(
536 java.lang.Object obj = this._treeList.remove(index);
537 return (uk.ac.vamsas.objects.core.Tree) obj;
545 * @throws java.lang.IndexOutOfBoundsException if the index
546 * given is outside the bounds of the collection
548 public void setDataSet(
550 final uk.ac.vamsas.objects.core.DataSet vDataSet)
551 throws java.lang.IndexOutOfBoundsException {
552 // check bounds for index
553 if (index < 0 || index >= this._dataSetList.size()) {
554 throw new IndexOutOfBoundsException("setDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
557 this._dataSetList.set(index, vDataSet);
563 * @param vDataSetArray
565 public void setDataSet(
566 final uk.ac.vamsas.objects.core.DataSet[] vDataSetArray) {
568 _dataSetList.clear();
570 for (int i = 0; i < vDataSetArray.length; i++) {
571 this._dataSetList.add(vDataSetArray[i]);
576 * Sets the value of '_dataSetList' by copying the given
577 * Vector. All elements will be checked for type safety.
579 * @param vDataSetList the Vector to copy.
581 public void setDataSet(
582 final java.util.Vector vDataSetList) {
584 this._dataSetList.clear();
586 this._dataSetList.addAll(vDataSetList);
590 * Sets the value of '_dataSetList' by setting it to the given
591 * Vector. No type checking is performed.
594 * @param dataSetVector the Vector to set.
596 public void setDataSetAsReference(
597 final java.util.Vector dataSetVector) {
598 this._dataSetList = dataSetVector;
602 * Sets the value of field 'id'. The field 'id' has the
603 * following description: Primary Key for vamsas object
606 * @param id the value of field 'id'.
609 final java.lang.String id) {
614 * Sets the value of field 'modifiable'.
616 * @param modifiable the value of field 'modifiable'.
618 public void setModifiable(
619 final java.lang.String modifiable) {
620 this._modifiable = modifiable;
628 * @throws java.lang.IndexOutOfBoundsException if the index
629 * given is outside the bounds of the collection
633 final uk.ac.vamsas.objects.core.Tree vTree)
634 throws java.lang.IndexOutOfBoundsException {
635 // check bounds for index
636 if (index < 0 || index >= this._treeList.size()) {
637 throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
640 this._treeList.set(index, vTree);
649 final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
653 for (int i = 0; i < vTreeArray.length; i++) {
654 this._treeList.add(vTreeArray[i]);
659 * Sets the value of '_treeList' by copying the given Vector.
660 * All elements will be checked for type safety.
662 * @param vTreeList the Vector to copy.
665 final java.util.Vector vTreeList) {
667 this._treeList.clear();
669 this._treeList.addAll(vTreeList);
673 * Sets the value of '_treeList' by setting it to the given
674 * Vector. No type checking is performed.
677 * @param treeVector the Vector to set.
679 public void setTreeAsReference(
680 final java.util.Vector treeVector) {
681 this._treeList = treeVector;
688 * @throws org.exolab.castor.xml.MarshalException if object is
689 * null or if any SAXException is thrown during marshaling
690 * @throws org.exolab.castor.xml.ValidationException if this
691 * object is an invalid instance according to the schema
692 * @return the unmarshaled uk.ac.vamsas.objects.core.VAMSAS
694 public static uk.ac.vamsas.objects.core.VAMSAS unmarshal(
695 final java.io.Reader reader)
696 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
697 return (uk.ac.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VAMSAS.class, reader);
703 * @throws org.exolab.castor.xml.ValidationException if this
704 * object is an invalid instance according to the schema
706 public void validate(
708 throws org.exolab.castor.xml.ValidationException {
709 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
710 validator.validate(this);