1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, 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.binding;
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 //--------------------------/
47 * Field _alignmentList.
49 private java.util.Vector _alignmentList;
54 private java.util.Vector _treeList;
57 * Field _sequenceSetList.
59 private java.util.Vector _sequenceSetList;
68 this._alignmentList = new java.util.Vector();
69 this._treeList = new java.util.Vector();
70 this._sequenceSetList = new java.util.Vector();
82 * @throws java.lang.IndexOutOfBoundsException if the index
83 * given is outside the bounds of the collection
85 public void addAlignment(
86 final Alignment vAlignment)
87 throws java.lang.IndexOutOfBoundsException {
88 this._alignmentList.addElement(vAlignment);
96 * @throws java.lang.IndexOutOfBoundsException if the index
97 * given is outside the bounds of the collection
99 public void addAlignment(
101 final Alignment vAlignment)
102 throws java.lang.IndexOutOfBoundsException {
103 this._alignmentList.add(index, vAlignment);
109 * @param vSequenceSet
110 * @throws java.lang.IndexOutOfBoundsException if the index
111 * given is outside the bounds of the collection
113 public void addSequenceSet(
114 final SequenceSet vSequenceSet)
115 throws java.lang.IndexOutOfBoundsException {
116 this._sequenceSetList.addElement(vSequenceSet);
123 * @param vSequenceSet
124 * @throws java.lang.IndexOutOfBoundsException if the index
125 * given is outside the bounds of the collection
127 public void addSequenceSet(
129 final SequenceSet vSequenceSet)
130 throws java.lang.IndexOutOfBoundsException {
131 this._sequenceSetList.add(index, vSequenceSet);
138 * @throws java.lang.IndexOutOfBoundsException if the index
139 * given is outside the bounds of the collection
142 final java.lang.String vTree)
143 throws java.lang.IndexOutOfBoundsException {
144 this._treeList.addElement(vTree);
152 * @throws java.lang.IndexOutOfBoundsException if the index
153 * given is outside the bounds of the collection
157 final java.lang.String vTree)
158 throws java.lang.IndexOutOfBoundsException {
159 this._treeList.add(index, vTree);
163 * Method enumerateAlignment.
165 * @return an Enumeration over all Alignment elements
167 public java.util.Enumeration enumerateAlignment(
169 return this._alignmentList.elements();
173 * Method enumerateSequenceSet.
175 * @return an Enumeration over all SequenceSet elements
177 public java.util.Enumeration enumerateSequenceSet(
179 return this._sequenceSetList.elements();
183 * Method enumerateTree.
185 * @return an Enumeration over all java.lang.String elements
187 public java.util.Enumeration enumerateTree(
189 return this._treeList.elements();
193 * Method getAlignment.
196 * @throws java.lang.IndexOutOfBoundsException if the index
197 * given is outside the bounds of the collection
198 * @return the value of the Alignment at the given index
200 public Alignment getAlignment(
202 throws java.lang.IndexOutOfBoundsException {
203 // check bounds for index
204 if (index < 0 || index >= this._alignmentList.size()) {
205 throw new IndexOutOfBoundsException("getAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
208 return (Alignment) _alignmentList.get(index);
212 * Method getAlignment.Returns the contents of the collection
213 * in an Array. <p>Note: Just in case the collection contents
214 * are changing in another thread, we pass a 0-length Array of
215 * the correct type into the API call. This way we <i>know</i>
216 * that the Array returned is of exactly the correct length.
218 * @return this collection as an Array
220 public Alignment[] getAlignment(
222 Alignment[] array = new Alignment[0];
223 return (Alignment[]) this._alignmentList.toArray(array);
227 * Method getAlignmentCount.
229 * @return the size of this collection
231 public int getAlignmentCount(
233 return this._alignmentList.size();
237 * Method getSequenceSet.
240 * @throws java.lang.IndexOutOfBoundsException if the index
241 * given is outside the bounds of the collection
242 * @return the value of the SequenceSet at the given index
244 public SequenceSet getSequenceSet(
246 throws java.lang.IndexOutOfBoundsException {
247 // check bounds for index
248 if (index < 0 || index >= this._sequenceSetList.size()) {
249 throw new IndexOutOfBoundsException("getSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
252 return (SequenceSet) _sequenceSetList.get(index);
256 * Method getSequenceSet.Returns the contents of the collection
257 * in an Array. <p>Note: Just in case the collection contents
258 * are changing in another thread, we pass a 0-length Array of
259 * the correct type into the API call. This way we <i>know</i>
260 * that the Array returned is of exactly the correct length.
262 * @return this collection as an Array
264 public SequenceSet[] getSequenceSet(
266 SequenceSet[] array = new SequenceSet[0];
267 return (SequenceSet[]) this._sequenceSetList.toArray(array);
271 * Method getSequenceSetCount.
273 * @return the size of this collection
275 public int getSequenceSetCount(
277 return this._sequenceSetList.size();
284 * @throws java.lang.IndexOutOfBoundsException if the index
285 * given is outside the bounds of the collection
286 * @return the value of the java.lang.String at the given index
288 public java.lang.String getTree(
290 throws java.lang.IndexOutOfBoundsException {
291 // check bounds for index
292 if (index < 0 || index >= this._treeList.size()) {
293 throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
296 return (java.lang.String) _treeList.get(index);
300 * Method getTree.Returns the contents of the collection in an
301 * Array. <p>Note: Just in case the collection contents are
302 * changing in another thread, we pass a 0-length Array of the
303 * correct type into the API call. This way we <i>know</i>
304 * that the Array returned is of exactly the correct length.
306 * @return this collection as an Array
308 public java.lang.String[] getTree(
310 java.lang.String[] array = new java.lang.String[0];
311 return (java.lang.String[]) this._treeList.toArray(array);
315 * Method getTreeCount.
317 * @return the size of this collection
319 public int getTreeCount(
321 return this._treeList.size();
327 * @return true if this object is valid according to the schema
329 public boolean isValid(
333 } catch (org.exolab.castor.xml.ValidationException vex) {
343 * @throws org.exolab.castor.xml.MarshalException if object is
344 * null or if any SAXException is thrown during marshaling
345 * @throws org.exolab.castor.xml.ValidationException if this
346 * object is an invalid instance according to the schema
349 final java.io.Writer out)
350 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
351 Marshaller.marshal(this, out);
358 * @throws java.io.IOException if an IOException occurs during
360 * @throws org.exolab.castor.xml.ValidationException if this
361 * object is an invalid instance according to the schema
362 * @throws org.exolab.castor.xml.MarshalException if object is
363 * null or if any SAXException is thrown during marshaling
366 final org.xml.sax.ContentHandler handler)
367 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
368 Marshaller.marshal(this, handler);
372 * Method removeAlignment.
375 * @return true if the object was removed from the collection.
377 public boolean removeAlignment(
378 final Alignment vAlignment) {
379 boolean removed = _alignmentList.remove(vAlignment);
384 * Method removeAlignmentAt.
387 * @return the element removed from the collection
389 public Alignment removeAlignmentAt(
391 java.lang.Object obj = this._alignmentList.remove(index);
392 return (Alignment) obj;
397 public void removeAllAlignment(
399 this._alignmentList.clear();
404 public void removeAllSequenceSet(
406 this._sequenceSetList.clear();
411 public void removeAllTree(
413 this._treeList.clear();
417 * Method removeSequenceSet.
419 * @param vSequenceSet
420 * @return true if the object was removed from the collection.
422 public boolean removeSequenceSet(
423 final SequenceSet vSequenceSet) {
424 boolean removed = _sequenceSetList.remove(vSequenceSet);
429 * Method removeSequenceSetAt.
432 * @return the element removed from the collection
434 public SequenceSet removeSequenceSetAt(
436 java.lang.Object obj = this._sequenceSetList.remove(index);
437 return (SequenceSet) obj;
444 * @return true if the object was removed from the collection.
446 public boolean removeTree(
447 final java.lang.String vTree) {
448 boolean removed = _treeList.remove(vTree);
453 * Method removeTreeAt.
456 * @return the element removed from the collection
458 public java.lang.String removeTreeAt(
460 java.lang.Object obj = this._treeList.remove(index);
461 return (java.lang.String) obj;
469 * @throws java.lang.IndexOutOfBoundsException if the index
470 * given is outside the bounds of the collection
472 public void setAlignment(
474 final Alignment vAlignment)
475 throws java.lang.IndexOutOfBoundsException {
476 // check bounds for index
477 if (index < 0 || index >= this._alignmentList.size()) {
478 throw new IndexOutOfBoundsException("setAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
481 this._alignmentList.set(index, vAlignment);
487 * @param vAlignmentArray
489 public void setAlignment(
490 final Alignment[] vAlignmentArray) {
492 _alignmentList.clear();
494 for (int i = 0; i < vAlignmentArray.length; i++) {
495 this._alignmentList.add(vAlignmentArray[i]);
503 * @param vSequenceSet
504 * @throws java.lang.IndexOutOfBoundsException if the index
505 * given is outside the bounds of the collection
507 public void setSequenceSet(
509 final SequenceSet vSequenceSet)
510 throws java.lang.IndexOutOfBoundsException {
511 // check bounds for index
512 if (index < 0 || index >= this._sequenceSetList.size()) {
513 throw new IndexOutOfBoundsException("setSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
516 this._sequenceSetList.set(index, vSequenceSet);
522 * @param vSequenceSetArray
524 public void setSequenceSet(
525 final SequenceSet[] vSequenceSetArray) {
527 _sequenceSetList.clear();
529 for (int i = 0; i < vSequenceSetArray.length; i++) {
530 this._sequenceSetList.add(vSequenceSetArray[i]);
539 * @throws java.lang.IndexOutOfBoundsException if the index
540 * given is outside the bounds of the collection
544 final java.lang.String vTree)
545 throws java.lang.IndexOutOfBoundsException {
546 // check bounds for index
547 if (index < 0 || index >= this._treeList.size()) {
548 throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
551 this._treeList.set(index, vTree);
560 final java.lang.String[] vTreeArray) {
564 for (int i = 0; i < vTreeArray.length; i++) {
565 this._treeList.add(vTreeArray[i]);
573 * @throws org.exolab.castor.xml.MarshalException if object is
574 * null or if any SAXException is thrown during marshaling
575 * @throws org.exolab.castor.xml.ValidationException if this
576 * object is an invalid instance according to the schema
577 * @return the unmarshaled jalview.binding.VAMSAS
579 public static jalview.binding.VAMSAS unmarshal(
580 final java.io.Reader reader)
581 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
582 return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class, reader);
588 * @throws org.exolab.castor.xml.ValidationException if this
589 * object is an invalid instance according to the schema
591 public void validate(
593 throws org.exolab.castor.xml.ValidationException {
594 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
595 validator.validate(this);