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.binding;
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 // --------------------------/
50 * Field _alignmentList.
52 private java.util.Vector _alignmentList;
57 private java.util.Vector _treeList;
60 * Field _sequenceSetList.
62 private java.util.Vector _sequenceSetList;
71 this._alignmentList = new java.util.Vector();
72 this._treeList = new java.util.Vector();
73 this._sequenceSetList = new java.util.Vector();
84 * @throws java.lang.IndexOutOfBoundsException
85 * if the index given is outside the bounds of the collection
87 public void addAlignment(final Alignment vAlignment)
88 throws java.lang.IndexOutOfBoundsException
90 this._alignmentList.addElement(vAlignment);
98 * @throws java.lang.IndexOutOfBoundsException
99 * if the index given is outside the bounds of the collection
101 public void addAlignment(final int index, final Alignment vAlignment)
102 throws java.lang.IndexOutOfBoundsException
104 this._alignmentList.add(index, vAlignment);
110 * @param vSequenceSet
111 * @throws java.lang.IndexOutOfBoundsException
112 * if the index given is outside the bounds of the collection
114 public void addSequenceSet(final SequenceSet vSequenceSet)
115 throws java.lang.IndexOutOfBoundsException
117 this._sequenceSetList.addElement(vSequenceSet);
124 * @param vSequenceSet
125 * @throws java.lang.IndexOutOfBoundsException
126 * if the index given is outside the bounds of the collection
128 public void addSequenceSet(final int index,
129 final SequenceSet vSequenceSet)
130 throws java.lang.IndexOutOfBoundsException
132 this._sequenceSetList.add(index, vSequenceSet);
139 * @throws java.lang.IndexOutOfBoundsException
140 * if the index given is outside the bounds of the collection
142 public void addTree(final java.lang.String vTree)
143 throws java.lang.IndexOutOfBoundsException
145 this._treeList.addElement(vTree);
153 * @throws java.lang.IndexOutOfBoundsException
154 * if the index given is outside the bounds of the collection
156 public void addTree(final int index, final java.lang.String vTree)
157 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
197 * if the index given is outside the bounds of the collection
198 * @return the value of the Alignment at the given index
200 public Alignment getAlignment(final int index)
201 throws java.lang.IndexOutOfBoundsException
203 // check bounds for index
204 if (index < 0 || index >= this._alignmentList.size())
206 throw new IndexOutOfBoundsException(
207 "getAlignment: Index value '" + index + "' not in range [0.."
208 + (this._alignmentList.size() - 1) + "]");
211 return (Alignment) _alignmentList.get(index);
215 * Method getAlignment.Returns the contents of the collection in an Array.
217 * Note: Just in case the collection contents are changing in another thread,
218 * we pass a 0-length Array of the correct type into the API call. This way we
219 * <i>know</i> that the Array returned is of exactly the correct length.
221 * @return this collection as an Array
223 public Alignment[] getAlignment()
225 Alignment[] array = new Alignment[0];
226 return (Alignment[]) this._alignmentList.toArray(array);
230 * Method getAlignmentCount.
232 * @return the size of this collection
234 public int getAlignmentCount()
236 return this._alignmentList.size();
240 * Method getSequenceSet.
243 * @throws java.lang.IndexOutOfBoundsException
244 * if the index given is outside the bounds of the collection
245 * @return the value of the SequenceSet at the given index
247 public SequenceSet getSequenceSet(final int index)
248 throws java.lang.IndexOutOfBoundsException
250 // check bounds for index
251 if (index < 0 || index >= this._sequenceSetList.size())
253 throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
254 + index + "' not in range [0.."
255 + (this._sequenceSetList.size() - 1) + "]");
258 return (SequenceSet) _sequenceSetList.get(index);
262 * Method getSequenceSet.Returns the contents of the collection in an Array.
264 * Note: Just in case the collection contents are changing in another thread,
265 * we pass a 0-length Array of the correct type into the API call. This way we
266 * <i>know</i> that the Array returned is of exactly the correct length.
268 * @return this collection as an Array
270 public SequenceSet[] getSequenceSet()
272 SequenceSet[] array = new SequenceSet[0];
273 return (SequenceSet[]) this._sequenceSetList.toArray(array);
277 * Method getSequenceSetCount.
279 * @return the size of this collection
281 public int getSequenceSetCount()
283 return this._sequenceSetList.size();
290 * @throws java.lang.IndexOutOfBoundsException
291 * if the index given is outside the bounds of the collection
292 * @return the value of the java.lang.String at the given index
294 public java.lang.String getTree(final int index)
295 throws java.lang.IndexOutOfBoundsException
297 // check bounds for index
298 if (index < 0 || index >= this._treeList.size())
300 throw new IndexOutOfBoundsException("getTree: Index value '" + index
301 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
304 return (java.lang.String) _treeList.get(index);
308 * Method getTree.Returns the contents of the collection in an Array.
310 * Note: Just in case the collection contents are changing in another thread,
311 * we pass a 0-length Array of the correct type into the API call. This way we
312 * <i>know</i> that the Array returned is of exactly the correct length.
314 * @return this collection as an Array
316 public java.lang.String[] getTree()
318 java.lang.String[] array = new java.lang.String[0];
319 return (java.lang.String[]) this._treeList.toArray(array);
323 * Method getTreeCount.
325 * @return the size of this collection
327 public int getTreeCount()
329 return this._treeList.size();
335 * @return true if this object is valid according to the schema
337 public boolean isValid()
342 } catch (org.exolab.castor.xml.ValidationException vex)
353 * @throws org.exolab.castor.xml.MarshalException
354 * if object is null or if any SAXException is thrown during
356 * @throws org.exolab.castor.xml.ValidationException
357 * if this object is an invalid instance according to the schema
359 public void marshal(final java.io.Writer out)
360 throws org.exolab.castor.xml.MarshalException,
361 org.exolab.castor.xml.ValidationException
363 Marshaller.marshal(this, out);
370 * @throws java.io.IOException
371 * if an IOException occurs during marshaling
372 * @throws org.exolab.castor.xml.ValidationException
373 * if this object is an invalid instance according to the schema
374 * @throws org.exolab.castor.xml.MarshalException
375 * if object is null or if any SAXException is thrown during
378 public void marshal(final org.xml.sax.ContentHandler handler)
379 throws java.io.IOException,
380 org.exolab.castor.xml.MarshalException,
381 org.exolab.castor.xml.ValidationException
383 Marshaller.marshal(this, handler);
387 * Method removeAlignment.
390 * @return true if the object was removed from the collection.
392 public boolean removeAlignment(final Alignment vAlignment)
394 boolean removed = _alignmentList.remove(vAlignment);
399 * Method removeAlignmentAt.
402 * @return the element removed from the collection
404 public Alignment removeAlignmentAt(final int index)
406 java.lang.Object obj = this._alignmentList.remove(index);
407 return (Alignment) obj;
412 public void removeAllAlignment()
414 this._alignmentList.clear();
419 public void removeAllSequenceSet()
421 this._sequenceSetList.clear();
426 public void removeAllTree()
428 this._treeList.clear();
432 * Method removeSequenceSet.
434 * @param vSequenceSet
435 * @return true if the object was removed from the collection.
437 public boolean removeSequenceSet(final SequenceSet vSequenceSet)
439 boolean removed = _sequenceSetList.remove(vSequenceSet);
444 * Method removeSequenceSetAt.
447 * @return the element removed from the collection
449 public SequenceSet removeSequenceSetAt(final int index)
451 java.lang.Object obj = this._sequenceSetList.remove(index);
452 return (SequenceSet) obj;
459 * @return true if the object was removed from the collection.
461 public boolean removeTree(final java.lang.String vTree)
463 boolean removed = _treeList.remove(vTree);
468 * Method removeTreeAt.
471 * @return the element removed from the collection
473 public java.lang.String removeTreeAt(final int index)
475 java.lang.Object obj = this._treeList.remove(index);
476 return (java.lang.String) obj;
484 * @throws java.lang.IndexOutOfBoundsException
485 * if the index given is outside the bounds of the collection
487 public void setAlignment(final int index, final Alignment vAlignment)
488 throws java.lang.IndexOutOfBoundsException
490 // check bounds for index
491 if (index < 0 || index >= this._alignmentList.size())
493 throw new IndexOutOfBoundsException(
494 "setAlignment: Index value '" + index + "' not in range [0.."
495 + (this._alignmentList.size() - 1) + "]");
498 this._alignmentList.set(index, vAlignment);
504 * @param vAlignmentArray
506 public void setAlignment(final Alignment[] vAlignmentArray)
509 _alignmentList.clear();
511 for (int i = 0; i < vAlignmentArray.length; i++)
513 this._alignmentList.add(vAlignmentArray[i]);
521 * @param vSequenceSet
522 * @throws java.lang.IndexOutOfBoundsException
523 * if the index given is outside the bounds of the collection
525 public void setSequenceSet(final int index,
526 final SequenceSet vSequenceSet)
527 throws java.lang.IndexOutOfBoundsException
529 // check bounds for index
530 if (index < 0 || index >= this._sequenceSetList.size())
532 throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
533 + index + "' not in range [0.."
534 + (this._sequenceSetList.size() - 1) + "]");
537 this._sequenceSetList.set(index, vSequenceSet);
543 * @param vSequenceSetArray
545 public void setSequenceSet(final SequenceSet[] vSequenceSetArray)
548 _sequenceSetList.clear();
550 for (int i = 0; i < vSequenceSetArray.length; i++)
552 this._sequenceSetList.add(vSequenceSetArray[i]);
561 * @throws java.lang.IndexOutOfBoundsException
562 * if the index given is outside the bounds of the collection
564 public void setTree(final int index, final java.lang.String vTree)
565 throws java.lang.IndexOutOfBoundsException
567 // check bounds for index
568 if (index < 0 || index >= this._treeList.size())
570 throw new IndexOutOfBoundsException("setTree: Index value '" + index
571 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
574 this._treeList.set(index, vTree);
582 public void setTree(final java.lang.String[] vTreeArray)
587 for (int i = 0; i < vTreeArray.length; i++)
589 this._treeList.add(vTreeArray[i]);
597 * @throws org.exolab.castor.xml.MarshalException
598 * if object is null or if any SAXException is thrown during
600 * @throws org.exolab.castor.xml.ValidationException
601 * if this object is an invalid instance according to the schema
602 * @return the unmarshaled jalview.binding.VAMSAS
604 public static jalview.binding.VAMSAS unmarshal(
605 final java.io.Reader reader)
606 throws org.exolab.castor.xml.MarshalException,
607 org.exolab.castor.xml.ValidationException
609 return (jalview.binding.VAMSAS) Unmarshaller
610 .unmarshal(jalview.binding.VAMSAS.class, reader);
616 * @throws org.exolab.castor.xml.ValidationException
617 * if this object is an invalid instance according to the schema
619 public void validate() throws org.exolab.castor.xml.ValidationException
621 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
622 validator.validate(this);