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.schemabinding.version2;
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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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,
147 final jalview.schemabinding.version2.JSeq vJSeq)
148 throws java.lang.IndexOutOfBoundsException
150 this._JSeqList.add(index, vJSeq);
157 * @throws java.lang.IndexOutOfBoundsException
158 * if the index given is outside the bounds of the collection
160 public void addTree(final jalview.schemabinding.version2.Tree vTree)
161 throws java.lang.IndexOutOfBoundsException
163 this._treeList.addElement(vTree);
171 * @throws java.lang.IndexOutOfBoundsException
172 * if the index given is outside the bounds of the collection
174 public void addTree(final int index,
175 final jalview.schemabinding.version2.Tree vTree)
176 throws java.lang.IndexOutOfBoundsException
178 this._treeList.add(index, vTree);
184 * @param vUserColours
185 * @throws java.lang.IndexOutOfBoundsException
186 * if the index given is outside the bounds of the collection
188 public void addUserColours(
189 final jalview.schemabinding.version2.UserColours vUserColours)
190 throws java.lang.IndexOutOfBoundsException
192 this._userColoursList.addElement(vUserColours);
199 * @param vUserColours
200 * @throws java.lang.IndexOutOfBoundsException
201 * if the index given is outside the bounds of the collection
203 public void addUserColours(final int index,
204 final jalview.schemabinding.version2.UserColours vUserColours)
205 throws java.lang.IndexOutOfBoundsException
207 this._userColoursList.add(index, vUserColours);
214 * @throws java.lang.IndexOutOfBoundsException
215 * if the index given is outside the bounds of the collection
217 public void addViewport(
218 final jalview.schemabinding.version2.Viewport vViewport)
219 throws java.lang.IndexOutOfBoundsException
221 this._viewportList.addElement(vViewport);
229 * @throws java.lang.IndexOutOfBoundsException
230 * if the index given is outside the bounds of the collection
232 public void addViewport(final int index,
233 final jalview.schemabinding.version2.Viewport vViewport)
234 throws java.lang.IndexOutOfBoundsException
236 this._viewportList.add(index, vViewport);
240 * Method enumerateJGroup.
242 * @return an Enumeration over all jalview.schemabinding.version2.JGroup
245 public java.util.Enumeration enumerateJGroup()
247 return this._JGroupList.elements();
251 * Method enumerateJSeq.
253 * @return an Enumeration over all jalview.schemabinding.version2.JSeq
256 public java.util.Enumeration enumerateJSeq()
258 return this._JSeqList.elements();
262 * Method enumerateTree.
264 * @return an Enumeration over all jalview.schemabinding.version2.Tree
267 public java.util.Enumeration enumerateTree()
269 return this._treeList.elements();
273 * Method enumerateUserColours.
275 * @return an Enumeration over all jalview.schemabinding.version2.UserColours
278 public java.util.Enumeration enumerateUserColours()
280 return this._userColoursList.elements();
284 * Method enumerateViewport.
286 * @return an Enumeration over all jalview.schemabinding.version2.Viewport
289 public java.util.Enumeration enumerateViewport()
291 return this._viewportList.elements();
295 * Returns the value of field 'featureSettings'.
297 * @return the value of field 'FeatureSettings'.
299 public jalview.schemabinding.version2.FeatureSettings getFeatureSettings()
301 return this._featureSettings;
308 * @throws java.lang.IndexOutOfBoundsException
309 * if the index given is outside the bounds of the collection
310 * @return the value of the jalview.schemabinding.version2.JGroup at the given
313 public jalview.schemabinding.version2.JGroup getJGroup(final int index)
314 throws java.lang.IndexOutOfBoundsException
316 // check bounds for index
317 if (index < 0 || index >= this._JGroupList.size())
319 throw new IndexOutOfBoundsException("getJGroup: Index value '"
320 + index + "' not in range [0.."
321 + (this._JGroupList.size() - 1) + "]");
324 return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index);
328 * Method getJGroup.Returns the contents of the collection in an Array.
330 * Note: Just in case the collection contents are changing in another thread,
331 * we pass a 0-length Array of the correct type into the API call. This way we
332 * <i>know</i> that the Array returned is of exactly the correct length.
334 * @return this collection as an Array
336 public jalview.schemabinding.version2.JGroup[] getJGroup()
338 jalview.schemabinding.version2.JGroup[] array = new jalview.schemabinding.version2.JGroup[0];
339 return (jalview.schemabinding.version2.JGroup[]) this._JGroupList
344 * Method getJGroupCount.
346 * @return the size of this collection
348 public int getJGroupCount()
350 return this._JGroupList.size();
357 * @throws java.lang.IndexOutOfBoundsException
358 * if the index given is outside the bounds of the collection
359 * @return the value of the jalview.schemabinding.version2.JSeq at the given
362 public jalview.schemabinding.version2.JSeq getJSeq(final int index)
363 throws java.lang.IndexOutOfBoundsException
365 // check bounds for index
366 if (index < 0 || index >= this._JSeqList.size())
368 throw new IndexOutOfBoundsException("getJSeq: Index value '" + index
369 + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
372 return (jalview.schemabinding.version2.JSeq) _JSeqList.get(index);
376 * Method getJSeq.Returns the contents of the collection in an Array.
378 * Note: Just in case the collection contents are changing in another thread,
379 * we pass a 0-length Array of the correct type into the API call. This way we
380 * <i>know</i> that the Array returned is of exactly the correct length.
382 * @return this collection as an Array
384 public jalview.schemabinding.version2.JSeq[] getJSeq()
386 jalview.schemabinding.version2.JSeq[] array = new jalview.schemabinding.version2.JSeq[0];
387 return (jalview.schemabinding.version2.JSeq[]) this._JSeqList
392 * Method getJSeqCount.
394 * @return the size of this collection
396 public int getJSeqCount()
398 return this._JSeqList.size();
405 * @throws java.lang.IndexOutOfBoundsException
406 * if the index given is outside the bounds of the collection
407 * @return the value of the jalview.schemabinding.version2.Tree at the given
410 public jalview.schemabinding.version2.Tree getTree(final int index)
411 throws java.lang.IndexOutOfBoundsException
413 // check bounds for index
414 if (index < 0 || index >= this._treeList.size())
416 throw new IndexOutOfBoundsException("getTree: Index value '" + index
417 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
420 return (jalview.schemabinding.version2.Tree) _treeList.get(index);
424 * Method getTree.Returns the contents of the collection in an Array.
426 * Note: Just in case the collection contents are changing in another thread,
427 * we pass a 0-length Array of the correct type into the API call. This way we
428 * <i>know</i> that the Array returned is of exactly the correct length.
430 * @return this collection as an Array
432 public jalview.schemabinding.version2.Tree[] getTree()
434 jalview.schemabinding.version2.Tree[] array = new jalview.schemabinding.version2.Tree[0];
435 return (jalview.schemabinding.version2.Tree[]) this._treeList
440 * Method getTreeCount.
442 * @return the size of this collection
444 public int getTreeCount()
446 return this._treeList.size();
450 * Method getUserColours.
453 * @throws java.lang.IndexOutOfBoundsException
454 * if the index given is outside the bounds of the collection
455 * @return the value of the jalview.schemabinding.version2.UserColours at the
458 public jalview.schemabinding.version2.UserColours getUserColours(
459 final int index) throws java.lang.IndexOutOfBoundsException
461 // check bounds for index
462 if (index < 0 || index >= this._userColoursList.size())
464 throw new IndexOutOfBoundsException("getUserColours: Index value '"
465 + index + "' not in range [0.."
466 + (this._userColoursList.size() - 1) + "]");
469 return (jalview.schemabinding.version2.UserColours) _userColoursList
474 * Method getUserColours.Returns the contents of the collection in an Array.
476 * Note: Just in case the collection contents are changing in another thread,
477 * we pass a 0-length Array of the correct type into the API call. This way we
478 * <i>know</i> that the Array returned is of exactly the correct length.
480 * @return this collection as an Array
482 public jalview.schemabinding.version2.UserColours[] getUserColours()
484 jalview.schemabinding.version2.UserColours[] array = new jalview.schemabinding.version2.UserColours[0];
485 return (jalview.schemabinding.version2.UserColours[]) this._userColoursList
490 * Method getUserColoursCount.
492 * @return the size of this collection
494 public int getUserColoursCount()
496 return this._userColoursList.size();
500 * Method getViewport.
503 * @throws java.lang.IndexOutOfBoundsException
504 * if the index given is outside the bounds of the collection
505 * @return the value of the jalview.schemabinding.version2.Viewport at the
508 public jalview.schemabinding.version2.Viewport getViewport(final int index)
509 throws java.lang.IndexOutOfBoundsException
511 // check bounds for index
512 if (index < 0 || index >= this._viewportList.size())
514 throw new IndexOutOfBoundsException("getViewport: Index value '"
515 + index + "' not in range [0.."
516 + (this._viewportList.size() - 1) + "]");
519 return (jalview.schemabinding.version2.Viewport) _viewportList
524 * Method getViewport.Returns the contents of the collection in an Array.
526 * Note: Just in case the collection contents are changing in another thread,
527 * we pass a 0-length Array of the correct type into the API call. This way we
528 * <i>know</i> that the Array returned is of exactly the correct length.
530 * @return this collection as an Array
532 public jalview.schemabinding.version2.Viewport[] getViewport()
534 jalview.schemabinding.version2.Viewport[] array = new jalview.schemabinding.version2.Viewport[0];
535 return (jalview.schemabinding.version2.Viewport[]) this._viewportList
540 * Method getViewportCount.
542 * @return the size of this collection
544 public int getViewportCount()
546 return this._viewportList.size();
552 * @return true if this object is valid according to the schema
554 public boolean isValid()
559 } catch (org.exolab.castor.xml.ValidationException vex)
570 * @throws org.exolab.castor.xml.MarshalException
571 * if object is null or if any SAXException is thrown during
573 * @throws org.exolab.castor.xml.ValidationException
574 * if this object is an invalid instance according to the schema
576 public void marshal(final java.io.Writer out)
577 throws org.exolab.castor.xml.MarshalException,
578 org.exolab.castor.xml.ValidationException
580 Marshaller.marshal(this, out);
587 * @throws java.io.IOException
588 * if an IOException occurs during marshaling
589 * @throws org.exolab.castor.xml.ValidationException
590 * if this object is an invalid instance according to the schema
591 * @throws org.exolab.castor.xml.MarshalException
592 * if object is null or if any SAXException is thrown during
595 public void marshal(final org.xml.sax.ContentHandler handler)
596 throws java.io.IOException,
597 org.exolab.castor.xml.MarshalException,
598 org.exolab.castor.xml.ValidationException
600 Marshaller.marshal(this, handler);
605 public void removeAllJGroup()
607 this._JGroupList.clear();
612 public void removeAllJSeq()
614 this._JSeqList.clear();
619 public void removeAllTree()
621 this._treeList.clear();
626 public void removeAllUserColours()
628 this._userColoursList.clear();
633 public void removeAllViewport()
635 this._viewportList.clear();
639 * Method removeJGroup.
642 * @return true if the object was removed from the collection.
644 public boolean removeJGroup(
645 final jalview.schemabinding.version2.JGroup vJGroup)
647 boolean removed = _JGroupList.remove(vJGroup);
652 * Method removeJGroupAt.
655 * @return the element removed from the collection
657 public jalview.schemabinding.version2.JGroup removeJGroupAt(
660 java.lang.Object obj = this._JGroupList.remove(index);
661 return (jalview.schemabinding.version2.JGroup) obj;
668 * @return true if the object was removed from the collection.
670 public boolean removeJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
672 boolean removed = _JSeqList.remove(vJSeq);
677 * Method removeJSeqAt.
680 * @return the element removed from the collection
682 public jalview.schemabinding.version2.JSeq removeJSeqAt(final int index)
684 java.lang.Object obj = this._JSeqList.remove(index);
685 return (jalview.schemabinding.version2.JSeq) obj;
692 * @return true if the object was removed from the collection.
694 public boolean removeTree(final jalview.schemabinding.version2.Tree vTree)
696 boolean removed = _treeList.remove(vTree);
701 * Method removeTreeAt.
704 * @return the element removed from the collection
706 public jalview.schemabinding.version2.Tree removeTreeAt(final int index)
708 java.lang.Object obj = this._treeList.remove(index);
709 return (jalview.schemabinding.version2.Tree) obj;
713 * Method removeUserColours.
715 * @param vUserColours
716 * @return true if the object was removed from the collection.
718 public boolean removeUserColours(
719 final jalview.schemabinding.version2.UserColours vUserColours)
721 boolean removed = _userColoursList.remove(vUserColours);
726 * Method removeUserColoursAt.
729 * @return the element removed from the collection
731 public jalview.schemabinding.version2.UserColours removeUserColoursAt(
734 java.lang.Object obj = this._userColoursList.remove(index);
735 return (jalview.schemabinding.version2.UserColours) obj;
739 * Method removeViewport.
742 * @return true if the object was removed from the collection.
744 public boolean removeViewport(
745 final jalview.schemabinding.version2.Viewport vViewport)
747 boolean removed = _viewportList.remove(vViewport);
752 * Method removeViewportAt.
755 * @return the element removed from the collection
757 public jalview.schemabinding.version2.Viewport removeViewportAt(
760 java.lang.Object obj = this._viewportList.remove(index);
761 return (jalview.schemabinding.version2.Viewport) obj;
765 * Sets the value of field 'featureSettings'.
767 * @param featureSettings
768 * the value of field 'featureSettings'.
770 public void setFeatureSettings(
771 final jalview.schemabinding.version2.FeatureSettings featureSettings)
773 this._featureSettings = featureSettings;
781 * @throws java.lang.IndexOutOfBoundsException
782 * if the index given is outside the bounds of the collection
784 public void setJGroup(final int index,
785 final jalview.schemabinding.version2.JGroup vJGroup)
786 throws java.lang.IndexOutOfBoundsException
788 // check bounds for index
789 if (index < 0 || index >= this._JGroupList.size())
791 throw new IndexOutOfBoundsException("setJGroup: Index value '"
792 + index + "' not in range [0.."
793 + (this._JGroupList.size() - 1) + "]");
796 this._JGroupList.set(index, vJGroup);
802 * @param vJGroupArray
804 public void setJGroup(
805 final jalview.schemabinding.version2.JGroup[] vJGroupArray)
810 for (int i = 0; i < vJGroupArray.length; i++)
812 this._JGroupList.add(vJGroupArray[i]);
821 * @throws java.lang.IndexOutOfBoundsException
822 * if the index given is outside the bounds of the collection
824 public void setJSeq(final int index,
825 final jalview.schemabinding.version2.JSeq vJSeq)
826 throws java.lang.IndexOutOfBoundsException
828 // check bounds for index
829 if (index < 0 || index >= this._JSeqList.size())
831 throw new IndexOutOfBoundsException("setJSeq: Index value '" + index
832 + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
835 this._JSeqList.set(index, vJSeq);
843 public void setJSeq(final jalview.schemabinding.version2.JSeq[] vJSeqArray)
848 for (int i = 0; i < vJSeqArray.length; i++)
850 this._JSeqList.add(vJSeqArray[i]);
859 * @throws java.lang.IndexOutOfBoundsException
860 * if the index given is outside the bounds of the collection
862 public void setTree(final int index,
863 final jalview.schemabinding.version2.Tree vTree)
864 throws java.lang.IndexOutOfBoundsException
866 // check bounds for index
867 if (index < 0 || index >= this._treeList.size())
869 throw new IndexOutOfBoundsException("setTree: Index value '" + index
870 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
873 this._treeList.set(index, vTree);
881 public void setTree(final jalview.schemabinding.version2.Tree[] vTreeArray)
886 for (int i = 0; i < vTreeArray.length; i++)
888 this._treeList.add(vTreeArray[i]);
896 * @param vUserColours
897 * @throws java.lang.IndexOutOfBoundsException
898 * if the index given is outside the bounds of the collection
900 public void setUserColours(final int index,
901 final jalview.schemabinding.version2.UserColours vUserColours)
902 throws java.lang.IndexOutOfBoundsException
904 // check bounds for index
905 if (index < 0 || index >= this._userColoursList.size())
907 throw new IndexOutOfBoundsException("setUserColours: Index value '"
908 + index + "' not in range [0.."
909 + (this._userColoursList.size() - 1) + "]");
912 this._userColoursList.set(index, vUserColours);
918 * @param vUserColoursArray
920 public void setUserColours(
921 final jalview.schemabinding.version2.UserColours[] vUserColoursArray)
924 _userColoursList.clear();
926 for (int i = 0; i < vUserColoursArray.length; i++)
928 this._userColoursList.add(vUserColoursArray[i]);
937 * @throws java.lang.IndexOutOfBoundsException
938 * if the index given is outside the bounds of the collection
940 public void setViewport(final int index,
941 final jalview.schemabinding.version2.Viewport vViewport)
942 throws java.lang.IndexOutOfBoundsException
944 // check bounds for index
945 if (index < 0 || index >= this._viewportList.size())
947 throw new IndexOutOfBoundsException("setViewport: Index value '"
948 + index + "' not in range [0.."
949 + (this._viewportList.size() - 1) + "]");
952 this._viewportList.set(index, vViewport);
958 * @param vViewportArray
960 public void setViewport(
961 final jalview.schemabinding.version2.Viewport[] vViewportArray)
964 _viewportList.clear();
966 for (int i = 0; i < vViewportArray.length; i++)
968 this._viewportList.add(vViewportArray[i]);
976 * @throws org.exolab.castor.xml.MarshalException
977 * if object is null or if any SAXException is thrown during
979 * @throws org.exolab.castor.xml.ValidationException
980 * if this object is an invalid instance according to the schema
981 * @return the unmarshaled jalview.schemabinding.version2.JalviewModelSequence
983 public static jalview.schemabinding.version2.JalviewModelSequence unmarshal(
984 final java.io.Reader reader)
985 throws org.exolab.castor.xml.MarshalException,
986 org.exolab.castor.xml.ValidationException
988 return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller
990 jalview.schemabinding.version2.JalviewModelSequence.class,
997 * @throws org.exolab.castor.xml.ValidationException
998 * if this object is an invalid instance according to the schema
1000 public void validate() throws org.exolab.castor.xml.ValidationException
1002 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1003 validator.validate(this);