1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 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 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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
37 * Class JalviewModelSequence.
39 * @version $Revision$ $Date$
41 public class JalviewModelSequence implements java.io.Serializable
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
51 private java.util.Vector _JSeqList;
56 private java.util.Vector _JGroupList;
59 * Field _viewportList.
61 private java.util.Vector _viewportList;
64 * Field _userColoursList.
66 private java.util.Vector _userColoursList;
71 private java.util.Vector _treeList;
74 * Field _featureSettings.
76 private jalview.schemabinding.version2.FeatureSettings _featureSettings;
82 public JalviewModelSequence()
85 this._JSeqList = new java.util.Vector();
86 this._JGroupList = new java.util.Vector();
87 this._viewportList = new java.util.Vector();
88 this._userColoursList = new java.util.Vector();
89 this._treeList = new java.util.Vector();
100 * @throws java.lang.IndexOutOfBoundsException
101 * if the index given is outside the bounds of the collection
103 public void addJGroup(final jalview.schemabinding.version2.JGroup vJGroup)
104 throws java.lang.IndexOutOfBoundsException
106 this._JGroupList.addElement(vJGroup);
114 * @throws java.lang.IndexOutOfBoundsException
115 * if the index given is outside the bounds of the collection
117 public void addJGroup(final int index,
118 final jalview.schemabinding.version2.JGroup vJGroup)
119 throws java.lang.IndexOutOfBoundsException
121 this._JGroupList.add(index, vJGroup);
128 * @throws java.lang.IndexOutOfBoundsException
129 * if the index given is outside the bounds of the collection
131 public void addJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
132 throws java.lang.IndexOutOfBoundsException
134 this._JSeqList.addElement(vJSeq);
142 * @throws java.lang.IndexOutOfBoundsException
143 * if the index given is outside the bounds of the collection
145 public void addJSeq(final int index,
146 final jalview.schemabinding.version2.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.schemabinding.version2.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,
174 final jalview.schemabinding.version2.Tree vTree)
175 throws java.lang.IndexOutOfBoundsException
177 this._treeList.add(index, vTree);
183 * @param vUserColours
184 * @throws java.lang.IndexOutOfBoundsException
185 * if the index given is outside the bounds of the collection
187 public void addUserColours(
188 final jalview.schemabinding.version2.UserColours vUserColours)
189 throws java.lang.IndexOutOfBoundsException
191 this._userColoursList.addElement(vUserColours);
198 * @param vUserColours
199 * @throws java.lang.IndexOutOfBoundsException
200 * if the index given is outside the bounds of the collection
202 public void addUserColours(final int index,
203 final jalview.schemabinding.version2.UserColours vUserColours)
204 throws java.lang.IndexOutOfBoundsException
206 this._userColoursList.add(index, vUserColours);
213 * @throws java.lang.IndexOutOfBoundsException
214 * if the index given is outside the bounds of the collection
216 public void addViewport(
217 final jalview.schemabinding.version2.Viewport vViewport)
218 throws java.lang.IndexOutOfBoundsException
220 this._viewportList.addElement(vViewport);
228 * @throws java.lang.IndexOutOfBoundsException
229 * if the index given is outside the bounds of the collection
231 public void addViewport(final int index,
232 final jalview.schemabinding.version2.Viewport vViewport)
233 throws java.lang.IndexOutOfBoundsException
235 this._viewportList.add(index, vViewport);
239 * Method enumerateJGroup.
241 * @return an Enumeration over all jalview.schemabinding.version2.JGroup
244 public java.util.Enumeration enumerateJGroup()
246 return this._JGroupList.elements();
250 * Method enumerateJSeq.
252 * @return an Enumeration over all jalview.schemabinding.version2.JSeq
255 public java.util.Enumeration enumerateJSeq()
257 return this._JSeqList.elements();
261 * Method enumerateTree.
263 * @return an Enumeration over all jalview.schemabinding.version2.Tree
266 public java.util.Enumeration enumerateTree()
268 return this._treeList.elements();
272 * Method enumerateUserColours.
274 * @return an Enumeration over all jalview.schemabinding.version2.UserColours
277 public java.util.Enumeration enumerateUserColours()
279 return this._userColoursList.elements();
283 * Method enumerateViewport.
285 * @return an Enumeration over all jalview.schemabinding.version2.Viewport
288 public java.util.Enumeration enumerateViewport()
290 return this._viewportList.elements();
294 * Returns the value of field 'featureSettings'.
296 * @return the value of field 'FeatureSettings'.
298 public jalview.schemabinding.version2.FeatureSettings getFeatureSettings()
300 return this._featureSettings;
307 * @throws java.lang.IndexOutOfBoundsException
308 * if the index given is outside the bounds of the collection
309 * @return the value of the jalview.schemabinding.version2.JGroup at the given
312 public jalview.schemabinding.version2.JGroup getJGroup(final int index)
313 throws java.lang.IndexOutOfBoundsException
315 // check bounds for index
316 if (index < 0 || index >= this._JGroupList.size())
318 throw new IndexOutOfBoundsException("getJGroup: Index value '"
319 + index + "' not in range [0.."
320 + (this._JGroupList.size() - 1) + "]");
323 return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index);
327 * Method getJGroup.Returns the contents of the collection in an Array.
329 * Note: Just in case the collection contents are changing in another thread,
330 * we pass a 0-length Array of the correct type into the API call. This way we
331 * <i>know</i> that the Array returned is of exactly the correct length.
333 * @return this collection as an Array
335 public jalview.schemabinding.version2.JGroup[] getJGroup()
337 jalview.schemabinding.version2.JGroup[] array = new jalview.schemabinding.version2.JGroup[0];
338 return (jalview.schemabinding.version2.JGroup[]) this._JGroupList
343 * Method getJGroupCount.
345 * @return the size of this collection
347 public int getJGroupCount()
349 return this._JGroupList.size();
356 * @throws java.lang.IndexOutOfBoundsException
357 * if the index given is outside the bounds of the collection
358 * @return the value of the jalview.schemabinding.version2.JSeq at the given
361 public jalview.schemabinding.version2.JSeq getJSeq(final int index)
362 throws java.lang.IndexOutOfBoundsException
364 // check bounds for index
365 if (index < 0 || index >= this._JSeqList.size())
367 throw new IndexOutOfBoundsException("getJSeq: Index value '" + index
368 + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
371 return (jalview.schemabinding.version2.JSeq) _JSeqList.get(index);
375 * Method getJSeq.Returns the contents of the collection in an Array.
377 * Note: Just in case the collection contents are changing in another thread,
378 * we pass a 0-length Array of the correct type into the API call. This way we
379 * <i>know</i> that the Array returned is of exactly the correct length.
381 * @return this collection as an Array
383 public jalview.schemabinding.version2.JSeq[] getJSeq()
385 jalview.schemabinding.version2.JSeq[] array = new jalview.schemabinding.version2.JSeq[0];
386 return (jalview.schemabinding.version2.JSeq[]) this._JSeqList
391 * Method getJSeqCount.
393 * @return the size of this collection
395 public int getJSeqCount()
397 return this._JSeqList.size();
404 * @throws java.lang.IndexOutOfBoundsException
405 * if the index given is outside the bounds of the collection
406 * @return the value of the jalview.schemabinding.version2.Tree at the given
409 public jalview.schemabinding.version2.Tree getTree(final int index)
410 throws java.lang.IndexOutOfBoundsException
412 // check bounds for index
413 if (index < 0 || index >= this._treeList.size())
415 throw new IndexOutOfBoundsException("getTree: Index value '" + index
416 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
419 return (jalview.schemabinding.version2.Tree) _treeList.get(index);
423 * Method getTree.Returns the contents of the collection in an Array.
425 * Note: Just in case the collection contents are changing in another thread,
426 * we pass a 0-length Array of the correct type into the API call. This way we
427 * <i>know</i> that the Array returned is of exactly the correct length.
429 * @return this collection as an Array
431 public jalview.schemabinding.version2.Tree[] getTree()
433 jalview.schemabinding.version2.Tree[] array = new jalview.schemabinding.version2.Tree[0];
434 return (jalview.schemabinding.version2.Tree[]) this._treeList
439 * Method getTreeCount.
441 * @return the size of this collection
443 public int getTreeCount()
445 return this._treeList.size();
449 * Method getUserColours.
452 * @throws java.lang.IndexOutOfBoundsException
453 * if the index given is outside the bounds of the collection
454 * @return the value of the jalview.schemabinding.version2.UserColours at the
457 public jalview.schemabinding.version2.UserColours getUserColours(
458 final int index) throws java.lang.IndexOutOfBoundsException
460 // check bounds for index
461 if (index < 0 || index >= this._userColoursList.size())
463 throw new IndexOutOfBoundsException("getUserColours: Index value '"
464 + index + "' not in range [0.."
465 + (this._userColoursList.size() - 1) + "]");
468 return (jalview.schemabinding.version2.UserColours) _userColoursList
473 * Method getUserColours.Returns the contents of the collection in an Array.
475 * Note: Just in case the collection contents are changing in another thread,
476 * we pass a 0-length Array of the correct type into the API call. This way we
477 * <i>know</i> that the Array returned is of exactly the correct length.
479 * @return this collection as an Array
481 public jalview.schemabinding.version2.UserColours[] getUserColours()
483 jalview.schemabinding.version2.UserColours[] array = new jalview.schemabinding.version2.UserColours[0];
484 return (jalview.schemabinding.version2.UserColours[]) this._userColoursList
489 * Method getUserColoursCount.
491 * @return the size of this collection
493 public int getUserColoursCount()
495 return this._userColoursList.size();
499 * Method getViewport.
502 * @throws java.lang.IndexOutOfBoundsException
503 * if the index given is outside the bounds of the collection
504 * @return the value of the jalview.schemabinding.version2.Viewport at the
507 public jalview.schemabinding.version2.Viewport getViewport(final int index)
508 throws java.lang.IndexOutOfBoundsException
510 // check bounds for index
511 if (index < 0 || index >= this._viewportList.size())
513 throw new IndexOutOfBoundsException("getViewport: Index value '"
514 + index + "' not in range [0.."
515 + (this._viewportList.size() - 1) + "]");
518 return (jalview.schemabinding.version2.Viewport) _viewportList
523 * Method getViewport.Returns the contents of the collection in an Array.
525 * Note: Just in case the collection contents are changing in another thread,
526 * we pass a 0-length Array of the correct type into the API call. This way we
527 * <i>know</i> that the Array returned is of exactly the correct length.
529 * @return this collection as an Array
531 public jalview.schemabinding.version2.Viewport[] getViewport()
533 jalview.schemabinding.version2.Viewport[] array = new jalview.schemabinding.version2.Viewport[0];
534 return (jalview.schemabinding.version2.Viewport[]) this._viewportList
539 * Method getViewportCount.
541 * @return the size of this collection
543 public int getViewportCount()
545 return this._viewportList.size();
551 * @return true if this object is valid according to the schema
553 public boolean isValid()
558 } catch (org.exolab.castor.xml.ValidationException vex)
569 * @throws org.exolab.castor.xml.MarshalException
570 * if object is null or if any SAXException is thrown during
572 * @throws org.exolab.castor.xml.ValidationException
573 * if this object is an invalid instance according to the schema
575 public void marshal(final java.io.Writer out)
576 throws org.exolab.castor.xml.MarshalException,
577 org.exolab.castor.xml.ValidationException
579 Marshaller.marshal(this, out);
586 * @throws java.io.IOException
587 * if an IOException occurs during marshaling
588 * @throws org.exolab.castor.xml.ValidationException
589 * if this object is an invalid instance according to the schema
590 * @throws org.exolab.castor.xml.MarshalException
591 * if object is null or if any SAXException is thrown during
594 public void marshal(final org.xml.sax.ContentHandler handler)
595 throws java.io.IOException,
596 org.exolab.castor.xml.MarshalException,
597 org.exolab.castor.xml.ValidationException
599 Marshaller.marshal(this, handler);
604 public void removeAllJGroup()
606 this._JGroupList.clear();
611 public void removeAllJSeq()
613 this._JSeqList.clear();
618 public void removeAllTree()
620 this._treeList.clear();
625 public void removeAllUserColours()
627 this._userColoursList.clear();
632 public void removeAllViewport()
634 this._viewportList.clear();
638 * Method removeJGroup.
641 * @return true if the object was removed from the collection.
643 public boolean removeJGroup(
644 final jalview.schemabinding.version2.JGroup vJGroup)
646 boolean removed = _JGroupList.remove(vJGroup);
651 * Method removeJGroupAt.
654 * @return the element removed from the collection
656 public jalview.schemabinding.version2.JGroup removeJGroupAt(
659 java.lang.Object obj = this._JGroupList.remove(index);
660 return (jalview.schemabinding.version2.JGroup) obj;
667 * @return true if the object was removed from the collection.
669 public boolean removeJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
671 boolean removed = _JSeqList.remove(vJSeq);
676 * Method removeJSeqAt.
679 * @return the element removed from the collection
681 public jalview.schemabinding.version2.JSeq removeJSeqAt(final int index)
683 java.lang.Object obj = this._JSeqList.remove(index);
684 return (jalview.schemabinding.version2.JSeq) obj;
691 * @return true if the object was removed from the collection.
693 public boolean removeTree(final jalview.schemabinding.version2.Tree vTree)
695 boolean removed = _treeList.remove(vTree);
700 * Method removeTreeAt.
703 * @return the element removed from the collection
705 public jalview.schemabinding.version2.Tree removeTreeAt(final int index)
707 java.lang.Object obj = this._treeList.remove(index);
708 return (jalview.schemabinding.version2.Tree) obj;
712 * Method removeUserColours.
714 * @param vUserColours
715 * @return true if the object was removed from the collection.
717 public boolean removeUserColours(
718 final jalview.schemabinding.version2.UserColours vUserColours)
720 boolean removed = _userColoursList.remove(vUserColours);
725 * Method removeUserColoursAt.
728 * @return the element removed from the collection
730 public jalview.schemabinding.version2.UserColours removeUserColoursAt(
733 java.lang.Object obj = this._userColoursList.remove(index);
734 return (jalview.schemabinding.version2.UserColours) obj;
738 * Method removeViewport.
741 * @return true if the object was removed from the collection.
743 public boolean removeViewport(
744 final jalview.schemabinding.version2.Viewport vViewport)
746 boolean removed = _viewportList.remove(vViewport);
751 * Method removeViewportAt.
754 * @return the element removed from the collection
756 public jalview.schemabinding.version2.Viewport removeViewportAt(
759 java.lang.Object obj = this._viewportList.remove(index);
760 return (jalview.schemabinding.version2.Viewport) obj;
764 * Sets the value of field 'featureSettings'.
766 * @param featureSettings
767 * the value of field 'featureSettings'.
769 public void setFeatureSettings(
770 final jalview.schemabinding.version2.FeatureSettings featureSettings)
772 this._featureSettings = featureSettings;
780 * @throws java.lang.IndexOutOfBoundsException
781 * if the index given is outside the bounds of the collection
783 public void setJGroup(final int index,
784 final jalview.schemabinding.version2.JGroup vJGroup)
785 throws java.lang.IndexOutOfBoundsException
787 // check bounds for index
788 if (index < 0 || index >= this._JGroupList.size())
790 throw new IndexOutOfBoundsException("setJGroup: Index value '"
791 + index + "' not in range [0.."
792 + (this._JGroupList.size() - 1) + "]");
795 this._JGroupList.set(index, vJGroup);
801 * @param vJGroupArray
803 public void setJGroup(
804 final jalview.schemabinding.version2.JGroup[] vJGroupArray)
809 for (int i = 0; i < vJGroupArray.length; i++)
811 this._JGroupList.add(vJGroupArray[i]);
820 * @throws java.lang.IndexOutOfBoundsException
821 * if the index given is outside the bounds of the collection
823 public void setJSeq(final int index,
824 final jalview.schemabinding.version2.JSeq vJSeq)
825 throws java.lang.IndexOutOfBoundsException
827 // check bounds for index
828 if (index < 0 || index >= this._JSeqList.size())
830 throw new IndexOutOfBoundsException("setJSeq: Index value '" + index
831 + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
834 this._JSeqList.set(index, vJSeq);
842 public void setJSeq(final jalview.schemabinding.version2.JSeq[] vJSeqArray)
847 for (int i = 0; i < vJSeqArray.length; i++)
849 this._JSeqList.add(vJSeqArray[i]);
858 * @throws java.lang.IndexOutOfBoundsException
859 * if the index given is outside the bounds of the collection
861 public void setTree(final int index,
862 final jalview.schemabinding.version2.Tree vTree)
863 throws java.lang.IndexOutOfBoundsException
865 // check bounds for index
866 if (index < 0 || index >= this._treeList.size())
868 throw new IndexOutOfBoundsException("setTree: Index value '" + index
869 + "' not in range [0.." + (this._treeList.size() - 1) + "]");
872 this._treeList.set(index, vTree);
880 public void setTree(final jalview.schemabinding.version2.Tree[] vTreeArray)
885 for (int i = 0; i < vTreeArray.length; i++)
887 this._treeList.add(vTreeArray[i]);
895 * @param vUserColours
896 * @throws java.lang.IndexOutOfBoundsException
897 * if the index given is outside the bounds of the collection
899 public void setUserColours(final int index,
900 final jalview.schemabinding.version2.UserColours vUserColours)
901 throws java.lang.IndexOutOfBoundsException
903 // check bounds for index
904 if (index < 0 || index >= this._userColoursList.size())
906 throw new IndexOutOfBoundsException("setUserColours: Index value '"
907 + index + "' not in range [0.."
908 + (this._userColoursList.size() - 1) + "]");
911 this._userColoursList.set(index, vUserColours);
917 * @param vUserColoursArray
919 public void setUserColours(
920 final jalview.schemabinding.version2.UserColours[] vUserColoursArray)
923 _userColoursList.clear();
925 for (int i = 0; i < vUserColoursArray.length; i++)
927 this._userColoursList.add(vUserColoursArray[i]);
936 * @throws java.lang.IndexOutOfBoundsException
937 * if the index given is outside the bounds of the collection
939 public void setViewport(final int index,
940 final jalview.schemabinding.version2.Viewport vViewport)
941 throws java.lang.IndexOutOfBoundsException
943 // check bounds for index
944 if (index < 0 || index >= this._viewportList.size())
946 throw new IndexOutOfBoundsException("setViewport: Index value '"
947 + index + "' not in range [0.."
948 + (this._viewportList.size() - 1) + "]");
951 this._viewportList.set(index, vViewport);
957 * @param vViewportArray
959 public void setViewport(
960 final jalview.schemabinding.version2.Viewport[] vViewportArray)
963 _viewportList.clear();
965 for (int i = 0; i < vViewportArray.length; i++)
967 this._viewportList.add(vViewportArray[i]);
975 * @throws org.exolab.castor.xml.MarshalException
976 * if object is null or if any SAXException is thrown during
978 * @throws org.exolab.castor.xml.ValidationException
979 * if this object is an invalid instance according to the schema
980 * @return the unmarshaled jalview.schemabinding.version2.JalviewModelSequence
982 public static jalview.schemabinding.version2.JalviewModelSequence unmarshal(
983 final java.io.Reader reader)
984 throws org.exolab.castor.xml.MarshalException,
985 org.exolab.castor.xml.ValidationException
987 return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller
989 jalview.schemabinding.version2.JalviewModelSequence.class,
996 * @throws org.exolab.castor.xml.ValidationException
997 * if this object is an invalid instance according to the schema
999 public void validate() throws org.exolab.castor.xml.ValidationException
1001 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1002 validator.validate(this);