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.object
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
43 private java.lang.String _id;
48 private java.lang.String _title;
53 private java.util.Vector _newickList;
58 private org.vamsas.objects.core.Provenance _provenance;
68 _newickList = new Vector();
69 } //-- org.vamsas.objects.core.Tree()
83 public void addNewick(org.vamsas.objects.core.Newick vNewick)
84 throws java.lang.IndexOutOfBoundsException
86 _newickList.addElement(vNewick);
87 } //-- void addNewick(org.vamsas.objects.core.Newick)
97 public void addNewick(int index, org.vamsas.objects.core.Newick vNewick)
98 throws java.lang.IndexOutOfBoundsException
100 _newickList.insertElementAt(vNewick, index);
101 } //-- void addNewick(int, org.vamsas.objects.core.Newick)
104 * Method enumerateNewick
108 * @return Enumeration
110 public java.util.Enumeration enumerateNewick()
112 return _newickList.elements();
113 } //-- java.util.Enumeration enumerateNewick()
116 * Note: hashCode() has not been overriden
121 public boolean equals(java.lang.Object obj)
126 if (super.equals(obj)==false)
129 if (obj instanceof Tree) {
131 Tree temp = (Tree)obj;
132 if (this._id != null) {
133 if (temp._id == null) return false;
134 else if (!(this._id.equals(temp._id)))
137 else if (temp._id != null)
139 if (this._title != null) {
140 if (temp._title == null) return false;
141 else if (!(this._title.equals(temp._title)))
144 else if (temp._title != null)
146 if (this._newickList != null) {
147 if (temp._newickList == null) return false;
148 else if (!(this._newickList.equals(temp._newickList)))
151 else if (temp._newickList != null)
153 if (this._provenance != null) {
154 if (temp._provenance == null) return false;
155 else if (!(this._provenance.equals(temp._provenance)))
158 else if (temp._provenance != null)
163 } //-- boolean equals(java.lang.Object)
166 * Returns the value of field 'id'.
169 * @return the value of field 'id'.
171 public java.lang.String getId()
174 } //-- java.lang.String getId()
184 public org.vamsas.objects.core.Newick getNewick(int index)
185 throws java.lang.IndexOutOfBoundsException
187 //-- check bounds for index
188 if ((index < 0) || (index > _newickList.size())) {
189 throw new IndexOutOfBoundsException("getNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]");
192 return (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
193 } //-- org.vamsas.objects.core.Newick getNewick(int)
202 public org.vamsas.objects.core.Newick[] getNewick()
204 int size = _newickList.size();
205 org.vamsas.objects.core.Newick[] mArray = new org.vamsas.objects.core.Newick[size];
206 for (int index = 0; index < size; index++) {
207 mArray[index] = (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
210 } //-- org.vamsas.objects.core.Newick[] getNewick()
213 * Method getNewickCount
219 public int getNewickCount()
221 return _newickList.size();
222 } //-- int getNewickCount()
225 * Returns the value of field 'provenance'.
228 * @return the value of field 'provenance'.
230 public org.vamsas.objects.core.Provenance getProvenance()
232 return this._provenance;
233 } //-- org.vamsas.objects.core.Provenance getProvenance()
236 * Returns the value of field 'title'.
239 * @return the value of field 'title'.
241 public java.lang.String getTitle()
244 } //-- java.lang.String getTitle()
253 public boolean isValid()
258 catch (org.exolab.castor.xml.ValidationException vex) {
262 } //-- boolean isValid()
271 public void marshal(java.io.Writer out)
272 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
275 Marshaller.marshal(this, out);
276 } //-- void marshal(java.io.Writer)
285 public void marshal(org.xml.sax.ContentHandler handler)
286 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
289 Marshaller.marshal(this, handler);
290 } //-- void marshal(org.xml.sax.ContentHandler)
293 * Method removeAllNewick
296 public void removeAllNewick()
298 _newickList.removeAllElements();
299 } //-- void removeAllNewick()
302 * Method removeNewick
309 public org.vamsas.objects.core.Newick removeNewick(int index)
311 java.lang.Object obj = _newickList.elementAt(index);
312 _newickList.removeElementAt(index);
313 return (org.vamsas.objects.core.Newick) obj;
314 } //-- org.vamsas.objects.core.Newick removeNewick(int)
317 * Sets the value of field 'id'.
319 * @param id the value of field 'id'.
321 public void setId(java.lang.String id)
324 } //-- void setId(java.lang.String)
334 public void setNewick(int index, org.vamsas.objects.core.Newick vNewick)
335 throws java.lang.IndexOutOfBoundsException
337 //-- check bounds for index
338 if ((index < 0) || (index > _newickList.size())) {
339 throw new IndexOutOfBoundsException("setNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]");
341 _newickList.setElementAt(vNewick, index);
342 } //-- void setNewick(int, org.vamsas.objects.core.Newick)
351 public void setNewick(org.vamsas.objects.core.Newick[] newickArray)
354 _newickList.removeAllElements();
355 for (int i = 0; i < newickArray.length; i++) {
356 _newickList.addElement(newickArray[i]);
358 } //-- void setNewick(org.vamsas.objects.core.Newick)
361 * Sets the value of field 'provenance'.
363 * @param provenance the value of field 'provenance'.
365 public void setProvenance(org.vamsas.objects.core.Provenance provenance)
367 this._provenance = provenance;
368 } //-- void setProvenance(org.vamsas.objects.core.Provenance)
371 * Sets the value of field 'title'.
373 * @param title the value of field 'title'.
375 public void setTitle(java.lang.String title)
378 } //-- void setTitle(java.lang.String)
388 public static org.vamsas.objects.core.Tree unmarshal(java.io.Reader reader)
389 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
391 return (org.vamsas.objects.core.Tree) Unmarshaller.unmarshal(org.vamsas.objects.core.Tree.class, reader);
392 } //-- org.vamsas.objects.core.Tree unmarshal(java.io.Reader)
398 public void validate()
399 throws org.exolab.castor.xml.ValidationException
401 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
402 validator.validate(this);
403 } //-- void validate()