1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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. If not, see <http://www.gnu.org/licenses/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
37 * @version $Revision$ $Date$
39 public class VAMSAS implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
49 private java.util.Vector _treeList;
52 * Field _sequenceSetList.
54 private java.util.Vector _sequenceSetList;
63 this._treeList = new java.util.Vector();
64 this._sequenceSetList = new java.util.Vector();
76 * @throws java.lang.IndexOutOfBoundsException if the index
77 * given is outside the bounds of the collection
79 public void addSequenceSet(
80 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
81 throws java.lang.IndexOutOfBoundsException {
82 this._sequenceSetList.addElement(vSequenceSet);
90 * @throws java.lang.IndexOutOfBoundsException if the index
91 * given is outside the bounds of the collection
93 public void addSequenceSet(
95 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
96 throws java.lang.IndexOutOfBoundsException {
97 this._sequenceSetList.add(index, vSequenceSet);
104 * @throws java.lang.IndexOutOfBoundsException if the index
105 * given is outside the bounds of the collection
108 final java.lang.String vTree)
109 throws java.lang.IndexOutOfBoundsException {
110 this._treeList.addElement(vTree);
118 * @throws java.lang.IndexOutOfBoundsException if the index
119 * given is outside the bounds of the collection
123 final java.lang.String vTree)
124 throws java.lang.IndexOutOfBoundsException {
125 this._treeList.add(index, vTree);
129 * Method enumerateSequenceSet.
131 * @return an Enumeration over all
132 * jalview.schemabinding.version2.SequenceSet elements
134 public java.util.Enumeration enumerateSequenceSet(
136 return this._sequenceSetList.elements();
140 * Method enumerateTree.
142 * @return an Enumeration over all java.lang.String elements
144 public java.util.Enumeration enumerateTree(
146 return this._treeList.elements();
150 * Method getSequenceSet.
153 * @throws java.lang.IndexOutOfBoundsException if the index
154 * given is outside the bounds of the collection
155 * @return the value of the
156 * jalview.schemabinding.version2.SequenceSet at the given index
158 public jalview.schemabinding.version2.SequenceSet getSequenceSet(
160 throws java.lang.IndexOutOfBoundsException {
161 // check bounds for index
162 if (index < 0 || index >= this._sequenceSetList.size()) {
163 throw new IndexOutOfBoundsException("getSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
166 return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList.get(index);
170 * Method getSequenceSet.Returns the contents of the collection
171 * in an Array. <p>Note: Just in case the collection contents
172 * are changing in another thread, we pass a 0-length Array of
173 * the correct type into the API call. This way we <i>know</i>
174 * that the Array returned is of exactly the correct length.
176 * @return this collection as an Array
178 public jalview.schemabinding.version2.SequenceSet[] getSequenceSet(
180 jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
181 return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList.toArray(array);
185 * Method getSequenceSetCount.
187 * @return the size of this collection
189 public int getSequenceSetCount(
191 return this._sequenceSetList.size();
198 * @throws java.lang.IndexOutOfBoundsException if the index
199 * given is outside the bounds of the collection
200 * @return the value of the java.lang.String at the given index
202 public java.lang.String getTree(
204 throws java.lang.IndexOutOfBoundsException {
205 // check bounds for index
206 if (index < 0 || index >= this._treeList.size()) {
207 throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
210 return (java.lang.String) _treeList.get(index);
214 * Method getTree.Returns the contents of the collection in an
215 * Array. <p>Note: Just in case the collection contents are
216 * changing in another thread, we pass a 0-length Array of the
217 * correct type into the API call. This way we <i>know</i>
218 * that the Array returned is of exactly the correct length.
220 * @return this collection as an Array
222 public java.lang.String[] getTree(
224 java.lang.String[] array = new java.lang.String[0];
225 return (java.lang.String[]) this._treeList.toArray(array);
229 * Method getTreeCount.
231 * @return the size of this collection
233 public int getTreeCount(
235 return this._treeList.size();
241 * @return true if this object is valid according to the schema
243 public boolean isValid(
247 } catch (org.exolab.castor.xml.ValidationException vex) {
257 * @throws org.exolab.castor.xml.MarshalException if object is
258 * null or if any SAXException is thrown during marshaling
259 * @throws org.exolab.castor.xml.ValidationException if this
260 * object is an invalid instance according to the schema
263 final java.io.Writer out)
264 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
265 Marshaller.marshal(this, out);
272 * @throws java.io.IOException if an IOException occurs during
274 * @throws org.exolab.castor.xml.ValidationException if this
275 * object is an invalid instance according to the schema
276 * @throws org.exolab.castor.xml.MarshalException if object is
277 * null or if any SAXException is thrown during marshaling
280 final org.xml.sax.ContentHandler handler)
281 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
282 Marshaller.marshal(this, handler);
287 public void removeAllSequenceSet(
289 this._sequenceSetList.clear();
294 public void removeAllTree(
296 this._treeList.clear();
300 * Method removeSequenceSet.
302 * @param vSequenceSet
303 * @return true if the object was removed from the collection.
305 public boolean removeSequenceSet(
306 final jalview.schemabinding.version2.SequenceSet vSequenceSet) {
307 boolean removed = _sequenceSetList.remove(vSequenceSet);
312 * Method removeSequenceSetAt.
315 * @return the element removed from the collection
317 public jalview.schemabinding.version2.SequenceSet removeSequenceSetAt(
319 java.lang.Object obj = this._sequenceSetList.remove(index);
320 return (jalview.schemabinding.version2.SequenceSet) obj;
327 * @return true if the object was removed from the collection.
329 public boolean removeTree(
330 final java.lang.String vTree) {
331 boolean removed = _treeList.remove(vTree);
336 * Method removeTreeAt.
339 * @return the element removed from the collection
341 public java.lang.String removeTreeAt(
343 java.lang.Object obj = this._treeList.remove(index);
344 return (java.lang.String) obj;
351 * @param vSequenceSet
352 * @throws java.lang.IndexOutOfBoundsException if the index
353 * given is outside the bounds of the collection
355 public void setSequenceSet(
357 final jalview.schemabinding.version2.SequenceSet vSequenceSet)
358 throws java.lang.IndexOutOfBoundsException {
359 // check bounds for index
360 if (index < 0 || index >= this._sequenceSetList.size()) {
361 throw new IndexOutOfBoundsException("setSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
364 this._sequenceSetList.set(index, vSequenceSet);
370 * @param vSequenceSetArray
372 public void setSequenceSet(
373 final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray) {
375 _sequenceSetList.clear();
377 for (int i = 0; i < vSequenceSetArray.length; i++) {
378 this._sequenceSetList.add(vSequenceSetArray[i]);
387 * @throws java.lang.IndexOutOfBoundsException if the index
388 * given is outside the bounds of the collection
392 final java.lang.String vTree)
393 throws java.lang.IndexOutOfBoundsException {
394 // check bounds for index
395 if (index < 0 || index >= this._treeList.size()) {
396 throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
399 this._treeList.set(index, vTree);
408 final java.lang.String[] vTreeArray) {
412 for (int i = 0; i < vTreeArray.length; i++) {
413 this._treeList.add(vTreeArray[i]);
421 * @throws org.exolab.castor.xml.MarshalException if object is
422 * null or if any SAXException is thrown during marshaling
423 * @throws org.exolab.castor.xml.ValidationException if this
424 * object is an invalid instance according to the schema
425 * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
427 public static jalview.schemabinding.version2.VAMSAS unmarshal(
428 final java.io.Reader reader)
429 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
430 return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(jalview.schemabinding.version2.VAMSAS.class, reader);
436 * @throws org.exolab.castor.xml.ValidationException if this
437 * object is an invalid instance according to the schema
439 public void validate(
441 throws org.exolab.castor.xml.ValidationException {
442 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
443 validator.validate(this);