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;
35 * Class JalviewModelSequence.
37 * @version $Revision$ $Date$
39 public class JalviewModelSequence implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
49 private java.util.Vector _JSeqList;
54 private java.util.Vector _JGroupList;
57 * Field _viewportList.
59 private java.util.Vector _viewportList;
62 * Field _userColoursList.
64 private java.util.Vector _userColoursList;
69 private java.util.Vector _treeList;
72 * Field _featureSettings.
74 private jalview.binding.FeatureSettings _featureSettings;
81 public JalviewModelSequence() {
83 this._JSeqList = new java.util.Vector();
84 this._JGroupList = new java.util.Vector();
85 this._viewportList = new java.util.Vector();
86 this._userColoursList = new java.util.Vector();
87 this._treeList = new java.util.Vector();
99 * @throws java.lang.IndexOutOfBoundsException if the index
100 * given is outside the bounds of the collection
102 public void addJGroup(
103 final jalview.binding.JGroup vJGroup)
104 throws java.lang.IndexOutOfBoundsException {
105 this._JGroupList.addElement(vJGroup);
113 * @throws java.lang.IndexOutOfBoundsException if the index
114 * given is outside the bounds of the collection
116 public void addJGroup(
118 final jalview.binding.JGroup vJGroup)
119 throws java.lang.IndexOutOfBoundsException {
120 this._JGroupList.add(index, vJGroup);
127 * @throws java.lang.IndexOutOfBoundsException if the index
128 * given is outside the bounds of the collection
131 final jalview.binding.JSeq vJSeq)
132 throws java.lang.IndexOutOfBoundsException {
133 this._JSeqList.addElement(vJSeq);
141 * @throws java.lang.IndexOutOfBoundsException if the index
142 * given is outside the bounds of the collection
146 final jalview.binding.JSeq vJSeq)
147 throws java.lang.IndexOutOfBoundsException {
148 this._JSeqList.add(index, vJSeq);
155 * @throws java.lang.IndexOutOfBoundsException if the index
156 * given is outside the bounds of the collection
159 final jalview.binding.Tree vTree)
160 throws java.lang.IndexOutOfBoundsException {
161 this._treeList.addElement(vTree);
169 * @throws java.lang.IndexOutOfBoundsException if the index
170 * given is outside the bounds of the collection
174 final jalview.binding.Tree vTree)
175 throws java.lang.IndexOutOfBoundsException {
176 this._treeList.add(index, vTree);
182 * @param vUserColours
183 * @throws java.lang.IndexOutOfBoundsException if the index
184 * given is outside the bounds of the collection
186 public void addUserColours(
187 final jalview.binding.UserColours vUserColours)
188 throws java.lang.IndexOutOfBoundsException {
189 this._userColoursList.addElement(vUserColours);
196 * @param vUserColours
197 * @throws java.lang.IndexOutOfBoundsException if the index
198 * given is outside the bounds of the collection
200 public void addUserColours(
202 final jalview.binding.UserColours vUserColours)
203 throws java.lang.IndexOutOfBoundsException {
204 this._userColoursList.add(index, vUserColours);
211 * @throws java.lang.IndexOutOfBoundsException if the index
212 * given is outside the bounds of the collection
214 public void addViewport(
215 final jalview.binding.Viewport vViewport)
216 throws java.lang.IndexOutOfBoundsException {
217 this._viewportList.addElement(vViewport);
225 * @throws java.lang.IndexOutOfBoundsException if the index
226 * given is outside the bounds of the collection
228 public void addViewport(
230 final jalview.binding.Viewport vViewport)
231 throws java.lang.IndexOutOfBoundsException {
232 this._viewportList.add(index, vViewport);
236 * Method enumerateJGroup.
238 * @return an Enumeration over all jalview.binding.JGroup
241 public java.util.Enumeration enumerateJGroup(
243 return this._JGroupList.elements();
247 * Method enumerateJSeq.
249 * @return an Enumeration over all jalview.binding.JSeq elements
251 public java.util.Enumeration enumerateJSeq(
253 return this._JSeqList.elements();
257 * Method enumerateTree.
259 * @return an Enumeration over all jalview.binding.Tree elements
261 public java.util.Enumeration enumerateTree(
263 return this._treeList.elements();
267 * Method enumerateUserColours.
269 * @return an Enumeration over all jalview.binding.UserColours
272 public java.util.Enumeration enumerateUserColours(
274 return this._userColoursList.elements();
278 * Method enumerateViewport.
280 * @return an Enumeration over all jalview.binding.Viewport
283 public java.util.Enumeration enumerateViewport(
285 return this._viewportList.elements();
289 * Returns the value of field 'featureSettings'.
291 * @return the value of field 'FeatureSettings'.
293 public jalview.binding.FeatureSettings getFeatureSettings(
295 return this._featureSettings;
302 * @throws java.lang.IndexOutOfBoundsException if the index
303 * given is outside the bounds of the collection
304 * @return the value of the jalview.binding.JGroup at the given
307 public jalview.binding.JGroup getJGroup(
309 throws java.lang.IndexOutOfBoundsException {
310 // check bounds for index
311 if (index < 0 || index >= this._JGroupList.size()) {
312 throw new IndexOutOfBoundsException("getJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
315 return (jalview.binding.JGroup) _JGroupList.get(index);
319 * Method getJGroup.Returns the contents of the collection in
320 * an Array. <p>Note: Just in case the collection contents
321 * are changing in another thread, we pass a 0-length Array of
322 * the correct type into the API call. This way we <i>know</i>
323 * that the Array returned is of exactly the correct length.
325 * @return this collection as an Array
327 public jalview.binding.JGroup[] getJGroup(
329 jalview.binding.JGroup[] array = new jalview.binding.JGroup[0];
330 return (jalview.binding.JGroup[]) this._JGroupList.toArray(array);
334 * Method getJGroupCount.
336 * @return the size of this collection
338 public int getJGroupCount(
340 return this._JGroupList.size();
347 * @throws java.lang.IndexOutOfBoundsException if the index
348 * given is outside the bounds of the collection
349 * @return the value of the jalview.binding.JSeq at the given
352 public jalview.binding.JSeq getJSeq(
354 throws java.lang.IndexOutOfBoundsException {
355 // check bounds for index
356 if (index < 0 || index >= this._JSeqList.size()) {
357 throw new IndexOutOfBoundsException("getJSeq: Index value '" + index + "' 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
365 * Array. <p>Note: Just in case the collection contents are
366 * changing in another thread, we pass a 0-length Array of the
367 * correct type into the API call. This way we <i>know</i>
368 * 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 if the index
393 * given is outside the bounds of the collection
394 * @return the value of the jalview.binding.Tree at the given
397 public jalview.binding.Tree getTree(
399 throws java.lang.IndexOutOfBoundsException {
400 // check bounds for index
401 if (index < 0 || index >= this._treeList.size()) {
402 throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
405 return (jalview.binding.Tree) _treeList.get(index);
409 * Method getTree.Returns the contents of the collection in an
410 * Array. <p>Note: Just in case the collection contents are
411 * changing in another thread, we pass a 0-length Array of the
412 * correct type into the API call. This way we <i>know</i>
413 * that the Array returned is of exactly the correct length.
415 * @return this collection as an Array
417 public jalview.binding.Tree[] getTree(
419 jalview.binding.Tree[] array = new jalview.binding.Tree[0];
420 return (jalview.binding.Tree[]) this._treeList.toArray(array);
424 * Method getTreeCount.
426 * @return the size of this collection
428 public int getTreeCount(
430 return this._treeList.size();
434 * Method getUserColours.
437 * @throws java.lang.IndexOutOfBoundsException if the index
438 * given is outside the bounds of the collection
439 * @return the value of the jalview.binding.UserColours at the
442 public jalview.binding.UserColours getUserColours(
444 throws java.lang.IndexOutOfBoundsException {
445 // check bounds for index
446 if (index < 0 || index >= this._userColoursList.size()) {
447 throw new IndexOutOfBoundsException("getUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
450 return (jalview.binding.UserColours) _userColoursList.get(index);
454 * Method getUserColours.Returns the contents of the collection
455 * in an Array. <p>Note: Just in case the collection contents
456 * are changing in another thread, we pass a 0-length Array of
457 * the correct type into the API call. This way we <i>know</i>
458 * that the Array returned is of exactly the correct length.
460 * @return this collection as an Array
462 public jalview.binding.UserColours[] getUserColours(
464 jalview.binding.UserColours[] array = new jalview.binding.UserColours[0];
465 return (jalview.binding.UserColours[]) this._userColoursList.toArray(array);
469 * Method getUserColoursCount.
471 * @return the size of this collection
473 public int getUserColoursCount(
475 return this._userColoursList.size();
479 * Method getViewport.
482 * @throws java.lang.IndexOutOfBoundsException if the index
483 * given is outside the bounds of the collection
484 * @return the value of the jalview.binding.Viewport at the
487 public jalview.binding.Viewport getViewport(
489 throws java.lang.IndexOutOfBoundsException {
490 // check bounds for index
491 if (index < 0 || index >= this._viewportList.size()) {
492 throw new IndexOutOfBoundsException("getViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
495 return (jalview.binding.Viewport) _viewportList.get(index);
499 * Method getViewport.Returns the contents of the collection in
500 * an Array. <p>Note: Just in case the collection contents
501 * are changing in another thread, we pass a 0-length Array of
502 * the correct type into the API call. This way we <i>know</i>
503 * that the Array returned is of exactly the correct length.
505 * @return this collection as an Array
507 public jalview.binding.Viewport[] getViewport(
509 jalview.binding.Viewport[] array = new jalview.binding.Viewport[0];
510 return (jalview.binding.Viewport[]) this._viewportList.toArray(array);
514 * Method getViewportCount.
516 * @return the size of this collection
518 public int getViewportCount(
520 return this._viewportList.size();
526 * @return true if this object is valid according to the schema
528 public boolean isValid(
532 } catch (org.exolab.castor.xml.ValidationException vex) {
542 * @throws org.exolab.castor.xml.MarshalException if object is
543 * null or if any SAXException is thrown during marshaling
544 * @throws org.exolab.castor.xml.ValidationException if this
545 * object is an invalid instance according to the schema
548 final java.io.Writer out)
549 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
550 Marshaller.marshal(this, out);
557 * @throws java.io.IOException if an IOException occurs during
559 * @throws org.exolab.castor.xml.ValidationException if this
560 * object is an invalid instance according to the schema
561 * @throws org.exolab.castor.xml.MarshalException if object is
562 * null or if any SAXException is thrown during marshaling
565 final org.xml.sax.ContentHandler handler)
566 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
567 Marshaller.marshal(this, handler);
572 public void removeAllJGroup(
574 this._JGroupList.clear();
579 public void removeAllJSeq(
581 this._JSeqList.clear();
586 public void removeAllTree(
588 this._treeList.clear();
593 public void removeAllUserColours(
595 this._userColoursList.clear();
600 public void removeAllViewport(
602 this._viewportList.clear();
606 * Method removeJGroup.
609 * @return true if the object was removed from the collection.
611 public boolean removeJGroup(
612 final jalview.binding.JGroup vJGroup) {
613 boolean removed = _JGroupList.remove(vJGroup);
618 * Method removeJGroupAt.
621 * @return the element removed from the collection
623 public jalview.binding.JGroup removeJGroupAt(
625 java.lang.Object obj = this._JGroupList.remove(index);
626 return (jalview.binding.JGroup) obj;
633 * @return true if the object was removed from the collection.
635 public boolean removeJSeq(
636 final jalview.binding.JSeq vJSeq) {
637 boolean removed = _JSeqList.remove(vJSeq);
642 * Method removeJSeqAt.
645 * @return the element removed from the collection
647 public jalview.binding.JSeq removeJSeqAt(
649 java.lang.Object obj = this._JSeqList.remove(index);
650 return (jalview.binding.JSeq) obj;
657 * @return true if the object was removed from the collection.
659 public boolean removeTree(
660 final jalview.binding.Tree vTree) {
661 boolean removed = _treeList.remove(vTree);
666 * Method removeTreeAt.
669 * @return the element removed from the collection
671 public jalview.binding.Tree removeTreeAt(
673 java.lang.Object obj = this._treeList.remove(index);
674 return (jalview.binding.Tree) obj;
678 * Method removeUserColours.
680 * @param vUserColours
681 * @return true if the object was removed from the collection.
683 public boolean removeUserColours(
684 final jalview.binding.UserColours vUserColours) {
685 boolean removed = _userColoursList.remove(vUserColours);
690 * Method removeUserColoursAt.
693 * @return the element removed from the collection
695 public jalview.binding.UserColours removeUserColoursAt(
697 java.lang.Object obj = this._userColoursList.remove(index);
698 return (jalview.binding.UserColours) obj;
702 * Method removeViewport.
705 * @return true if the object was removed from the collection.
707 public boolean removeViewport(
708 final jalview.binding.Viewport vViewport) {
709 boolean removed = _viewportList.remove(vViewport);
714 * Method removeViewportAt.
717 * @return the element removed from the collection
719 public jalview.binding.Viewport removeViewportAt(
721 java.lang.Object obj = this._viewportList.remove(index);
722 return (jalview.binding.Viewport) obj;
726 * Sets the value of field 'featureSettings'.
728 * @param featureSettings the value of field 'featureSettings'.
730 public void setFeatureSettings(
731 final jalview.binding.FeatureSettings featureSettings) {
732 this._featureSettings = featureSettings;
740 * @throws java.lang.IndexOutOfBoundsException if the index
741 * given is outside the bounds of the collection
743 public void setJGroup(
745 final jalview.binding.JGroup vJGroup)
746 throws java.lang.IndexOutOfBoundsException {
747 // check bounds for index
748 if (index < 0 || index >= this._JGroupList.size()) {
749 throw new IndexOutOfBoundsException("setJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
752 this._JGroupList.set(index, vJGroup);
758 * @param vJGroupArray
760 public void setJGroup(
761 final jalview.binding.JGroup[] vJGroupArray) {
765 for (int i = 0; i < vJGroupArray.length; i++) {
766 this._JGroupList.add(vJGroupArray[i]);
775 * @throws java.lang.IndexOutOfBoundsException if the index
776 * given is outside the bounds of the collection
780 final jalview.binding.JSeq vJSeq)
781 throws java.lang.IndexOutOfBoundsException {
782 // check bounds for index
783 if (index < 0 || index >= this._JSeqList.size()) {
784 throw new IndexOutOfBoundsException("setJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
787 this._JSeqList.set(index, vJSeq);
796 final jalview.binding.JSeq[] vJSeqArray) {
800 for (int i = 0; i < vJSeqArray.length; i++) {
801 this._JSeqList.add(vJSeqArray[i]);
810 * @throws java.lang.IndexOutOfBoundsException if the index
811 * given is outside the bounds of the collection
815 final jalview.binding.Tree vTree)
816 throws java.lang.IndexOutOfBoundsException {
817 // check bounds for index
818 if (index < 0 || index >= this._treeList.size()) {
819 throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
822 this._treeList.set(index, vTree);
831 final jalview.binding.Tree[] vTreeArray) {
835 for (int i = 0; i < vTreeArray.length; i++) {
836 this._treeList.add(vTreeArray[i]);
844 * @param vUserColours
845 * @throws java.lang.IndexOutOfBoundsException if the index
846 * given is outside the bounds of the collection
848 public void setUserColours(
850 final jalview.binding.UserColours vUserColours)
851 throws java.lang.IndexOutOfBoundsException {
852 // check bounds for index
853 if (index < 0 || index >= this._userColoursList.size()) {
854 throw new IndexOutOfBoundsException("setUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
857 this._userColoursList.set(index, vUserColours);
863 * @param vUserColoursArray
865 public void setUserColours(
866 final jalview.binding.UserColours[] vUserColoursArray) {
868 _userColoursList.clear();
870 for (int i = 0; i < vUserColoursArray.length; i++) {
871 this._userColoursList.add(vUserColoursArray[i]);
880 * @throws java.lang.IndexOutOfBoundsException if the index
881 * given is outside the bounds of the collection
883 public void setViewport(
885 final jalview.binding.Viewport vViewport)
886 throws java.lang.IndexOutOfBoundsException {
887 // check bounds for index
888 if (index < 0 || index >= this._viewportList.size()) {
889 throw new IndexOutOfBoundsException("setViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
892 this._viewportList.set(index, vViewport);
898 * @param vViewportArray
900 public void setViewport(
901 final jalview.binding.Viewport[] vViewportArray) {
903 _viewportList.clear();
905 for (int i = 0; i < vViewportArray.length; i++) {
906 this._viewportList.add(vViewportArray[i]);
914 * @throws org.exolab.castor.xml.MarshalException if object is
915 * null or if any SAXException is thrown during marshaling
916 * @throws org.exolab.castor.xml.ValidationException if this
917 * object is an invalid instance according to the schema
918 * @return the unmarshaled jalview.binding.JalviewModelSequence
920 public static jalview.binding.JalviewModelSequence unmarshal(
921 final java.io.Reader reader)
922 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
923 return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class, reader);
929 * @throws org.exolab.castor.xml.ValidationException if this
930 * object is an invalid instance according to the schema
932 public void validate(
934 throws org.exolab.castor.xml.ValidationException {
935 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
936 validator.validate(this);