1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
39 * @version $Revision$ $Date$
41 public class VAMSAS implements java.io.Serializable
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
51 private java.util.Vector _treeList;
54 * Field _sequenceSetList.
56 private java.util.Vector _sequenceSetList;
65 this._treeList = new java.util.Vector();
66 this._sequenceSetList = new java.util.Vector();
77 * @throws java.lang.IndexOutOfBoundsException
78 * if the index given is outside the bounds of the collection
80 public void addSequenceSet(
81 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
82 throws java.lang.IndexOutOfBoundsException
84 this._sequenceSetList.addElement(vSequenceSet);
92 * @throws java.lang.IndexOutOfBoundsException
93 * if the index given is outside the bounds of the collection
95 public void addSequenceSet(final int index,
96 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
97 throws java.lang.IndexOutOfBoundsException
99 this._sequenceSetList.add(index, vSequenceSet);
106 * @throws java.lang.IndexOutOfBoundsException
107 * if the index given is outside the bounds of the collection
109 public void addTree(final java.lang.String vTree)
110 throws java.lang.IndexOutOfBoundsException
112 this._treeList.addElement(vTree);
120 * @throws java.lang.IndexOutOfBoundsException
121 * if the index given is outside the bounds of the collection
123 public void addTree(final int index, final java.lang.String vTree)
124 throws java.lang.IndexOutOfBoundsException
126 this._treeList.add(index, vTree);
130 * Method enumerateSequenceSet.
132 * @return an Enumeration over all jalview.schemabinding.version2.SequenceSet
135 public java.util.Enumeration enumerateSequenceSet()
137 return this._sequenceSetList.elements();
141 * Method enumerateTree.
143 * @return an Enumeration over all java.lang.String elements
145 public java.util.Enumeration enumerateTree()
147 return this._treeList.elements();
151 * Method getSequenceSet.
154 * @throws java.lang.IndexOutOfBoundsException
155 * if the index given is outside the bounds of the collection
156 * @return the value of the jalview.schemabinding.version2.SequenceSet at the
159 public jalview.schemabinding.version2.SequenceSet getSequenceSet(
160 final int index) throws java.lang.IndexOutOfBoundsException
162 // check bounds for index
163 if (index < 0 || index >= this._sequenceSetList.size())
165 throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
166 + index + "' not in range [0.."
167 + (this._sequenceSetList.size() - 1) + "]");
170 return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList
175 * Method getSequenceSet.Returns the contents of the collection in an Array.
177 * Note: Just in case the collection contents are changing in another thread,
178 * we pass a 0-length Array of the correct type into the API call. This way we
179 * <i>know</i> that the Array returned is of exactly the correct length.
181 * @return this collection as an Array
183 public jalview.schemabinding.version2.SequenceSet[] getSequenceSet()
185 jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
186 return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList
191 * Method getSequenceSetCount.
193 * @return the size of this collection
195 public int getSequenceSetCount()
197 return this._sequenceSetList.size();
204 * @throws java.lang.IndexOutOfBoundsException
205 * if the index given is outside the bounds of the collection
206 * @return the value of the java.lang.String at the given index
208 public java.lang.String getTree(final int index)
209 throws java.lang.IndexOutOfBoundsException
211 // check bounds for index
212 if (index < 0 || index >= this._treeList.size())
214 throw new IndexOutOfBoundsException("getTree: Index value '" + index
215 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
218 return (java.lang.String) _treeList.get(index);
222 * Method getTree.Returns the contents of the collection in an Array.
224 * Note: Just in case the collection contents are changing in another thread,
225 * we pass a 0-length Array of the correct type into the API call. This way we
226 * <i>know</i> that the Array returned is of exactly the correct length.
228 * @return this collection as an Array
230 public java.lang.String[] getTree()
232 java.lang.String[] array = new java.lang.String[0];
233 return (java.lang.String[]) this._treeList.toArray(array);
237 * Method getTreeCount.
239 * @return the size of this collection
241 public int getTreeCount()
243 return this._treeList.size();
249 * @return true if this object is valid according to the schema
251 public boolean isValid()
256 } catch (org.exolab.castor.xml.ValidationException vex)
267 * @throws org.exolab.castor.xml.MarshalException
268 * if object is null or if any SAXException is thrown during
270 * @throws org.exolab.castor.xml.ValidationException
271 * if this object is an invalid instance according to the schema
273 public void marshal(final java.io.Writer out)
274 throws org.exolab.castor.xml.MarshalException,
275 org.exolab.castor.xml.ValidationException
277 Marshaller.marshal(this, out);
284 * @throws java.io.IOException
285 * if an IOException occurs during marshaling
286 * @throws org.exolab.castor.xml.ValidationException
287 * if this object is an invalid instance according to the schema
288 * @throws org.exolab.castor.xml.MarshalException
289 * if object is null or if any SAXException is thrown during
292 public void marshal(final org.xml.sax.ContentHandler handler)
293 throws java.io.IOException,
294 org.exolab.castor.xml.MarshalException,
295 org.exolab.castor.xml.ValidationException
297 Marshaller.marshal(this, handler);
302 public void removeAllSequenceSet()
304 this._sequenceSetList.clear();
309 public void removeAllTree()
311 this._treeList.clear();
315 * Method removeSequenceSet.
317 * @param vSequenceSet
318 * @return true if the object was removed from the collection.
320 public boolean removeSequenceSet(
321 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
323 boolean removed = _sequenceSetList.remove(vSequenceSet);
328 * Method removeSequenceSetAt.
331 * @return the element removed from the collection
333 public jalview.schemabinding.version2.SequenceSet removeSequenceSetAt(
336 java.lang.Object obj = this._sequenceSetList.remove(index);
337 return (jalview.schemabinding.version2.SequenceSet) obj;
344 * @return true if the object was removed from the collection.
346 public boolean removeTree(final java.lang.String vTree)
348 boolean removed = _treeList.remove(vTree);
353 * Method removeTreeAt.
356 * @return the element removed from the collection
358 public java.lang.String removeTreeAt(final int index)
360 java.lang.Object obj = this._treeList.remove(index);
361 return (java.lang.String) obj;
368 * @param vSequenceSet
369 * @throws java.lang.IndexOutOfBoundsException
370 * if the index given is outside the bounds of the collection
372 public void setSequenceSet(final int index,
373 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
374 throws java.lang.IndexOutOfBoundsException
376 // check bounds for index
377 if (index < 0 || index >= this._sequenceSetList.size())
379 throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
380 + index + "' not in range [0.."
381 + (this._sequenceSetList.size() - 1) + "]");
384 this._sequenceSetList.set(index, vSequenceSet);
390 * @param vSequenceSetArray
392 public void setSequenceSet(
393 final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray)
396 _sequenceSetList.clear();
398 for (int i = 0; i < vSequenceSetArray.length; i++)
400 this._sequenceSetList.add(vSequenceSetArray[i]);
409 * @throws java.lang.IndexOutOfBoundsException
410 * if the index given is outside the bounds of the collection
412 public void setTree(final int index, final java.lang.String vTree)
413 throws java.lang.IndexOutOfBoundsException
415 // check bounds for index
416 if (index < 0 || index >= this._treeList.size())
418 throw new IndexOutOfBoundsException("setTree: Index value '" + index
419 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
422 this._treeList.set(index, vTree);
430 public void setTree(final java.lang.String[] vTreeArray)
435 for (int i = 0; i < vTreeArray.length; i++)
437 this._treeList.add(vTreeArray[i]);
445 * @throws org.exolab.castor.xml.MarshalException
446 * if object is null or if any SAXException is thrown during
448 * @throws org.exolab.castor.xml.ValidationException
449 * if this object is an invalid instance according to the schema
450 * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
452 public static jalview.schemabinding.version2.VAMSAS unmarshal(
453 final java.io.Reader reader)
454 throws org.exolab.castor.xml.MarshalException,
455 org.exolab.castor.xml.ValidationException
457 return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(
458 jalview.schemabinding.version2.VAMSAS.class, reader);
464 * @throws org.exolab.castor.xml.ValidationException
465 * if this object is an invalid instance according to the schema
467 public void validate() throws org.exolab.castor.xml.ValidationException
469 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
470 validator.validate(this);