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;
27 * contains unassociated trees and a number of analysis sets
30 * @version $Revision$ $Date$
32 public class VAMSAS extends uk.ac.vamsas.client.Vobject
33 implements java.io.Serializable
37 //--------------------------/
38 //- Class/Member Variables -/
39 //--------------------------/
42 * Primary Key for vamsas object referencing
44 private java.lang.String _id;
49 private java.lang.String _modifiable;
54 private java.util.Vector _treeList;
59 private java.util.Vector _dataSetList;
69 _treeList = new Vector();
70 _dataSetList = new Vector();
71 } //-- uk.ac.vamsas.objects.core.VAMSAS()
85 public void addDataSet(uk.ac.vamsas.objects.core.DataSet vDataSet)
86 throws java.lang.IndexOutOfBoundsException
88 _dataSetList.addElement(vDataSet);
89 } //-- void addDataSet(uk.ac.vamsas.objects.core.DataSet)
99 public void addDataSet(int index, uk.ac.vamsas.objects.core.DataSet vDataSet)
100 throws java.lang.IndexOutOfBoundsException
102 _dataSetList.insertElementAt(vDataSet, index);
103 } //-- void addDataSet(int, uk.ac.vamsas.objects.core.DataSet)
112 public void addTree(uk.ac.vamsas.objects.core.Tree vTree)
113 throws java.lang.IndexOutOfBoundsException
115 _treeList.addElement(vTree);
116 } //-- void addTree(uk.ac.vamsas.objects.core.Tree)
126 public void addTree(int index, uk.ac.vamsas.objects.core.Tree vTree)
127 throws java.lang.IndexOutOfBoundsException
129 _treeList.insertElementAt(vTree, index);
130 } //-- void addTree(int, uk.ac.vamsas.objects.core.Tree)
133 * Method enumerateDataSet
137 * @return Enumeration
139 public java.util.Enumeration enumerateDataSet()
141 return _dataSetList.elements();
142 } //-- java.util.Enumeration enumerateDataSet()
145 * Method enumerateTree
149 * @return Enumeration
151 public java.util.Enumeration enumerateTree()
153 return _treeList.elements();
154 } //-- java.util.Enumeration enumerateTree()
157 * Note: hashCode() has not been overriden
162 public boolean equals(java.lang.Object obj)
167 if (super.equals(obj)==false)
170 if (obj instanceof VAMSAS) {
172 VAMSAS temp = (VAMSAS)obj;
173 if (this._id != null) {
174 if (temp._id == null) return false;
175 else if (!(this._id.equals(temp._id)))
178 else if (temp._id != null)
180 if (this._modifiable != null) {
181 if (temp._modifiable == null) return false;
182 else if (!(this._modifiable.equals(temp._modifiable)))
185 else if (temp._modifiable != null)
187 if (this._treeList != null) {
188 if (temp._treeList == null) return false;
189 else if (!(this._treeList.equals(temp._treeList)))
192 else if (temp._treeList != null)
194 if (this._dataSetList != null) {
195 if (temp._dataSetList == null) return false;
196 else if (!(this._dataSetList.equals(temp._dataSetList)))
199 else if (temp._dataSetList != null)
204 } //-- boolean equals(java.lang.Object)
214 public uk.ac.vamsas.objects.core.DataSet getDataSet(int index)
215 throws java.lang.IndexOutOfBoundsException
217 //-- check bounds for index
218 if ((index < 0) || (index > _dataSetList.size())) {
219 throw new IndexOutOfBoundsException("getDataSet: Index value '"+index+"' not in range [0.."+_dataSetList.size()+ "]");
222 return (uk.ac.vamsas.objects.core.DataSet) _dataSetList.elementAt(index);
223 } //-- uk.ac.vamsas.objects.core.DataSet getDataSet(int)
232 public uk.ac.vamsas.objects.core.DataSet[] getDataSet()
234 int size = _dataSetList.size();
235 uk.ac.vamsas.objects.core.DataSet[] mArray = new uk.ac.vamsas.objects.core.DataSet[size];
236 for (int index = 0; index < size; index++) {
237 mArray[index] = (uk.ac.vamsas.objects.core.DataSet) _dataSetList.elementAt(index);
240 } //-- uk.ac.vamsas.objects.core.DataSet[] getDataSet()
243 * Method getDataSetCount
249 public int getDataSetCount()
251 return _dataSetList.size();
252 } //-- int getDataSetCount()
255 * Returns the value of field 'id'. The field 'id' has the
256 * following description: Primary Key for vamsas object
260 * @return the value of field 'id'.
262 public java.lang.String getId()
265 } //-- java.lang.String getId()
268 * Returns the value of field 'modifiable'.
271 * @return the value of field 'modifiable'.
273 public java.lang.String getModifiable()
275 return this._modifiable;
276 } //-- java.lang.String getModifiable()
286 public uk.ac.vamsas.objects.core.Tree getTree(int index)
287 throws java.lang.IndexOutOfBoundsException
289 //-- check bounds for index
290 if ((index < 0) || (index > _treeList.size())) {
291 throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
294 return (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index);
295 } //-- uk.ac.vamsas.objects.core.Tree getTree(int)
304 public uk.ac.vamsas.objects.core.Tree[] getTree()
306 int size = _treeList.size();
307 uk.ac.vamsas.objects.core.Tree[] mArray = new uk.ac.vamsas.objects.core.Tree[size];
308 for (int index = 0; index < size; index++) {
309 mArray[index] = (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index);
312 } //-- uk.ac.vamsas.objects.core.Tree[] getTree()
315 * Method getTreeCount
321 public int getTreeCount()
323 return _treeList.size();
324 } //-- int getTreeCount()
333 public boolean isValid()
338 catch (org.exolab.castor.xml.ValidationException vex) {
342 } //-- boolean isValid()
351 public void marshal(java.io.Writer out)
352 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
355 Marshaller.marshal(this, out);
356 } //-- void marshal(java.io.Writer)
365 public void marshal(org.xml.sax.ContentHandler handler)
366 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
369 Marshaller.marshal(this, handler);
370 } //-- void marshal(org.xml.sax.ContentHandler)
373 * Method removeAllDataSet
376 public void removeAllDataSet()
378 _dataSetList.removeAllElements();
379 } //-- void removeAllDataSet()
382 * Method removeAllTree
385 public void removeAllTree()
387 _treeList.removeAllElements();
388 } //-- void removeAllTree()
391 * Method removeDataSet
398 public uk.ac.vamsas.objects.core.DataSet removeDataSet(int index)
400 java.lang.Object obj = _dataSetList.elementAt(index);
401 _dataSetList.removeElementAt(index);
402 return (uk.ac.vamsas.objects.core.DataSet) obj;
403 } //-- uk.ac.vamsas.objects.core.DataSet removeDataSet(int)
413 public uk.ac.vamsas.objects.core.Tree removeTree(int index)
415 java.lang.Object obj = _treeList.elementAt(index);
416 _treeList.removeElementAt(index);
417 return (uk.ac.vamsas.objects.core.Tree) obj;
418 } //-- uk.ac.vamsas.objects.core.Tree removeTree(int)
428 public void setDataSet(int index, uk.ac.vamsas.objects.core.DataSet vDataSet)
429 throws java.lang.IndexOutOfBoundsException
431 //-- check bounds for index
432 if ((index < 0) || (index > _dataSetList.size())) {
433 throw new IndexOutOfBoundsException("setDataSet: Index value '"+index+"' not in range [0.."+_dataSetList.size()+ "]");
435 _dataSetList.setElementAt(vDataSet, index);
436 } //-- void setDataSet(int, uk.ac.vamsas.objects.core.DataSet)
443 * @param dataSetArray
445 public void setDataSet(uk.ac.vamsas.objects.core.DataSet[] dataSetArray)
448 _dataSetList.removeAllElements();
449 for (int i = 0; i < dataSetArray.length; i++) {
450 _dataSetList.addElement(dataSetArray[i]);
452 } //-- void setDataSet(uk.ac.vamsas.objects.core.DataSet)
455 * Sets the value of field 'id'. The field 'id' has the
456 * following description: Primary Key for vamsas object
459 * @param id the value of field 'id'.
461 public void setId(java.lang.String id)
464 } //-- void setId(java.lang.String)
467 * Sets the value of field 'modifiable'.
469 * @param modifiable the value of field 'modifiable'.
471 public void setModifiable(java.lang.String modifiable)
473 this._modifiable = modifiable;
474 } //-- void setModifiable(java.lang.String)
484 public void setTree(int index, uk.ac.vamsas.objects.core.Tree vTree)
485 throws java.lang.IndexOutOfBoundsException
487 //-- check bounds for index
488 if ((index < 0) || (index > _treeList.size())) {
489 throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
491 _treeList.setElementAt(vTree, index);
492 } //-- void setTree(int, uk.ac.vamsas.objects.core.Tree)
501 public void setTree(uk.ac.vamsas.objects.core.Tree[] treeArray)
504 _treeList.removeAllElements();
505 for (int i = 0; i < treeArray.length; i++) {
506 _treeList.addElement(treeArray[i]);
508 } //-- void setTree(uk.ac.vamsas.objects.core.Tree)
518 public static uk.ac.vamsas.objects.core.VAMSAS unmarshal(java.io.Reader reader)
519 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
521 return (uk.ac.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VAMSAS.class, reader);
522 } //-- uk.ac.vamsas.objects.core.VAMSAS unmarshal(java.io.Reader)
528 public void validate()
529 throws org.exolab.castor.xml.ValidationException
531 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
532 validator.validate(this);
533 } //-- void validate()