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 TreeType extends org.vamsas.client.object
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
43 private java.lang.String _id;
46 * Field _newickFormatList
48 private java.util.Vector _newickFormatList;
53 private org.vamsas.objects.core.Provenance _provenance;
63 _newickFormatList = new Vector();
64 } //-- org.vamsas.objects.core.TreeType()
72 * Method addNewickFormat
76 * @param vNewickFormat
78 public void addNewickFormat(java.lang.String vNewickFormat)
79 throws java.lang.IndexOutOfBoundsException
81 _newickFormatList.addElement(vNewickFormat);
82 } //-- void addNewickFormat(java.lang.String)
85 * Method addNewickFormat
90 * @param vNewickFormat
92 public void addNewickFormat(int index, java.lang.String vNewickFormat)
93 throws java.lang.IndexOutOfBoundsException
95 _newickFormatList.insertElementAt(vNewickFormat, index);
96 } //-- void addNewickFormat(int, java.lang.String)
99 * Method enumerateNewickFormat
103 * @return Enumeration
105 public java.util.Enumeration enumerateNewickFormat()
107 return _newickFormatList.elements();
108 } //-- java.util.Enumeration enumerateNewickFormat()
111 * Note: hashCode() has not been overriden
116 public boolean equals(java.lang.Object obj)
121 if (super.equals(obj)==false)
124 if (obj instanceof TreeType) {
126 TreeType temp = (TreeType)obj;
127 if (this._id != null) {
128 if (temp._id == null) return false;
129 else if (!(this._id.equals(temp._id)))
132 else if (temp._id != null)
134 if (this._newickFormatList != null) {
135 if (temp._newickFormatList == null) return false;
136 else if (!(this._newickFormatList.equals(temp._newickFormatList)))
139 else if (temp._newickFormatList != null)
141 if (this._provenance != null) {
142 if (temp._provenance == null) return false;
143 else if (!(this._provenance.equals(temp._provenance)))
146 else if (temp._provenance != null)
151 } //-- boolean equals(java.lang.Object)
154 * Returns the value of field 'id'.
157 * @return the value of field 'id'.
159 public java.lang.String getId()
162 } //-- java.lang.String getId()
165 * Method getNewickFormat
172 public java.lang.String getNewickFormat(int index)
173 throws java.lang.IndexOutOfBoundsException
175 //-- check bounds for index
176 if ((index < 0) || (index > _newickFormatList.size())) {
177 throw new IndexOutOfBoundsException("getNewickFormat: Index value '"+index+"' not in range [0.."+_newickFormatList.size()+ "]");
180 return (String)_newickFormatList.elementAt(index);
181 } //-- java.lang.String getNewickFormat(int)
184 * Method getNewickFormat
190 public java.lang.String[] getNewickFormat()
192 int size = _newickFormatList.size();
193 java.lang.String[] mArray = new java.lang.String[size];
194 for (int index = 0; index < size; index++) {
195 mArray[index] = (String)_newickFormatList.elementAt(index);
198 } //-- java.lang.String[] getNewickFormat()
201 * Method getNewickFormatCount
207 public int getNewickFormatCount()
209 return _newickFormatList.size();
210 } //-- int getNewickFormatCount()
213 * Returns the value of field 'provenance'.
216 * @return the value of field 'provenance'.
218 public org.vamsas.objects.core.Provenance getProvenance()
220 return this._provenance;
221 } //-- org.vamsas.objects.core.Provenance getProvenance()
230 public boolean isValid()
235 catch (org.exolab.castor.xml.ValidationException vex) {
239 } //-- boolean isValid()
248 public void marshal(java.io.Writer out)
249 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
252 Marshaller.marshal(this, out);
253 } //-- void marshal(java.io.Writer)
262 public void marshal(org.xml.sax.ContentHandler handler)
263 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
266 Marshaller.marshal(this, handler);
267 } //-- void marshal(org.xml.sax.ContentHandler)
270 * Method removeAllNewickFormat
273 public void removeAllNewickFormat()
275 _newickFormatList.removeAllElements();
276 } //-- void removeAllNewickFormat()
279 * Method removeNewickFormat
286 public java.lang.String removeNewickFormat(int index)
288 java.lang.Object obj = _newickFormatList.elementAt(index);
289 _newickFormatList.removeElementAt(index);
291 } //-- java.lang.String removeNewickFormat(int)
294 * Sets the value of field 'id'.
296 * @param id the value of field 'id'.
298 public void setId(java.lang.String id)
301 } //-- void setId(java.lang.String)
304 * Method setNewickFormat
309 * @param vNewickFormat
311 public void setNewickFormat(int index, java.lang.String vNewickFormat)
312 throws java.lang.IndexOutOfBoundsException
314 //-- check bounds for index
315 if ((index < 0) || (index > _newickFormatList.size())) {
316 throw new IndexOutOfBoundsException("setNewickFormat: Index value '"+index+"' not in range [0.."+_newickFormatList.size()+ "]");
318 _newickFormatList.setElementAt(vNewickFormat, index);
319 } //-- void setNewickFormat(int, java.lang.String)
322 * Method setNewickFormat
326 * @param newickFormatArray
328 public void setNewickFormat(java.lang.String[] newickFormatArray)
331 _newickFormatList.removeAllElements();
332 for (int i = 0; i < newickFormatArray.length; i++) {
333 _newickFormatList.addElement(newickFormatArray[i]);
335 } //-- void setNewickFormat(java.lang.String)
338 * Sets the value of field 'provenance'.
340 * @param provenance the value of field 'provenance'.
342 public void setProvenance(org.vamsas.objects.core.Provenance provenance)
344 this._provenance = provenance;
345 } //-- void setProvenance(org.vamsas.objects.core.Provenance)
355 public static org.vamsas.objects.core.TreeType unmarshal(java.io.Reader reader)
356 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
358 return (org.vamsas.objects.core.TreeType) Unmarshaller.unmarshal(org.vamsas.objects.core.TreeType.class, reader);
359 } //-- org.vamsas.objects.core.TreeType unmarshal(java.io.Reader)
365 public void validate()
366 throws org.exolab.castor.xml.ValidationException
368 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
369 validator.validate(this);
370 } //-- void validate()