1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.schemabinding.version2;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
40 * @version $Revision$ $Date$
42 public class VAMSAS implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
52 private java.util.Vector _treeList;
55 * Field _sequenceSetList.
57 private java.util.Vector _sequenceSetList;
66 this._treeList = new java.util.Vector();
67 this._sequenceSetList = new java.util.Vector();
78 * @throws java.lang.IndexOutOfBoundsException
79 * if the index given is outside the bounds of the collection
81 public void addSequenceSet(
82 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
83 throws java.lang.IndexOutOfBoundsException
85 this._sequenceSetList.addElement(vSequenceSet);
93 * @throws java.lang.IndexOutOfBoundsException
94 * if the index given is outside the bounds of the collection
96 public void addSequenceSet(final int index,
97 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
98 throws java.lang.IndexOutOfBoundsException
100 this._sequenceSetList.add(index, vSequenceSet);
107 * @throws java.lang.IndexOutOfBoundsException
108 * if the index given is outside the bounds of the collection
110 public void addTree(final java.lang.String vTree)
111 throws java.lang.IndexOutOfBoundsException
113 this._treeList.addElement(vTree);
121 * @throws java.lang.IndexOutOfBoundsException
122 * if the index given is outside the bounds of the collection
124 public void addTree(final int index, final java.lang.String vTree)
125 throws java.lang.IndexOutOfBoundsException
127 this._treeList.add(index, vTree);
131 * Method enumerateSequenceSet.
133 * @return an Enumeration over all jalview.schemabinding.version2.SequenceSet
136 public java.util.Enumeration enumerateSequenceSet()
138 return this._sequenceSetList.elements();
142 * Method enumerateTree.
144 * @return an Enumeration over all java.lang.String elements
146 public java.util.Enumeration enumerateTree()
148 return this._treeList.elements();
152 * Method getSequenceSet.
155 * @throws java.lang.IndexOutOfBoundsException
156 * if the index given is outside the bounds of the collection
157 * @return the value of the jalview.schemabinding.version2.SequenceSet at the
160 public jalview.schemabinding.version2.SequenceSet getSequenceSet(
161 final int index) throws java.lang.IndexOutOfBoundsException
163 // check bounds for index
164 if (index < 0 || index >= this._sequenceSetList.size())
166 throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
167 + index + "' not in range [0.."
168 + (this._sequenceSetList.size() - 1) + "]");
171 return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList
176 * Method getSequenceSet.Returns the contents of the collection in an Array.
178 * Note: Just in case the collection contents are changing in another thread,
179 * we pass a 0-length Array of the correct type into the API call. This way we
180 * <i>know</i> that the Array returned is of exactly the correct length.
182 * @return this collection as an Array
184 public jalview.schemabinding.version2.SequenceSet[] getSequenceSet()
186 jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
187 return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList
192 * Method getSequenceSetCount.
194 * @return the size of this collection
196 public int getSequenceSetCount()
198 return this._sequenceSetList.size();
205 * @throws java.lang.IndexOutOfBoundsException
206 * if the index given is outside the bounds of the collection
207 * @return the value of the java.lang.String at the given index
209 public java.lang.String getTree(final int index)
210 throws java.lang.IndexOutOfBoundsException
212 // check bounds for index
213 if (index < 0 || index >= this._treeList.size())
215 throw new IndexOutOfBoundsException("getTree: Index value '" + index
216 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
219 return (java.lang.String) _treeList.get(index);
223 * Method getTree.Returns the contents of the collection in an Array.
225 * Note: Just in case the collection contents are changing in another thread,
226 * we pass a 0-length Array of the correct type into the API call. This way we
227 * <i>know</i> that the Array returned is of exactly the correct length.
229 * @return this collection as an Array
231 public java.lang.String[] getTree()
233 java.lang.String[] array = new java.lang.String[0];
234 return (java.lang.String[]) this._treeList.toArray(array);
238 * Method getTreeCount.
240 * @return the size of this collection
242 public int getTreeCount()
244 return this._treeList.size();
250 * @return true if this object is valid according to the schema
252 public boolean isValid()
257 } catch (org.exolab.castor.xml.ValidationException vex)
268 * @throws org.exolab.castor.xml.MarshalException
269 * if object is null or if any SAXException is thrown during
271 * @throws org.exolab.castor.xml.ValidationException
272 * if this object is an invalid instance according to the schema
274 public void marshal(final java.io.Writer out)
275 throws org.exolab.castor.xml.MarshalException,
276 org.exolab.castor.xml.ValidationException
278 Marshaller.marshal(this, out);
285 * @throws java.io.IOException
286 * if an IOException occurs during marshaling
287 * @throws org.exolab.castor.xml.ValidationException
288 * if this object is an invalid instance according to the schema
289 * @throws org.exolab.castor.xml.MarshalException
290 * if object is null or if any SAXException is thrown during
293 public void marshal(final org.xml.sax.ContentHandler handler)
294 throws java.io.IOException,
295 org.exolab.castor.xml.MarshalException,
296 org.exolab.castor.xml.ValidationException
298 Marshaller.marshal(this, handler);
303 public void removeAllSequenceSet()
305 this._sequenceSetList.clear();
310 public void removeAllTree()
312 this._treeList.clear();
316 * Method removeSequenceSet.
318 * @param vSequenceSet
319 * @return true if the object was removed from the collection.
321 public boolean removeSequenceSet(
322 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
324 boolean removed = _sequenceSetList.remove(vSequenceSet);
329 * Method removeSequenceSetAt.
332 * @return the element removed from the collection
334 public jalview.schemabinding.version2.SequenceSet removeSequenceSetAt(
337 java.lang.Object obj = this._sequenceSetList.remove(index);
338 return (jalview.schemabinding.version2.SequenceSet) obj;
345 * @return true if the object was removed from the collection.
347 public boolean removeTree(final java.lang.String vTree)
349 boolean removed = _treeList.remove(vTree);
354 * Method removeTreeAt.
357 * @return the element removed from the collection
359 public java.lang.String removeTreeAt(final int index)
361 java.lang.Object obj = this._treeList.remove(index);
362 return (java.lang.String) obj;
369 * @param vSequenceSet
370 * @throws java.lang.IndexOutOfBoundsException
371 * if the index given is outside the bounds of the collection
373 public void setSequenceSet(final int index,
374 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
375 throws java.lang.IndexOutOfBoundsException
377 // check bounds for index
378 if (index < 0 || index >= this._sequenceSetList.size())
380 throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
381 + index + "' not in range [0.."
382 + (this._sequenceSetList.size() - 1) + "]");
385 this._sequenceSetList.set(index, vSequenceSet);
391 * @param vSequenceSetArray
393 public void setSequenceSet(
394 final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray)
397 _sequenceSetList.clear();
399 for (int i = 0; i < vSequenceSetArray.length; i++)
401 this._sequenceSetList.add(vSequenceSetArray[i]);
410 * @throws java.lang.IndexOutOfBoundsException
411 * if the index given is outside the bounds of the collection
413 public void setTree(final int index, final java.lang.String vTree)
414 throws java.lang.IndexOutOfBoundsException
416 // check bounds for index
417 if (index < 0 || index >= this._treeList.size())
419 throw new IndexOutOfBoundsException("setTree: Index value '" + index
420 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
423 this._treeList.set(index, vTree);
431 public void setTree(final java.lang.String[] vTreeArray)
436 for (int i = 0; i < vTreeArray.length; i++)
438 this._treeList.add(vTreeArray[i]);
446 * @throws org.exolab.castor.xml.MarshalException
447 * if object is null or if any SAXException is thrown during
449 * @throws org.exolab.castor.xml.ValidationException
450 * if this object is an invalid instance according to the schema
451 * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
453 public static jalview.schemabinding.version2.VAMSAS unmarshal(
454 final java.io.Reader reader)
455 throws org.exolab.castor.xml.MarshalException,
456 org.exolab.castor.xml.ValidationException
458 return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(
459 jalview.schemabinding.version2.VAMSAS.class, reader);
465 * @throws org.exolab.castor.xml.ValidationException
466 * if this object is an invalid instance according to the schema
468 public void validate() throws org.exolab.castor.xml.ValidationException
470 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
471 validator.validate(this);