2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
\r
9 * Jalview - A Sequence Alignment Editor and Viewer
\r
10 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
12 * This program is free software; you can redistribute it and/or
\r
13 * modify it under the terms of the GNU General Public License
\r
14 * as published by the Free Software Foundation; either version 2
\r
15 * of the License, or (at your option) any later version.
\r
17 * This program is distributed in the hope that it will be useful,
\r
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
20 * GNU General Public License for more details.
\r
22 * You should have received a copy of the GNU General Public License
\r
23 * along with this program; if not, write to the Free Software
\r
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
27 package jalview.binding;
\r
29 //---------------------------------/
\r
30 //- Imported classes and packages -/
\r
31 //---------------------------------/
\r
33 import java.io.IOException;
\r
34 import java.io.Reader;
\r
35 import java.io.Serializable;
\r
36 import java.io.Writer;
\r
37 import java.util.Enumeration;
\r
38 import java.util.Vector;
\r
39 import org.exolab.castor.xml.MarshalException;
\r
40 import org.exolab.castor.xml.Marshaller;
\r
41 import org.exolab.castor.xml.Unmarshaller;
\r
42 import org.exolab.castor.xml.ValidationException;
\r
43 import org.xml.sax.ContentHandler;
\r
46 * Class SequenceSet.
\r
48 * @version $Revision$ $Date$
\r
50 public class SequenceSet implements java.io.Serializable {
\r
53 //--------------------------/
\r
54 //- Class/Member Variables -/
\r
55 //--------------------------/
\r
60 private java.lang.String _gapChar;
\r
65 private boolean _aligned;
\r
68 * keeps track of state for field: _aligned
\r
70 private boolean _has_aligned;
\r
73 * Field _sequenceList
\r
75 private java.util.Vector _sequenceList;
\r
78 * Field _annotationList
\r
80 private java.util.Vector _annotationList;
\r
87 public SequenceSet() {
\r
89 _sequenceList = new Vector();
\r
90 _annotationList = new Vector();
\r
91 } //-- jalview.binding.SequenceSet()
\r
99 * Method addAnnotation
\r
103 * @param vAnnotation
\r
105 public void addAnnotation(jalview.binding.Annotation vAnnotation)
\r
106 throws java.lang.IndexOutOfBoundsException
\r
108 _annotationList.addElement(vAnnotation);
\r
109 } //-- void addAnnotation(jalview.binding.Annotation)
\r
112 * Method addAnnotation
\r
117 * @param vAnnotation
\r
119 public void addAnnotation(int index, jalview.binding.Annotation vAnnotation)
\r
120 throws java.lang.IndexOutOfBoundsException
\r
122 _annotationList.insertElementAt(vAnnotation, index);
\r
123 } //-- void addAnnotation(int, jalview.binding.Annotation)
\r
126 * Method addSequence
\r
132 public void addSequence(jalview.binding.Sequence vSequence)
\r
133 throws java.lang.IndexOutOfBoundsException
\r
135 _sequenceList.addElement(vSequence);
\r
136 } //-- void addSequence(jalview.binding.Sequence)
\r
139 * Method addSequence
\r
146 public void addSequence(int index, jalview.binding.Sequence vSequence)
\r
147 throws java.lang.IndexOutOfBoundsException
\r
149 _sequenceList.insertElementAt(vSequence, index);
\r
150 } //-- void addSequence(int, jalview.binding.Sequence)
\r
153 * Method deleteAligned
\r
156 public void deleteAligned()
\r
158 this._has_aligned= false;
\r
159 } //-- void deleteAligned()
\r
162 * Method enumerateAnnotation
\r
166 * @return Enumeration
\r
168 public java.util.Enumeration enumerateAnnotation()
\r
170 return _annotationList.elements();
\r
171 } //-- java.util.Enumeration enumerateAnnotation()
\r
174 * Method enumerateSequence
\r
178 * @return Enumeration
\r
180 public java.util.Enumeration enumerateSequence()
\r
182 return _sequenceList.elements();
\r
183 } //-- java.util.Enumeration enumerateSequence()
\r
186 * Returns the value of field 'aligned'.
\r
189 * @return the value of field 'aligned'.
\r
191 public boolean getAligned()
\r
193 return this._aligned;
\r
194 } //-- boolean getAligned()
\r
197 * Method getAnnotation
\r
202 * @return Annotation
\r
204 public jalview.binding.Annotation getAnnotation(int index)
\r
205 throws java.lang.IndexOutOfBoundsException
\r
207 //-- check bounds for index
\r
208 if ((index < 0) || (index > _annotationList.size())) {
\r
209 throw new IndexOutOfBoundsException();
\r
212 return (jalview.binding.Annotation) _annotationList.elementAt(index);
\r
213 } //-- jalview.binding.Annotation getAnnotation(int)
\r
216 * Method getAnnotation
\r
220 * @return Annotation
\r
222 public jalview.binding.Annotation[] getAnnotation()
\r
224 int size = _annotationList.size();
\r
225 jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size];
\r
226 for (int index = 0; index < size; index++) {
\r
227 mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index);
\r
230 } //-- jalview.binding.Annotation[] getAnnotation()
\r
233 * Method getAnnotationCount
\r
239 public int getAnnotationCount()
\r
241 return _annotationList.size();
\r
242 } //-- int getAnnotationCount()
\r
245 * Returns the value of field 'gapChar'.
\r
248 * @return the value of field 'gapChar'.
\r
250 public java.lang.String getGapChar()
\r
252 return this._gapChar;
\r
253 } //-- java.lang.String getGapChar()
\r
256 * Method getSequence
\r
263 public jalview.binding.Sequence getSequence(int index)
\r
264 throws java.lang.IndexOutOfBoundsException
\r
266 //-- check bounds for index
\r
267 if ((index < 0) || (index > _sequenceList.size())) {
\r
268 throw new IndexOutOfBoundsException();
\r
271 return (jalview.binding.Sequence) _sequenceList.elementAt(index);
\r
272 } //-- jalview.binding.Sequence getSequence(int)
\r
275 * Method getSequence
\r
281 public jalview.binding.Sequence[] getSequence()
\r
283 int size = _sequenceList.size();
\r
284 jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size];
\r
285 for (int index = 0; index < size; index++) {
\r
286 mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index);
\r
289 } //-- jalview.binding.Sequence[] getSequence()
\r
292 * Method getSequenceCount
\r
298 public int getSequenceCount()
\r
300 return _sequenceList.size();
\r
301 } //-- int getSequenceCount()
\r
304 * Method hasAligned
\r
310 public boolean hasAligned()
\r
312 return this._has_aligned;
\r
313 } //-- boolean hasAligned()
\r
322 public boolean isValid()
\r
327 catch (org.exolab.castor.xml.ValidationException vex) {
\r
331 } //-- boolean isValid()
\r
340 public void marshal(java.io.Writer out)
\r
341 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
344 Marshaller.marshal(this, out);
\r
345 } //-- void marshal(java.io.Writer)
\r
354 public void marshal(org.xml.sax.ContentHandler handler)
\r
355 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
358 Marshaller.marshal(this, handler);
\r
359 } //-- void marshal(org.xml.sax.ContentHandler)
\r
362 * Method removeAllAnnotation
\r
365 public void removeAllAnnotation()
\r
367 _annotationList.removeAllElements();
\r
368 } //-- void removeAllAnnotation()
\r
371 * Method removeAllSequence
\r
374 public void removeAllSequence()
\r
376 _sequenceList.removeAllElements();
\r
377 } //-- void removeAllSequence()
\r
380 * Method removeAnnotation
\r
385 * @return Annotation
\r
387 public jalview.binding.Annotation removeAnnotation(int index)
\r
389 java.lang.Object obj = _annotationList.elementAt(index);
\r
390 _annotationList.removeElementAt(index);
\r
391 return (jalview.binding.Annotation) obj;
\r
392 } //-- jalview.binding.Annotation removeAnnotation(int)
\r
395 * Method removeSequence
\r
402 public jalview.binding.Sequence removeSequence(int index)
\r
404 java.lang.Object obj = _sequenceList.elementAt(index);
\r
405 _sequenceList.removeElementAt(index);
\r
406 return (jalview.binding.Sequence) obj;
\r
407 } //-- jalview.binding.Sequence removeSequence(int)
\r
410 * Sets the value of field 'aligned'.
\r
412 * @param aligned the value of field 'aligned'.
\r
414 public void setAligned(boolean aligned)
\r
416 this._aligned = aligned;
\r
417 this._has_aligned = true;
\r
418 } //-- void setAligned(boolean)
\r
421 * Method setAnnotation
\r
426 * @param vAnnotation
\r
428 public void setAnnotation(int index, jalview.binding.Annotation vAnnotation)
\r
429 throws java.lang.IndexOutOfBoundsException
\r
431 //-- check bounds for index
\r
432 if ((index < 0) || (index > _annotationList.size())) {
\r
433 throw new IndexOutOfBoundsException();
\r
435 _annotationList.setElementAt(vAnnotation, index);
\r
436 } //-- void setAnnotation(int, jalview.binding.Annotation)
\r
439 * Method setAnnotation
\r
443 * @param annotationArray
\r
445 public void setAnnotation(jalview.binding.Annotation[] annotationArray)
\r
448 _annotationList.removeAllElements();
\r
449 for (int i = 0; i < annotationArray.length; i++) {
\r
450 _annotationList.addElement(annotationArray[i]);
\r
452 } //-- void setAnnotation(jalview.binding.Annotation)
\r
455 * Sets the value of field 'gapChar'.
\r
457 * @param gapChar the value of field 'gapChar'.
\r
459 public void setGapChar(java.lang.String gapChar)
\r
461 this._gapChar = gapChar;
\r
462 } //-- void setGapChar(java.lang.String)
\r
465 * Method setSequence
\r
472 public void setSequence(int index, jalview.binding.Sequence vSequence)
\r
473 throws java.lang.IndexOutOfBoundsException
\r
475 //-- check bounds for index
\r
476 if ((index < 0) || (index > _sequenceList.size())) {
\r
477 throw new IndexOutOfBoundsException();
\r
479 _sequenceList.setElementAt(vSequence, index);
\r
480 } //-- void setSequence(int, jalview.binding.Sequence)
\r
483 * Method setSequence
\r
487 * @param sequenceArray
\r
489 public void setSequence(jalview.binding.Sequence[] sequenceArray)
\r
492 _sequenceList.removeAllElements();
\r
493 for (int i = 0; i < sequenceArray.length; i++) {
\r
494 _sequenceList.addElement(sequenceArray[i]);
\r
496 } //-- void setSequence(jalview.binding.Sequence)
\r
506 public static java.lang.Object unmarshal(java.io.Reader reader)
\r
507 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
509 return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);
\r
510 } //-- java.lang.Object unmarshal(java.io.Reader)
\r
516 public void validate()
\r
517 throws org.exolab.castor.xml.ValidationException
\r
519 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
520 validator.validate(this);
\r
521 } //-- void validate()
\r