1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.schemabinding.version2;
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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.Viewport vViewport)
231 throws java.lang.IndexOutOfBoundsException {
232 this._viewportList.add(index, vViewport);
236 * Method enumerateJGroup.
238 * @return an Enumeration over all
239 * jalview.schemabinding.version2.JGroup elements
241 public java.util.Enumeration enumerateJGroup(
243 return this._JGroupList.elements();
247 * Method enumerateJSeq.
249 * @return an Enumeration over all
250 * jalview.schemabinding.version2.JSeq elements
252 public java.util.Enumeration enumerateJSeq(
254 return this._JSeqList.elements();
258 * Method enumerateTree.
260 * @return an Enumeration over all
261 * jalview.schemabinding.version2.Tree elements
263 public java.util.Enumeration enumerateTree(
265 return this._treeList.elements();
269 * Method enumerateUserColours.
271 * @return an Enumeration over all
272 * jalview.schemabinding.version2.UserColours elements
274 public java.util.Enumeration enumerateUserColours(
276 return this._userColoursList.elements();
280 * Method enumerateViewport.
282 * @return an Enumeration over all
283 * jalview.schemabinding.version2.Viewport elements
285 public java.util.Enumeration enumerateViewport(
287 return this._viewportList.elements();
291 * Returns the value of field 'featureSettings'.
293 * @return the value of field 'FeatureSettings'.
295 public jalview.schemabinding.version2.FeatureSettings getFeatureSettings(
297 return this._featureSettings;
304 * @throws java.lang.IndexOutOfBoundsException if the index
305 * given is outside the bounds of the collection
306 * @return the value of the
307 * jalview.schemabinding.version2.JGroup at the given index
309 public jalview.schemabinding.version2.JGroup getJGroup(
311 throws java.lang.IndexOutOfBoundsException {
312 // check bounds for index
313 if (index < 0 || index >= this._JGroupList.size()) {
314 throw new IndexOutOfBoundsException("getJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
317 return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index);
321 * Method getJGroup.Returns the contents of the collection in
322 * an Array. <p>Note: Just in case the collection contents
323 * are changing in another thread, we pass a 0-length Array of
324 * the correct type into the API call. This way we <i>know</i>
325 * that the Array returned is of exactly the correct length.
327 * @return this collection as an Array
329 public jalview.schemabinding.version2.JGroup[] getJGroup(
331 jalview.schemabinding.version2.JGroup[] array = new jalview.schemabinding.version2.JGroup[0];
332 return (jalview.schemabinding.version2.JGroup[]) this._JGroupList.toArray(array);
336 * Method getJGroupCount.
338 * @return the size of this collection
340 public int getJGroupCount(
342 return this._JGroupList.size();
349 * @throws java.lang.IndexOutOfBoundsException if the index
350 * given is outside the bounds of the collection
351 * @return the value of the jalview.schemabinding.version2.JSeq
354 public jalview.schemabinding.version2.JSeq getJSeq(
356 throws java.lang.IndexOutOfBoundsException {
357 // check bounds for index
358 if (index < 0 || index >= this._JSeqList.size()) {
359 throw new IndexOutOfBoundsException("getJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
362 return (jalview.schemabinding.version2.JSeq) _JSeqList.get(index);
366 * Method getJSeq.Returns the contents of the collection in an
367 * Array. <p>Note: Just in case the collection contents are
368 * changing in another thread, we pass a 0-length Array of the
369 * correct type into the API call. This way we <i>know</i>
370 * that the Array returned is of exactly the correct length.
372 * @return this collection as an Array
374 public jalview.schemabinding.version2.JSeq[] getJSeq(
376 jalview.schemabinding.version2.JSeq[] array = new jalview.schemabinding.version2.JSeq[0];
377 return (jalview.schemabinding.version2.JSeq[]) this._JSeqList.toArray(array);
381 * Method getJSeqCount.
383 * @return the size of this collection
385 public int getJSeqCount(
387 return this._JSeqList.size();
394 * @throws java.lang.IndexOutOfBoundsException if the index
395 * given is outside the bounds of the collection
396 * @return the value of the jalview.schemabinding.version2.Tree
399 public jalview.schemabinding.version2.Tree getTree(
401 throws java.lang.IndexOutOfBoundsException {
402 // check bounds for index
403 if (index < 0 || index >= this._treeList.size()) {
404 throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
407 return (jalview.schemabinding.version2.Tree) _treeList.get(index);
411 * Method getTree.Returns the contents of the collection in an
412 * Array. <p>Note: Just in case the collection contents are
413 * changing in another thread, we pass a 0-length Array of the
414 * correct type into the API call. This way we <i>know</i>
415 * that the Array returned is of exactly the correct length.
417 * @return this collection as an Array
419 public jalview.schemabinding.version2.Tree[] getTree(
421 jalview.schemabinding.version2.Tree[] array = new jalview.schemabinding.version2.Tree[0];
422 return (jalview.schemabinding.version2.Tree[]) this._treeList.toArray(array);
426 * Method getTreeCount.
428 * @return the size of this collection
430 public int getTreeCount(
432 return this._treeList.size();
436 * Method getUserColours.
439 * @throws java.lang.IndexOutOfBoundsException if the index
440 * given is outside the bounds of the collection
441 * @return the value of the
442 * jalview.schemabinding.version2.UserColours at the given index
444 public jalview.schemabinding.version2.UserColours getUserColours(
446 throws java.lang.IndexOutOfBoundsException {
447 // check bounds for index
448 if (index < 0 || index >= this._userColoursList.size()) {
449 throw new IndexOutOfBoundsException("getUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
452 return (jalview.schemabinding.version2.UserColours) _userColoursList.get(index);
456 * Method getUserColours.Returns the contents of the collection
457 * in an Array. <p>Note: Just in case the collection contents
458 * are changing in another thread, we pass a 0-length Array of
459 * the correct type into the API call. This way we <i>know</i>
460 * that the Array returned is of exactly the correct length.
462 * @return this collection as an Array
464 public jalview.schemabinding.version2.UserColours[] getUserColours(
466 jalview.schemabinding.version2.UserColours[] array = new jalview.schemabinding.version2.UserColours[0];
467 return (jalview.schemabinding.version2.UserColours[]) this._userColoursList.toArray(array);
471 * Method getUserColoursCount.
473 * @return the size of this collection
475 public int getUserColoursCount(
477 return this._userColoursList.size();
481 * Method getViewport.
484 * @throws java.lang.IndexOutOfBoundsException if the index
485 * given is outside the bounds of the collection
486 * @return the value of the
487 * jalview.schemabinding.version2.Viewport at the given index
489 public jalview.schemabinding.version2.Viewport getViewport(
491 throws java.lang.IndexOutOfBoundsException {
492 // check bounds for index
493 if (index < 0 || index >= this._viewportList.size()) {
494 throw new IndexOutOfBoundsException("getViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
497 return (jalview.schemabinding.version2.Viewport) _viewportList.get(index);
501 * Method getViewport.Returns the contents of the collection in
502 * an Array. <p>Note: Just in case the collection contents
503 * are changing in another thread, we pass a 0-length Array of
504 * the correct type into the API call. This way we <i>know</i>
505 * that the Array returned is of exactly the correct length.
507 * @return this collection as an Array
509 public jalview.schemabinding.version2.Viewport[] getViewport(
511 jalview.schemabinding.version2.Viewport[] array = new jalview.schemabinding.version2.Viewport[0];
512 return (jalview.schemabinding.version2.Viewport[]) this._viewportList.toArray(array);
516 * Method getViewportCount.
518 * @return the size of this collection
520 public int getViewportCount(
522 return this._viewportList.size();
528 * @return true if this object is valid according to the schema
530 public boolean isValid(
534 } catch (org.exolab.castor.xml.ValidationException vex) {
544 * @throws org.exolab.castor.xml.MarshalException if object is
545 * null or if any SAXException is thrown during marshaling
546 * @throws org.exolab.castor.xml.ValidationException if this
547 * object is an invalid instance according to the schema
550 final java.io.Writer out)
551 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
552 Marshaller.marshal(this, out);
559 * @throws java.io.IOException if an IOException occurs during
561 * @throws org.exolab.castor.xml.ValidationException if this
562 * object is an invalid instance according to the schema
563 * @throws org.exolab.castor.xml.MarshalException if object is
564 * null or if any SAXException is thrown during marshaling
567 final org.xml.sax.ContentHandler handler)
568 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
569 Marshaller.marshal(this, handler);
574 public void removeAllJGroup(
576 this._JGroupList.clear();
581 public void removeAllJSeq(
583 this._JSeqList.clear();
588 public void removeAllTree(
590 this._treeList.clear();
595 public void removeAllUserColours(
597 this._userColoursList.clear();
602 public void removeAllViewport(
604 this._viewportList.clear();
608 * Method removeJGroup.
611 * @return true if the object was removed from the collection.
613 public boolean removeJGroup(
614 final jalview.schemabinding.version2.JGroup vJGroup) {
615 boolean removed = _JGroupList.remove(vJGroup);
620 * Method removeJGroupAt.
623 * @return the element removed from the collection
625 public jalview.schemabinding.version2.JGroup removeJGroupAt(
627 java.lang.Object obj = this._JGroupList.remove(index);
628 return (jalview.schemabinding.version2.JGroup) obj;
635 * @return true if the object was removed from the collection.
637 public boolean removeJSeq(
638 final jalview.schemabinding.version2.JSeq vJSeq) {
639 boolean removed = _JSeqList.remove(vJSeq);
644 * Method removeJSeqAt.
647 * @return the element removed from the collection
649 public jalview.schemabinding.version2.JSeq removeJSeqAt(
651 java.lang.Object obj = this._JSeqList.remove(index);
652 return (jalview.schemabinding.version2.JSeq) obj;
659 * @return true if the object was removed from the collection.
661 public boolean removeTree(
662 final jalview.schemabinding.version2.Tree vTree) {
663 boolean removed = _treeList.remove(vTree);
668 * Method removeTreeAt.
671 * @return the element removed from the collection
673 public jalview.schemabinding.version2.Tree removeTreeAt(
675 java.lang.Object obj = this._treeList.remove(index);
676 return (jalview.schemabinding.version2.Tree) obj;
680 * Method removeUserColours.
682 * @param vUserColours
683 * @return true if the object was removed from the collection.
685 public boolean removeUserColours(
686 final jalview.schemabinding.version2.UserColours vUserColours) {
687 boolean removed = _userColoursList.remove(vUserColours);
692 * Method removeUserColoursAt.
695 * @return the element removed from the collection
697 public jalview.schemabinding.version2.UserColours removeUserColoursAt(
699 java.lang.Object obj = this._userColoursList.remove(index);
700 return (jalview.schemabinding.version2.UserColours) obj;
704 * Method removeViewport.
707 * @return true if the object was removed from the collection.
709 public boolean removeViewport(
710 final jalview.schemabinding.version2.Viewport vViewport) {
711 boolean removed = _viewportList.remove(vViewport);
716 * Method removeViewportAt.
719 * @return the element removed from the collection
721 public jalview.schemabinding.version2.Viewport removeViewportAt(
723 java.lang.Object obj = this._viewportList.remove(index);
724 return (jalview.schemabinding.version2.Viewport) obj;
728 * Sets the value of field 'featureSettings'.
730 * @param featureSettings the value of field 'featureSettings'.
732 public void setFeatureSettings(
733 final jalview.schemabinding.version2.FeatureSettings featureSettings) {
734 this._featureSettings = featureSettings;
742 * @throws java.lang.IndexOutOfBoundsException if the index
743 * given is outside the bounds of the collection
745 public void setJGroup(
747 final jalview.schemabinding.version2.JGroup vJGroup)
748 throws java.lang.IndexOutOfBoundsException {
749 // check bounds for index
750 if (index < 0 || index >= this._JGroupList.size()) {
751 throw new IndexOutOfBoundsException("setJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
754 this._JGroupList.set(index, vJGroup);
760 * @param vJGroupArray
762 public void setJGroup(
763 final jalview.schemabinding.version2.JGroup[] vJGroupArray) {
767 for (int i = 0; i < vJGroupArray.length; i++) {
768 this._JGroupList.add(vJGroupArray[i]);
777 * @throws java.lang.IndexOutOfBoundsException if the index
778 * given is outside the bounds of the collection
782 final jalview.schemabinding.version2.JSeq vJSeq)
783 throws java.lang.IndexOutOfBoundsException {
784 // check bounds for index
785 if (index < 0 || index >= this._JSeqList.size()) {
786 throw new IndexOutOfBoundsException("setJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
789 this._JSeqList.set(index, vJSeq);
798 final jalview.schemabinding.version2.JSeq[] vJSeqArray) {
802 for (int i = 0; i < vJSeqArray.length; i++) {
803 this._JSeqList.add(vJSeqArray[i]);
812 * @throws java.lang.IndexOutOfBoundsException if the index
813 * given is outside the bounds of the collection
817 final jalview.schemabinding.version2.Tree vTree)
818 throws java.lang.IndexOutOfBoundsException {
819 // check bounds for index
820 if (index < 0 || index >= this._treeList.size()) {
821 throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
824 this._treeList.set(index, vTree);
833 final jalview.schemabinding.version2.Tree[] vTreeArray) {
837 for (int i = 0; i < vTreeArray.length; i++) {
838 this._treeList.add(vTreeArray[i]);
846 * @param vUserColours
847 * @throws java.lang.IndexOutOfBoundsException if the index
848 * given is outside the bounds of the collection
850 public void setUserColours(
852 final jalview.schemabinding.version2.UserColours vUserColours)
853 throws java.lang.IndexOutOfBoundsException {
854 // check bounds for index
855 if (index < 0 || index >= this._userColoursList.size()) {
856 throw new IndexOutOfBoundsException("setUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
859 this._userColoursList.set(index, vUserColours);
865 * @param vUserColoursArray
867 public void setUserColours(
868 final jalview.schemabinding.version2.UserColours[] vUserColoursArray) {
870 _userColoursList.clear();
872 for (int i = 0; i < vUserColoursArray.length; i++) {
873 this._userColoursList.add(vUserColoursArray[i]);
882 * @throws java.lang.IndexOutOfBoundsException if the index
883 * given is outside the bounds of the collection
885 public void setViewport(
887 final jalview.schemabinding.version2.Viewport vViewport)
888 throws java.lang.IndexOutOfBoundsException {
889 // check bounds for index
890 if (index < 0 || index >= this._viewportList.size()) {
891 throw new IndexOutOfBoundsException("setViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
894 this._viewportList.set(index, vViewport);
900 * @param vViewportArray
902 public void setViewport(
903 final jalview.schemabinding.version2.Viewport[] vViewportArray) {
905 _viewportList.clear();
907 for (int i = 0; i < vViewportArray.length; i++) {
908 this._viewportList.add(vViewportArray[i]);
916 * @throws org.exolab.castor.xml.MarshalException if object is
917 * null or if any SAXException is thrown during marshaling
918 * @throws org.exolab.castor.xml.ValidationException if this
919 * object is an invalid instance according to the schema
920 * @return the unmarshaled
921 * jalview.schemabinding.version2.JalviewModelSequence
923 public static jalview.schemabinding.version2.JalviewModelSequence unmarshal(
924 final java.io.Reader reader)
925 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
926 return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewModelSequence.class, reader);
932 * @throws org.exolab.castor.xml.ValidationException if this
933 * object is an invalid instance according to the schema
935 public void validate(
937 throws org.exolab.castor.xml.ValidationException {
938 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
939 validator.validate(this);