2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
\r
8 * Jalview - A Sequence Alignment Editor and Viewer
\r
9 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
11 * This program is free software; you can redistribute it and/or
\r
12 * modify it under the terms of the GNU General Public License
\r
13 * as published by the Free Software Foundation; either version 2
\r
14 * of the License, or (at your option) any later version.
\r
16 * This program is distributed in the hope that it will be useful,
\r
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
19 * GNU General Public License for more details.
\r
21 * You should have received a copy of the GNU General Public License
\r
22 * along with this program; if not, write to the Free Software
\r
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
25 package jalview.binding;
\r
27 import org.exolab.castor.xml.MarshalException;
\r
28 import org.exolab.castor.xml.Marshaller;
\r
29 import org.exolab.castor.xml.Unmarshaller;
\r
30 import org.exolab.castor.xml.ValidationException;
\r
32 import org.xml.sax.ContentHandler;
\r
34 //---------------------------------/
\r
35 //- Imported classes and packages -/
\r
36 //---------------------------------/
\r
37 import java.io.IOException;
\r
38 import java.io.Reader;
\r
39 import java.io.Serializable;
\r
40 import java.io.Writer;
\r
42 import java.util.Enumeration;
\r
43 import java.util.Vector;
\r
47 * Class JalviewModelSequence.
\r
49 * @version $Revision$ $Date$
\r
51 public class JalviewModelSequence implements java.io.Serializable {
\r
52 //--------------------------/
\r
53 //- Class/Member Variables -/
\r
54 //--------------------------/
\r
59 private java.util.Vector _JSeqList;
\r
64 private java.util.Vector _JGroupList;
\r
67 * Field _viewportList
\r
69 private java.util.Vector _viewportList;
\r
72 * Field _userColoursList
\r
74 private java.util.Vector _userColoursList;
\r
79 public JalviewModelSequence() {
\r
81 _JSeqList = new Vector();
\r
82 _JGroupList = new Vector();
\r
83 _viewportList = new Vector();
\r
84 _userColoursList = new Vector();
\r
86 //-- jalview.binding.JalviewModelSequence()
\r
89 public void addJGroup(jalview.binding.JGroup vJGroup)
\r
90 throws java.lang.IndexOutOfBoundsException {
\r
91 _JGroupList.addElement(vJGroup);
\r
93 //-- void addJGroup(jalview.binding.JGroup)
\r
103 public void addJGroup(int index, jalview.binding.JGroup vJGroup)
\r
104 throws java.lang.IndexOutOfBoundsException {
\r
105 _JGroupList.insertElementAt(vJGroup, index);
\r
107 //-- void addJGroup(int, jalview.binding.JGroup)
\r
116 public void addJSeq(jalview.binding.JSeq vJSeq)
\r
117 throws java.lang.IndexOutOfBoundsException {
\r
118 _JSeqList.addElement(vJSeq);
\r
120 //-- void addJSeq(jalview.binding.JSeq)
\r
130 public void addJSeq(int index, jalview.binding.JSeq vJSeq)
\r
131 throws java.lang.IndexOutOfBoundsException {
\r
132 _JSeqList.insertElementAt(vJSeq, index);
\r
134 //-- void addJSeq(int, jalview.binding.JSeq)
\r
137 * Method addUserColours
\r
141 * @param vUserColours
\r
143 public void addUserColours(jalview.binding.UserColours vUserColours)
\r
144 throws java.lang.IndexOutOfBoundsException {
\r
145 _userColoursList.addElement(vUserColours);
\r
147 //-- void addUserColours(jalview.binding.UserColours)
\r
150 * Method addUserColours
\r
155 * @param vUserColours
\r
157 public void addUserColours(int index,
\r
158 jalview.binding.UserColours vUserColours)
\r
159 throws java.lang.IndexOutOfBoundsException {
\r
160 _userColoursList.insertElementAt(vUserColours, index);
\r
162 //-- void addUserColours(int, jalview.binding.UserColours)
\r
165 * Method addViewport
\r
171 public void addViewport(jalview.binding.Viewport vViewport)
\r
172 throws java.lang.IndexOutOfBoundsException {
\r
173 _viewportList.addElement(vViewport);
\r
175 //-- void addViewport(jalview.binding.Viewport)
\r
178 * Method addViewport
\r
185 public void addViewport(int index, jalview.binding.Viewport vViewport)
\r
186 throws java.lang.IndexOutOfBoundsException {
\r
187 _viewportList.insertElementAt(vViewport, index);
\r
189 //-- void addViewport(int, jalview.binding.Viewport)
\r
192 * Method enumerateJGroup
\r
196 * @return Enumeration
\r
198 public java.util.Enumeration enumerateJGroup() {
\r
199 return _JGroupList.elements();
\r
201 //-- java.util.Enumeration enumerateJGroup()
\r
204 * Method enumerateJSeq
\r
208 * @return Enumeration
\r
210 public java.util.Enumeration enumerateJSeq() {
\r
211 return _JSeqList.elements();
\r
213 //-- java.util.Enumeration enumerateJSeq()
\r
216 * Method enumerateUserColours
\r
220 * @return Enumeration
\r
222 public java.util.Enumeration enumerateUserColours() {
\r
223 return _userColoursList.elements();
\r
225 //-- java.util.Enumeration enumerateUserColours()
\r
228 * Method enumerateViewport
\r
232 * @return Enumeration
\r
234 public java.util.Enumeration enumerateViewport() {
\r
235 return _viewportList.elements();
\r
237 //-- java.util.Enumeration enumerateViewport()
\r
247 public jalview.binding.JGroup getJGroup(int index)
\r
248 throws java.lang.IndexOutOfBoundsException {
\r
249 //-- check bounds for index
\r
250 if ((index < 0) || (index > _JGroupList.size())) {
\r
251 throw new IndexOutOfBoundsException();
\r
254 return (jalview.binding.JGroup) _JGroupList.elementAt(index);
\r
256 //-- jalview.binding.JGroup getJGroup(int)
\r
265 public jalview.binding.JGroup[] getJGroup() {
\r
266 int size = _JGroupList.size();
\r
267 jalview.binding.JGroup[] mArray = new jalview.binding.JGroup[size];
\r
269 for (int index = 0; index < size; index++) {
\r
270 mArray[index] = (jalview.binding.JGroup) _JGroupList.elementAt(index);
\r
275 //-- jalview.binding.JGroup[] getJGroup()
\r
278 * Method getJGroupCount
\r
284 public int getJGroupCount() {
\r
285 return _JGroupList.size();
\r
287 //-- int getJGroupCount()
\r
297 public jalview.binding.JSeq getJSeq(int index)
\r
298 throws java.lang.IndexOutOfBoundsException {
\r
299 //-- check bounds for index
\r
300 if ((index < 0) || (index > _JSeqList.size())) {
\r
301 throw new IndexOutOfBoundsException();
\r
304 return (jalview.binding.JSeq) _JSeqList.elementAt(index);
\r
306 //-- jalview.binding.JSeq getJSeq(int)
\r
315 public jalview.binding.JSeq[] getJSeq() {
\r
316 int size = _JSeqList.size();
\r
317 jalview.binding.JSeq[] mArray = new jalview.binding.JSeq[size];
\r
319 for (int index = 0; index < size; index++) {
\r
320 mArray[index] = (jalview.binding.JSeq) _JSeqList.elementAt(index);
\r
325 //-- jalview.binding.JSeq[] getJSeq()
\r
328 * Method getJSeqCount
\r
334 public int getJSeqCount() {
\r
335 return _JSeqList.size();
\r
337 //-- int getJSeqCount()
\r
340 * Method getUserColours
\r
345 * @return UserColours
\r
347 public jalview.binding.UserColours getUserColours(int index)
\r
348 throws java.lang.IndexOutOfBoundsException {
\r
349 //-- check bounds for index
\r
350 if ((index < 0) || (index > _userColoursList.size())) {
\r
351 throw new IndexOutOfBoundsException();
\r
354 return (jalview.binding.UserColours) _userColoursList.elementAt(index);
\r
356 //-- jalview.binding.UserColours getUserColours(int)
\r
359 * Method getUserColours
\r
363 * @return UserColours
\r
365 public jalview.binding.UserColours[] getUserColours() {
\r
366 int size = _userColoursList.size();
\r
367 jalview.binding.UserColours[] mArray = new jalview.binding.UserColours[size];
\r
369 for (int index = 0; index < size; index++) {
\r
370 mArray[index] = (jalview.binding.UserColours) _userColoursList.elementAt(index);
\r
375 //-- jalview.binding.UserColours[] getUserColours()
\r
378 * Method getUserColoursCount
\r
384 public int getUserColoursCount() {
\r
385 return _userColoursList.size();
\r
387 //-- int getUserColoursCount()
\r
390 * Method getViewport
\r
397 public jalview.binding.Viewport getViewport(int index)
\r
398 throws java.lang.IndexOutOfBoundsException {
\r
399 //-- check bounds for index
\r
400 if ((index < 0) || (index > _viewportList.size())) {
\r
401 throw new IndexOutOfBoundsException();
\r
404 return (jalview.binding.Viewport) _viewportList.elementAt(index);
\r
406 //-- jalview.binding.Viewport getViewport(int)
\r
409 * Method getViewport
\r
415 public jalview.binding.Viewport[] getViewport() {
\r
416 int size = _viewportList.size();
\r
417 jalview.binding.Viewport[] mArray = new jalview.binding.Viewport[size];
\r
419 for (int index = 0; index < size; index++) {
\r
420 mArray[index] = (jalview.binding.Viewport) _viewportList.elementAt(index);
\r
425 //-- jalview.binding.Viewport[] getViewport()
\r
428 * Method getViewportCount
\r
434 public int getViewportCount() {
\r
435 return _viewportList.size();
\r
437 //-- int getViewportCount()
\r
446 public boolean isValid() {
\r
449 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
455 //-- boolean isValid()
\r
464 public void marshal(java.io.Writer out)
\r
465 throws org.exolab.castor.xml.MarshalException,
\r
466 org.exolab.castor.xml.ValidationException {
\r
467 Marshaller.marshal(this, out);
\r
469 //-- void marshal(java.io.Writer)
\r
478 public void marshal(org.xml.sax.ContentHandler handler)
\r
479 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
480 org.exolab.castor.xml.ValidationException {
\r
481 Marshaller.marshal(this, handler);
\r
483 //-- void marshal(org.xml.sax.ContentHandler)
\r
486 * Method removeAllJGroup
\r
489 public void removeAllJGroup() {
\r
490 _JGroupList.removeAllElements();
\r
492 //-- void removeAllJGroup()
\r
495 * Method removeAllJSeq
\r
498 public void removeAllJSeq() {
\r
499 _JSeqList.removeAllElements();
\r
501 //-- void removeAllJSeq()
\r
504 * Method removeAllUserColours
\r
507 public void removeAllUserColours() {
\r
508 _userColoursList.removeAllElements();
\r
510 //-- void removeAllUserColours()
\r
513 * Method removeAllViewport
\r
516 public void removeAllViewport() {
\r
517 _viewportList.removeAllElements();
\r
519 //-- void removeAllViewport()
\r
522 * Method removeJGroup
\r
529 public jalview.binding.JGroup removeJGroup(int index) {
\r
530 java.lang.Object obj = _JGroupList.elementAt(index);
\r
531 _JGroupList.removeElementAt(index);
\r
533 return (jalview.binding.JGroup) obj;
\r
535 //-- jalview.binding.JGroup removeJGroup(int)
\r
538 * Method removeJSeq
\r
545 public jalview.binding.JSeq removeJSeq(int index) {
\r
546 java.lang.Object obj = _JSeqList.elementAt(index);
\r
547 _JSeqList.removeElementAt(index);
\r
549 return (jalview.binding.JSeq) obj;
\r
551 //-- jalview.binding.JSeq removeJSeq(int)
\r
554 * Method removeUserColours
\r
559 * @return UserColours
\r
561 public jalview.binding.UserColours removeUserColours(int index) {
\r
562 java.lang.Object obj = _userColoursList.elementAt(index);
\r
563 _userColoursList.removeElementAt(index);
\r
565 return (jalview.binding.UserColours) obj;
\r
567 //-- jalview.binding.UserColours removeUserColours(int)
\r
570 * Method removeViewport
\r
577 public jalview.binding.Viewport removeViewport(int index) {
\r
578 java.lang.Object obj = _viewportList.elementAt(index);
\r
579 _viewportList.removeElementAt(index);
\r
581 return (jalview.binding.Viewport) obj;
\r
583 //-- jalview.binding.Viewport removeViewport(int)
\r
593 public void setJGroup(int index, jalview.binding.JGroup vJGroup)
\r
594 throws java.lang.IndexOutOfBoundsException {
\r
595 //-- check bounds for index
\r
596 if ((index < 0) || (index > _JGroupList.size())) {
\r
597 throw new IndexOutOfBoundsException();
\r
600 _JGroupList.setElementAt(vJGroup, index);
\r
602 //-- void setJGroup(int, jalview.binding.JGroup)
\r
609 * @param JGroupArray
\r
611 public void setJGroup(jalview.binding.JGroup[] JGroupArray) {
\r
613 _JGroupList.removeAllElements();
\r
615 for (int i = 0; i < JGroupArray.length; i++) {
\r
616 _JGroupList.addElement(JGroupArray[i]);
\r
619 //-- void setJGroup(jalview.binding.JGroup)
\r
629 public void setJSeq(int index, jalview.binding.JSeq vJSeq)
\r
630 throws java.lang.IndexOutOfBoundsException {
\r
631 //-- check bounds for index
\r
632 if ((index < 0) || (index > _JSeqList.size())) {
\r
633 throw new IndexOutOfBoundsException();
\r
636 _JSeqList.setElementAt(vJSeq, index);
\r
638 //-- void setJSeq(int, jalview.binding.JSeq)
\r
647 public void setJSeq(jalview.binding.JSeq[] JSeqArray) {
\r
649 _JSeqList.removeAllElements();
\r
651 for (int i = 0; i < JSeqArray.length; i++) {
\r
652 _JSeqList.addElement(JSeqArray[i]);
\r
655 //-- void setJSeq(jalview.binding.JSeq)
\r
658 * Method setUserColours
\r
663 * @param vUserColours
\r
665 public void setUserColours(int index,
\r
666 jalview.binding.UserColours vUserColours)
\r
667 throws java.lang.IndexOutOfBoundsException {
\r
668 //-- check bounds for index
\r
669 if ((index < 0) || (index > _userColoursList.size())) {
\r
670 throw new IndexOutOfBoundsException();
\r
673 _userColoursList.setElementAt(vUserColours, index);
\r
675 //-- void setUserColours(int, jalview.binding.UserColours)
\r
678 * Method setUserColours
\r
682 * @param userColoursArray
\r
684 public void setUserColours(jalview.binding.UserColours[] userColoursArray) {
\r
686 _userColoursList.removeAllElements();
\r
688 for (int i = 0; i < userColoursArray.length; i++) {
\r
689 _userColoursList.addElement(userColoursArray[i]);
\r
692 //-- void setUserColours(jalview.binding.UserColours)
\r
695 * Method setViewport
\r
702 public void setViewport(int index, jalview.binding.Viewport vViewport)
\r
703 throws java.lang.IndexOutOfBoundsException {
\r
704 //-- check bounds for index
\r
705 if ((index < 0) || (index > _viewportList.size())) {
\r
706 throw new IndexOutOfBoundsException();
\r
709 _viewportList.setElementAt(vViewport, index);
\r
711 //-- void setViewport(int, jalview.binding.Viewport)
\r
714 * Method setViewport
\r
718 * @param viewportArray
\r
720 public void setViewport(jalview.binding.Viewport[] viewportArray) {
\r
722 _viewportList.removeAllElements();
\r
724 for (int i = 0; i < viewportArray.length; i++) {
\r
725 _viewportList.addElement(viewportArray[i]);
\r
728 //-- void setViewport(jalview.binding.Viewport)
\r
738 public static java.lang.Object unmarshal(java.io.Reader reader)
\r
739 throws org.exolab.castor.xml.MarshalException,
\r
740 org.exolab.castor.xml.ValidationException {
\r
741 return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class,
\r
744 //-- java.lang.Object unmarshal(java.io.Reader)
\r
750 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
751 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
752 validator.validate(this);
\r
754 //-- void validate()
\r