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 SequenceSet.
\r
49 * @version $Revision$ $Date$
\r
51 public class SequenceSet implements java.io.Serializable {
\r
52 //--------------------------/
\r
53 //- Class/Member Variables -/
\r
54 //--------------------------/
\r
59 private java.lang.String _gapChar;
\r
64 private boolean _aligned;
\r
67 * keeps track of state for field: _aligned
\r
69 private boolean _has_aligned;
\r
72 * Field _sequenceList
\r
74 private java.util.Vector _sequenceList;
\r
77 * Field _annotationList
\r
79 private java.util.Vector _annotationList;
\r
84 public SequenceSet() {
\r
86 _sequenceList = new Vector();
\r
87 _annotationList = new Vector();
\r
89 //-- jalview.binding.SequenceSet()
\r
92 public void addAnnotation(jalview.binding.Annotation vAnnotation)
\r
93 throws java.lang.IndexOutOfBoundsException {
\r
94 _annotationList.addElement(vAnnotation);
\r
96 //-- void addAnnotation(jalview.binding.Annotation)
\r
99 * Method addAnnotation
\r
104 * @param vAnnotation
\r
106 public void addAnnotation(int index, jalview.binding.Annotation vAnnotation)
\r
107 throws java.lang.IndexOutOfBoundsException {
\r
108 _annotationList.insertElementAt(vAnnotation, index);
\r
110 //-- void addAnnotation(int, jalview.binding.Annotation)
\r
113 * Method addSequence
\r
119 public void addSequence(jalview.binding.Sequence vSequence)
\r
120 throws java.lang.IndexOutOfBoundsException {
\r
121 _sequenceList.addElement(vSequence);
\r
123 //-- void addSequence(jalview.binding.Sequence)
\r
126 * Method addSequence
\r
133 public void addSequence(int index, jalview.binding.Sequence vSequence)
\r
134 throws java.lang.IndexOutOfBoundsException {
\r
135 _sequenceList.insertElementAt(vSequence, index);
\r
137 //-- void addSequence(int, jalview.binding.Sequence)
\r
140 * Method deleteAligned
\r
143 public void deleteAligned() {
\r
144 this._has_aligned = false;
\r
146 //-- void deleteAligned()
\r
149 * Method enumerateAnnotation
\r
153 * @return Enumeration
\r
155 public java.util.Enumeration enumerateAnnotation() {
\r
156 return _annotationList.elements();
\r
158 //-- java.util.Enumeration enumerateAnnotation()
\r
161 * Method enumerateSequence
\r
165 * @return Enumeration
\r
167 public java.util.Enumeration enumerateSequence() {
\r
168 return _sequenceList.elements();
\r
170 //-- java.util.Enumeration enumerateSequence()
\r
173 * Returns the value of field 'aligned'.
\r
176 * @return the value of field 'aligned'.
\r
178 public boolean getAligned() {
\r
179 return this._aligned;
\r
181 //-- boolean getAligned()
\r
184 * Method getAnnotation
\r
189 * @return Annotation
\r
191 public jalview.binding.Annotation getAnnotation(int index)
\r
192 throws java.lang.IndexOutOfBoundsException {
\r
193 //-- check bounds for index
\r
194 if ((index < 0) || (index > _annotationList.size())) {
\r
195 throw new IndexOutOfBoundsException();
\r
198 return (jalview.binding.Annotation) _annotationList.elementAt(index);
\r
200 //-- jalview.binding.Annotation getAnnotation(int)
\r
203 * Method getAnnotation
\r
207 * @return Annotation
\r
209 public jalview.binding.Annotation[] getAnnotation() {
\r
210 int size = _annotationList.size();
\r
211 jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size];
\r
213 for (int index = 0; index < size; index++) {
\r
214 mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index);
\r
219 //-- jalview.binding.Annotation[] getAnnotation()
\r
222 * Method getAnnotationCount
\r
228 public int getAnnotationCount() {
\r
229 return _annotationList.size();
\r
231 //-- int getAnnotationCount()
\r
234 * Returns the value of field 'gapChar'.
\r
237 * @return the value of field 'gapChar'.
\r
239 public java.lang.String getGapChar() {
\r
240 return this._gapChar;
\r
242 //-- java.lang.String getGapChar()
\r
245 * Method getSequence
\r
252 public jalview.binding.Sequence getSequence(int index)
\r
253 throws java.lang.IndexOutOfBoundsException {
\r
254 //-- check bounds for index
\r
255 if ((index < 0) || (index > _sequenceList.size())) {
\r
256 throw new IndexOutOfBoundsException();
\r
259 return (jalview.binding.Sequence) _sequenceList.elementAt(index);
\r
261 //-- jalview.binding.Sequence getSequence(int)
\r
264 * Method getSequence
\r
270 public jalview.binding.Sequence[] getSequence() {
\r
271 int size = _sequenceList.size();
\r
272 jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size];
\r
274 for (int index = 0; index < size; index++) {
\r
275 mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index);
\r
280 //-- jalview.binding.Sequence[] getSequence()
\r
283 * Method getSequenceCount
\r
289 public int getSequenceCount() {
\r
290 return _sequenceList.size();
\r
292 //-- int getSequenceCount()
\r
295 * Method hasAligned
\r
301 public boolean hasAligned() {
\r
302 return this._has_aligned;
\r
304 //-- boolean hasAligned()
\r
313 public boolean isValid() {
\r
316 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
322 //-- boolean isValid()
\r
331 public void marshal(java.io.Writer out)
\r
332 throws org.exolab.castor.xml.MarshalException,
\r
333 org.exolab.castor.xml.ValidationException {
\r
334 Marshaller.marshal(this, out);
\r
336 //-- void marshal(java.io.Writer)
\r
345 public void marshal(org.xml.sax.ContentHandler handler)
\r
346 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
347 org.exolab.castor.xml.ValidationException {
\r
348 Marshaller.marshal(this, handler);
\r
350 //-- void marshal(org.xml.sax.ContentHandler)
\r
353 * Method removeAllAnnotation
\r
356 public void removeAllAnnotation() {
\r
357 _annotationList.removeAllElements();
\r
359 //-- void removeAllAnnotation()
\r
362 * Method removeAllSequence
\r
365 public void removeAllSequence() {
\r
366 _sequenceList.removeAllElements();
\r
368 //-- void removeAllSequence()
\r
371 * Method removeAnnotation
\r
376 * @return Annotation
\r
378 public jalview.binding.Annotation removeAnnotation(int index) {
\r
379 java.lang.Object obj = _annotationList.elementAt(index);
\r
380 _annotationList.removeElementAt(index);
\r
382 return (jalview.binding.Annotation) obj;
\r
384 //-- jalview.binding.Annotation removeAnnotation(int)
\r
387 * Method removeSequence
\r
394 public jalview.binding.Sequence removeSequence(int index) {
\r
395 java.lang.Object obj = _sequenceList.elementAt(index);
\r
396 _sequenceList.removeElementAt(index);
\r
398 return (jalview.binding.Sequence) obj;
\r
400 //-- jalview.binding.Sequence removeSequence(int)
\r
403 * Sets the value of field 'aligned'.
\r
405 * @param aligned the value of field 'aligned'.
\r
407 public void setAligned(boolean aligned) {
\r
408 this._aligned = aligned;
\r
409 this._has_aligned = true;
\r
411 //-- void setAligned(boolean)
\r
414 * Method setAnnotation
\r
419 * @param vAnnotation
\r
421 public void setAnnotation(int index, jalview.binding.Annotation vAnnotation)
\r
422 throws java.lang.IndexOutOfBoundsException {
\r
423 //-- check bounds for index
\r
424 if ((index < 0) || (index > _annotationList.size())) {
\r
425 throw new IndexOutOfBoundsException();
\r
428 _annotationList.setElementAt(vAnnotation, index);
\r
430 //-- void setAnnotation(int, jalview.binding.Annotation)
\r
433 * Method setAnnotation
\r
437 * @param annotationArray
\r
439 public void setAnnotation(jalview.binding.Annotation[] annotationArray) {
\r
441 _annotationList.removeAllElements();
\r
443 for (int i = 0; i < annotationArray.length; i++) {
\r
444 _annotationList.addElement(annotationArray[i]);
\r
447 //-- void setAnnotation(jalview.binding.Annotation)
\r
450 * Sets the value of field 'gapChar'.
\r
452 * @param gapChar the value of field 'gapChar'.
\r
454 public void setGapChar(java.lang.String gapChar) {
\r
455 this._gapChar = gapChar;
\r
457 //-- void setGapChar(java.lang.String)
\r
460 * Method setSequence
\r
467 public void setSequence(int index, jalview.binding.Sequence vSequence)
\r
468 throws java.lang.IndexOutOfBoundsException {
\r
469 //-- check bounds for index
\r
470 if ((index < 0) || (index > _sequenceList.size())) {
\r
471 throw new IndexOutOfBoundsException();
\r
474 _sequenceList.setElementAt(vSequence, index);
\r
476 //-- void setSequence(int, jalview.binding.Sequence)
\r
479 * Method setSequence
\r
483 * @param sequenceArray
\r
485 public void setSequence(jalview.binding.Sequence[] sequenceArray) {
\r
487 _sequenceList.removeAllElements();
\r
489 for (int i = 0; i < sequenceArray.length; i++) {
\r
490 _sequenceList.addElement(sequenceArray[i]);
\r
493 //-- void setSequence(jalview.binding.Sequence)
\r
503 public static java.lang.Object unmarshal(java.io.Reader reader)
\r
504 throws org.exolab.castor.xml.MarshalException,
\r
505 org.exolab.castor.xml.ValidationException {
\r
506 return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class,
\r
509 //-- java.lang.Object unmarshal(java.io.Reader)
\r
515 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
516 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
517 validator.validate(this);
\r
519 //-- void validate()
\r