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;
38 * Class JalviewModelSequence.
40 * @version $Revision$ $Date$
42 public class JalviewModelSequence implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
52 private java.util.Vector _JSeqList;
57 private java.util.Vector _JGroupList;
60 * Field _viewportList.
62 private java.util.Vector _viewportList;
65 * Field _userColoursList.
67 private java.util.Vector _userColoursList;
72 private java.util.Vector _treeList;
75 * Field _featureSettings.
77 private jalview.binding.FeatureSettings _featureSettings;
83 public JalviewModelSequence()
86 this._JSeqList = new java.util.Vector();
87 this._JGroupList = new java.util.Vector();
88 this._viewportList = new java.util.Vector();
89 this._userColoursList = new java.util.Vector();
90 this._treeList = new java.util.Vector();
101 * @throws java.lang.IndexOutOfBoundsException
102 * if the index given is outside the bounds of the collection
104 public void addJGroup(final jalview.binding.JGroup vJGroup)
105 throws java.lang.IndexOutOfBoundsException
107 this._JGroupList.addElement(vJGroup);
115 * @throws java.lang.IndexOutOfBoundsException
116 * if the index given is outside the bounds of the collection
118 public void addJGroup(final int index,
119 final jalview.binding.JGroup vJGroup)
120 throws java.lang.IndexOutOfBoundsException
122 this._JGroupList.add(index, vJGroup);
129 * @throws java.lang.IndexOutOfBoundsException
130 * if the index given is outside the bounds of the collection
132 public void addJSeq(final jalview.binding.JSeq vJSeq)
133 throws java.lang.IndexOutOfBoundsException
135 this._JSeqList.addElement(vJSeq);
143 * @throws java.lang.IndexOutOfBoundsException
144 * if the index given is outside the bounds of the collection
146 public void addJSeq(final int index, final jalview.binding.JSeq vJSeq)
147 throws java.lang.IndexOutOfBoundsException
149 this._JSeqList.add(index, vJSeq);
156 * @throws java.lang.IndexOutOfBoundsException
157 * if the index given is outside the bounds of the collection
159 public void addTree(final jalview.binding.Tree vTree)
160 throws java.lang.IndexOutOfBoundsException
162 this._treeList.addElement(vTree);
170 * @throws java.lang.IndexOutOfBoundsException
171 * if the index given is outside the bounds of the collection
173 public void addTree(final int index, final jalview.binding.Tree vTree)
174 throws java.lang.IndexOutOfBoundsException
176 this._treeList.add(index, vTree);
182 * @param vUserColours
183 * @throws java.lang.IndexOutOfBoundsException
184 * if the index given is outside the bounds of the collection
186 public void addUserColours(final jalview.binding.UserColours vUserColours)
187 throws java.lang.IndexOutOfBoundsException
189 this._userColoursList.addElement(vUserColours);
196 * @param vUserColours
197 * @throws java.lang.IndexOutOfBoundsException
198 * if the index given is outside the bounds of the collection
200 public void addUserColours(final int index,
201 final jalview.binding.UserColours vUserColours)
202 throws java.lang.IndexOutOfBoundsException
204 this._userColoursList.add(index, vUserColours);
211 * @throws java.lang.IndexOutOfBoundsException
212 * if the index given is outside the bounds of the collection
214 public void addViewport(final jalview.binding.Viewport vViewport)
215 throws java.lang.IndexOutOfBoundsException
217 this._viewportList.addElement(vViewport);
225 * @throws java.lang.IndexOutOfBoundsException
226 * if the index given is outside the bounds of the collection
228 public void addViewport(final int index,
229 final jalview.binding.Viewport vViewport)
230 throws java.lang.IndexOutOfBoundsException
232 this._viewportList.add(index, vViewport);
236 * Method enumerateJGroup.
238 * @return an Enumeration over all jalview.binding.JGroup elements
240 public java.util.Enumeration enumerateJGroup()
242 return this._JGroupList.elements();
246 * Method enumerateJSeq.
248 * @return an Enumeration over all jalview.binding.JSeq elements
250 public java.util.Enumeration enumerateJSeq()
252 return this._JSeqList.elements();
256 * Method enumerateTree.
258 * @return an Enumeration over all jalview.binding.Tree elements
260 public java.util.Enumeration enumerateTree()
262 return this._treeList.elements();
266 * Method enumerateUserColours.
268 * @return an Enumeration over all jalview.binding.UserColours elements
270 public java.util.Enumeration enumerateUserColours()
272 return this._userColoursList.elements();
276 * Method enumerateViewport.
278 * @return an Enumeration over all jalview.binding.Viewport elements
280 public java.util.Enumeration enumerateViewport()
282 return this._viewportList.elements();
286 * Returns the value of field 'featureSettings'.
288 * @return the value of field 'FeatureSettings'.
290 public jalview.binding.FeatureSettings getFeatureSettings()
292 return this._featureSettings;
299 * @throws java.lang.IndexOutOfBoundsException
300 * if the index given is outside the bounds of the collection
301 * @return the value of the jalview.binding.JGroup at the given index
303 public jalview.binding.JGroup getJGroup(final int index)
304 throws java.lang.IndexOutOfBoundsException
306 // check bounds for index
307 if (index < 0 || index >= this._JGroupList.size())
309 throw new IndexOutOfBoundsException(
310 "getJGroup: Index value '" + index + "' not in range [0.."
311 + (this._JGroupList.size() - 1) + "]");
314 return (jalview.binding.JGroup) _JGroupList.get(index);
318 * Method getJGroup.Returns the contents of the collection in an Array.
320 * Note: Just in case the collection contents are changing in another thread,
321 * we pass a 0-length Array of the correct type into the API call. This way we
322 * <i>know</i> that the Array returned is of exactly the correct length.
324 * @return this collection as an Array
326 public jalview.binding.JGroup[] getJGroup()
328 jalview.binding.JGroup[] array = new jalview.binding.JGroup[0];
329 return (jalview.binding.JGroup[]) this._JGroupList.toArray(array);
333 * Method getJGroupCount.
335 * @return the size of this collection
337 public int getJGroupCount()
339 return this._JGroupList.size();
346 * @throws java.lang.IndexOutOfBoundsException
347 * if the index given is outside the bounds of the collection
348 * @return the value of the jalview.binding.JSeq at the given index
350 public jalview.binding.JSeq getJSeq(final int index)
351 throws java.lang.IndexOutOfBoundsException
353 // check bounds for index
354 if (index < 0 || index >= this._JSeqList.size())
356 throw new IndexOutOfBoundsException("getJSeq: Index value '" + index
357 + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
360 return (jalview.binding.JSeq) _JSeqList.get(index);
364 * Method getJSeq.Returns the contents of the collection in an Array.
366 * Note: Just in case the collection contents are changing in another thread,
367 * we pass a 0-length Array of the correct type into the API call. This way we
368 * <i>know</i> that the Array returned is of exactly the correct length.
370 * @return this collection as an Array
372 public jalview.binding.JSeq[] getJSeq()
374 jalview.binding.JSeq[] array = new jalview.binding.JSeq[0];
375 return (jalview.binding.JSeq[]) this._JSeqList.toArray(array);
379 * Method getJSeqCount.
381 * @return the size of this collection
383 public int getJSeqCount()
385 return this._JSeqList.size();
392 * @throws java.lang.IndexOutOfBoundsException
393 * if the index given is outside the bounds of the collection
394 * @return the value of the jalview.binding.Tree at the given index
396 public jalview.binding.Tree getTree(final int index)
397 throws java.lang.IndexOutOfBoundsException
399 // check bounds for index
400 if (index < 0 || index >= this._treeList.size())
402 throw new IndexOutOfBoundsException("getTree: Index value '" + index
403 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
406 return (jalview.binding.Tree) _treeList.get(index);
410 * Method getTree.Returns the contents of the collection in an Array.
412 * Note: Just in case the collection contents are changing in another thread,
413 * we pass a 0-length Array of the correct type into the API call. This way we
414 * <i>know</i> that the Array returned is of exactly the correct length.
416 * @return this collection as an Array
418 public jalview.binding.Tree[] getTree()
420 jalview.binding.Tree[] array = new jalview.binding.Tree[0];
421 return (jalview.binding.Tree[]) this._treeList.toArray(array);
425 * Method getTreeCount.
427 * @return the size of this collection
429 public int getTreeCount()
431 return this._treeList.size();
435 * Method getUserColours.
438 * @throws java.lang.IndexOutOfBoundsException
439 * if the index given is outside the bounds of the collection
440 * @return the value of the jalview.binding.UserColours at the given index
442 public jalview.binding.UserColours getUserColours(final int index)
443 throws java.lang.IndexOutOfBoundsException
445 // check bounds for index
446 if (index < 0 || index >= this._userColoursList.size())
448 throw new IndexOutOfBoundsException("getUserColours: Index value '"
449 + index + "' not in range [0.."
450 + (this._userColoursList.size() - 1) + "]");
453 return (jalview.binding.UserColours) _userColoursList.get(index);
457 * Method getUserColours.Returns the contents of the collection in an Array.
459 * Note: Just in case the collection contents are changing in another thread,
460 * we pass a 0-length Array of the correct type into the API call. This way we
461 * <i>know</i> that the Array returned is of exactly the correct length.
463 * @return this collection as an Array
465 public jalview.binding.UserColours[] getUserColours()
467 jalview.binding.UserColours[] array = new jalview.binding.UserColours[0];
468 return (jalview.binding.UserColours[]) this._userColoursList
473 * Method getUserColoursCount.
475 * @return the size of this collection
477 public int getUserColoursCount()
479 return this._userColoursList.size();
483 * Method getViewport.
486 * @throws java.lang.IndexOutOfBoundsException
487 * if the index given is outside the bounds of the collection
488 * @return the value of the jalview.binding.Viewport at the given index
490 public jalview.binding.Viewport getViewport(final int index)
491 throws java.lang.IndexOutOfBoundsException
493 // check bounds for index
494 if (index < 0 || index >= this._viewportList.size())
496 throw new IndexOutOfBoundsException(
497 "getViewport: Index value '" + index + "' not in range [0.."
498 + (this._viewportList.size() - 1) + "]");
501 return (jalview.binding.Viewport) _viewportList.get(index);
505 * Method getViewport.Returns the contents of the collection in an Array.
507 * Note: Just in case the collection contents are changing in another thread,
508 * we pass a 0-length Array of the correct type into the API call. This way we
509 * <i>know</i> that the Array returned is of exactly the correct length.
511 * @return this collection as an Array
513 public jalview.binding.Viewport[] getViewport()
515 jalview.binding.Viewport[] array = new jalview.binding.Viewport[0];
516 return (jalview.binding.Viewport[]) this._viewportList.toArray(array);
520 * Method getViewportCount.
522 * @return the size of this collection
524 public int getViewportCount()
526 return this._viewportList.size();
532 * @return true if this object is valid according to the schema
534 public boolean isValid()
539 } catch (org.exolab.castor.xml.ValidationException vex)
550 * @throws org.exolab.castor.xml.MarshalException
551 * if object is null or if any SAXException is thrown during
553 * @throws org.exolab.castor.xml.ValidationException
554 * if this object is an invalid instance according to the schema
556 public void marshal(final java.io.Writer out)
557 throws org.exolab.castor.xml.MarshalException,
558 org.exolab.castor.xml.ValidationException
560 Marshaller.marshal(this, out);
567 * @throws java.io.IOException
568 * if an IOException occurs during marshaling
569 * @throws org.exolab.castor.xml.ValidationException
570 * if this object is an invalid instance according to the schema
571 * @throws org.exolab.castor.xml.MarshalException
572 * if object is null or if any SAXException is thrown during
575 public void marshal(final org.xml.sax.ContentHandler handler)
576 throws java.io.IOException,
577 org.exolab.castor.xml.MarshalException,
578 org.exolab.castor.xml.ValidationException
580 Marshaller.marshal(this, handler);
585 public void removeAllJGroup()
587 this._JGroupList.clear();
592 public void removeAllJSeq()
594 this._JSeqList.clear();
599 public void removeAllTree()
601 this._treeList.clear();
606 public void removeAllUserColours()
608 this._userColoursList.clear();
613 public void removeAllViewport()
615 this._viewportList.clear();
619 * Method removeJGroup.
622 * @return true if the object was removed from the collection.
624 public boolean removeJGroup(final jalview.binding.JGroup vJGroup)
626 boolean removed = _JGroupList.remove(vJGroup);
631 * Method removeJGroupAt.
634 * @return the element removed from the collection
636 public jalview.binding.JGroup removeJGroupAt(final int index)
638 java.lang.Object obj = this._JGroupList.remove(index);
639 return (jalview.binding.JGroup) obj;
646 * @return true if the object was removed from the collection.
648 public boolean removeJSeq(final jalview.binding.JSeq vJSeq)
650 boolean removed = _JSeqList.remove(vJSeq);
655 * Method removeJSeqAt.
658 * @return the element removed from the collection
660 public jalview.binding.JSeq removeJSeqAt(final int index)
662 java.lang.Object obj = this._JSeqList.remove(index);
663 return (jalview.binding.JSeq) obj;
670 * @return true if the object was removed from the collection.
672 public boolean removeTree(final jalview.binding.Tree vTree)
674 boolean removed = _treeList.remove(vTree);
679 * Method removeTreeAt.
682 * @return the element removed from the collection
684 public jalview.binding.Tree removeTreeAt(final int index)
686 java.lang.Object obj = this._treeList.remove(index);
687 return (jalview.binding.Tree) obj;
691 * Method removeUserColours.
693 * @param vUserColours
694 * @return true if the object was removed from the collection.
696 public boolean removeUserColours(
697 final jalview.binding.UserColours vUserColours)
699 boolean removed = _userColoursList.remove(vUserColours);
704 * Method removeUserColoursAt.
707 * @return the element removed from the collection
709 public jalview.binding.UserColours removeUserColoursAt(final int index)
711 java.lang.Object obj = this._userColoursList.remove(index);
712 return (jalview.binding.UserColours) obj;
716 * Method removeViewport.
719 * @return true if the object was removed from the collection.
721 public boolean removeViewport(final jalview.binding.Viewport vViewport)
723 boolean removed = _viewportList.remove(vViewport);
728 * Method removeViewportAt.
731 * @return the element removed from the collection
733 public jalview.binding.Viewport removeViewportAt(final int index)
735 java.lang.Object obj = this._viewportList.remove(index);
736 return (jalview.binding.Viewport) obj;
740 * Sets the value of field 'featureSettings'.
742 * @param featureSettings
743 * the value of field 'featureSettings'.
745 public void setFeatureSettings(
746 final jalview.binding.FeatureSettings featureSettings)
748 this._featureSettings = featureSettings;
756 * @throws java.lang.IndexOutOfBoundsException
757 * if the index given is outside the bounds of the collection
759 public void setJGroup(final int index,
760 final jalview.binding.JGroup vJGroup)
761 throws java.lang.IndexOutOfBoundsException
763 // check bounds for index
764 if (index < 0 || index >= this._JGroupList.size())
766 throw new IndexOutOfBoundsException(
767 "setJGroup: Index value '" + index + "' not in range [0.."
768 + (this._JGroupList.size() - 1) + "]");
771 this._JGroupList.set(index, vJGroup);
777 * @param vJGroupArray
779 public void setJGroup(final jalview.binding.JGroup[] vJGroupArray)
784 for (int i = 0; i < vJGroupArray.length; i++)
786 this._JGroupList.add(vJGroupArray[i]);
795 * @throws java.lang.IndexOutOfBoundsException
796 * if the index given is outside the bounds of the collection
798 public void setJSeq(final int index, final jalview.binding.JSeq vJSeq)
799 throws java.lang.IndexOutOfBoundsException
801 // check bounds for index
802 if (index < 0 || index >= this._JSeqList.size())
804 throw new IndexOutOfBoundsException("setJSeq: Index value '" + index
805 + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
808 this._JSeqList.set(index, vJSeq);
816 public void setJSeq(final jalview.binding.JSeq[] vJSeqArray)
821 for (int i = 0; i < vJSeqArray.length; i++)
823 this._JSeqList.add(vJSeqArray[i]);
832 * @throws java.lang.IndexOutOfBoundsException
833 * if the index given is outside the bounds of the collection
835 public void setTree(final int index, final jalview.binding.Tree vTree)
836 throws java.lang.IndexOutOfBoundsException
838 // check bounds for index
839 if (index < 0 || index >= this._treeList.size())
841 throw new IndexOutOfBoundsException("setTree: Index value '" + index
842 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
845 this._treeList.set(index, vTree);
853 public void setTree(final jalview.binding.Tree[] vTreeArray)
858 for (int i = 0; i < vTreeArray.length; i++)
860 this._treeList.add(vTreeArray[i]);
868 * @param vUserColours
869 * @throws java.lang.IndexOutOfBoundsException
870 * if the index given is outside the bounds of the collection
872 public void setUserColours(final int index,
873 final jalview.binding.UserColours vUserColours)
874 throws java.lang.IndexOutOfBoundsException
876 // check bounds for index
877 if (index < 0 || index >= this._userColoursList.size())
879 throw new IndexOutOfBoundsException("setUserColours: Index value '"
880 + index + "' not in range [0.."
881 + (this._userColoursList.size() - 1) + "]");
884 this._userColoursList.set(index, vUserColours);
890 * @param vUserColoursArray
892 public void setUserColours(
893 final jalview.binding.UserColours[] vUserColoursArray)
896 _userColoursList.clear();
898 for (int i = 0; i < vUserColoursArray.length; i++)
900 this._userColoursList.add(vUserColoursArray[i]);
909 * @throws java.lang.IndexOutOfBoundsException
910 * if the index given is outside the bounds of the collection
912 public void setViewport(final int index,
913 final jalview.binding.Viewport vViewport)
914 throws java.lang.IndexOutOfBoundsException
916 // check bounds for index
917 if (index < 0 || index >= this._viewportList.size())
919 throw new IndexOutOfBoundsException(
920 "setViewport: Index value '" + index + "' not in range [0.."
921 + (this._viewportList.size() - 1) + "]");
924 this._viewportList.set(index, vViewport);
930 * @param vViewportArray
932 public void setViewport(final jalview.binding.Viewport[] vViewportArray)
935 _viewportList.clear();
937 for (int i = 0; i < vViewportArray.length; i++)
939 this._viewportList.add(vViewportArray[i]);
947 * @throws org.exolab.castor.xml.MarshalException
948 * if object is null or if any SAXException is thrown during
950 * @throws org.exolab.castor.xml.ValidationException
951 * if this object is an invalid instance according to the schema
952 * @return the unmarshaled jalview.binding.JalviewModelSequence
954 public static jalview.binding.JalviewModelSequence unmarshal(
955 final java.io.Reader reader)
956 throws org.exolab.castor.xml.MarshalException,
957 org.exolab.castor.xml.ValidationException
959 return (jalview.binding.JalviewModelSequence) Unmarshaller
960 .unmarshal(jalview.binding.JalviewModelSequence.class, reader);
966 * @throws org.exolab.castor.xml.ValidationException
967 * if this object is an invalid instance according to the schema
969 public void validate() throws org.exolab.castor.xml.ValidationException
971 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
972 validator.validate(this);