2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.binding;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
20 * @version $Revision$ $Date$
22 public class SequenceSet implements java.io.Serializable {
25 //--------------------------/
26 //- Class/Member Variables -/
27 //--------------------------/
32 private java.lang.String _gapChar;
37 private boolean _aligned;
40 * keeps track of state for field: _aligned
42 private boolean _has_aligned;
45 * Field _sequenceList.
47 private java.util.Vector _sequenceList;
50 * Field _annotationList.
52 private java.util.Vector _annotationList;
59 public SequenceSet() {
61 this._sequenceList = new java.util.Vector();
62 this._annotationList = new java.util.Vector();
74 * @throws java.lang.IndexOutOfBoundsException if the index
75 * given is outside the bounds of the collection
77 public void addAnnotation(
78 final jalview.binding.Annotation vAnnotation)
79 throws java.lang.IndexOutOfBoundsException {
80 this._annotationList.addElement(vAnnotation);
88 * @throws java.lang.IndexOutOfBoundsException if the index
89 * given is outside the bounds of the collection
91 public void addAnnotation(
93 final jalview.binding.Annotation vAnnotation)
94 throws java.lang.IndexOutOfBoundsException {
95 this._annotationList.add(index, vAnnotation);
102 * @throws java.lang.IndexOutOfBoundsException if the index
103 * given is outside the bounds of the collection
105 public void addSequence(
106 final jalview.binding.Sequence vSequence)
107 throws java.lang.IndexOutOfBoundsException {
108 this._sequenceList.addElement(vSequence);
116 * @throws java.lang.IndexOutOfBoundsException if the index
117 * given is outside the bounds of the collection
119 public void addSequence(
121 final jalview.binding.Sequence vSequence)
122 throws java.lang.IndexOutOfBoundsException {
123 this._sequenceList.add(index, vSequence);
128 public void deleteAligned(
130 this._has_aligned= false;
134 * Method enumerateAnnotation.
136 * @return an Enumeration over all jalview.binding.Annotation
139 public java.util.Enumeration enumerateAnnotation(
141 return this._annotationList.elements();
145 * Method enumerateSequence.
147 * @return an Enumeration over all jalview.binding.Sequence
150 public java.util.Enumeration enumerateSequence(
152 return this._sequenceList.elements();
156 * Returns the value of field 'aligned'.
158 * @return the value of field 'Aligned'.
160 public boolean getAligned(
162 return this._aligned;
166 * Method getAnnotation.
169 * @throws java.lang.IndexOutOfBoundsException if the index
170 * given is outside the bounds of the collection
171 * @return the value of the jalview.binding.Annotation at the
174 public jalview.binding.Annotation getAnnotation(
176 throws java.lang.IndexOutOfBoundsException {
177 // check bounds for index
178 if (index < 0 || index >= this._annotationList.size()) {
179 throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
182 return (jalview.binding.Annotation) _annotationList.get(index);
186 * Method getAnnotation.Returns the contents of the collection
187 * in an Array. <p>Note: Just in case the collection contents
188 * are changing in another thread, we pass a 0-length Array of
189 * the correct type into the API call. This way we <i>know</i>
190 * that the Array returned is of exactly the correct length.
192 * @return this collection as an Array
194 public jalview.binding.Annotation[] getAnnotation(
196 jalview.binding.Annotation[] array = new jalview.binding.Annotation[0];
197 return (jalview.binding.Annotation[]) this._annotationList.toArray(array);
201 * Method getAnnotationCount.
203 * @return the size of this collection
205 public int getAnnotationCount(
207 return this._annotationList.size();
211 * Returns the value of field 'gapChar'.
213 * @return the value of field 'GapChar'.
215 public java.lang.String getGapChar(
217 return this._gapChar;
221 * Method getSequence.
224 * @throws java.lang.IndexOutOfBoundsException if the index
225 * given is outside the bounds of the collection
226 * @return the value of the jalview.binding.Sequence at the
229 public jalview.binding.Sequence getSequence(
231 throws java.lang.IndexOutOfBoundsException {
232 // check bounds for index
233 if (index < 0 || index >= this._sequenceList.size()) {
234 throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
237 return (jalview.binding.Sequence) _sequenceList.get(index);
241 * Method getSequence.Returns the contents of the collection in
242 * an Array. <p>Note: Just in case the collection contents
243 * are changing in another thread, we pass a 0-length Array of
244 * the correct type into the API call. This way we <i>know</i>
245 * that the Array returned is of exactly the correct length.
247 * @return this collection as an Array
249 public jalview.binding.Sequence[] getSequence(
251 jalview.binding.Sequence[] array = new jalview.binding.Sequence[0];
252 return (jalview.binding.Sequence[]) this._sequenceList.toArray(array);
256 * Method getSequenceCount.
258 * @return the size of this collection
260 public int getSequenceCount(
262 return this._sequenceList.size();
268 * @return true if at least one Aligned has been added
270 public boolean hasAligned(
272 return this._has_aligned;
276 * Returns the value of field 'aligned'.
278 * @return the value of field 'Aligned'.
280 public boolean isAligned(
282 return this._aligned;
288 * @return true if this object is valid according to the schema
290 public boolean isValid(
294 } catch (org.exolab.castor.xml.ValidationException vex) {
304 * @throws org.exolab.castor.xml.MarshalException if object is
305 * null or if any SAXException is thrown during marshaling
306 * @throws org.exolab.castor.xml.ValidationException if this
307 * object is an invalid instance according to the schema
310 final java.io.Writer out)
311 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
312 Marshaller.marshal(this, out);
319 * @throws java.io.IOException if an IOException occurs during
321 * @throws org.exolab.castor.xml.ValidationException if this
322 * object is an invalid instance according to the schema
323 * @throws org.exolab.castor.xml.MarshalException if object is
324 * null or if any SAXException is thrown during marshaling
327 final org.xml.sax.ContentHandler handler)
328 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
329 Marshaller.marshal(this, handler);
334 public void removeAllAnnotation(
336 this._annotationList.clear();
341 public void removeAllSequence(
343 this._sequenceList.clear();
347 * Method removeAnnotation.
350 * @return true if the object was removed from the collection.
352 public boolean removeAnnotation(
353 final jalview.binding.Annotation vAnnotation) {
354 boolean removed = _annotationList.remove(vAnnotation);
359 * Method removeAnnotationAt.
362 * @return the element removed from the collection
364 public jalview.binding.Annotation removeAnnotationAt(
366 java.lang.Object obj = this._annotationList.remove(index);
367 return (jalview.binding.Annotation) obj;
371 * Method removeSequence.
374 * @return true if the object was removed from the collection.
376 public boolean removeSequence(
377 final jalview.binding.Sequence vSequence) {
378 boolean removed = _sequenceList.remove(vSequence);
383 * Method removeSequenceAt.
386 * @return the element removed from the collection
388 public jalview.binding.Sequence removeSequenceAt(
390 java.lang.Object obj = this._sequenceList.remove(index);
391 return (jalview.binding.Sequence) obj;
395 * Sets the value of field 'aligned'.
397 * @param aligned the value of field 'aligned'.
399 public void setAligned(
400 final boolean aligned) {
401 this._aligned = aligned;
402 this._has_aligned = true;
410 * @throws java.lang.IndexOutOfBoundsException if the index
411 * given is outside the bounds of the collection
413 public void setAnnotation(
415 final jalview.binding.Annotation vAnnotation)
416 throws java.lang.IndexOutOfBoundsException {
417 // check bounds for index
418 if (index < 0 || index >= this._annotationList.size()) {
419 throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
422 this._annotationList.set(index, vAnnotation);
428 * @param vAnnotationArray
430 public void setAnnotation(
431 final jalview.binding.Annotation[] vAnnotationArray) {
433 _annotationList.clear();
435 for (int i = 0; i < vAnnotationArray.length; i++) {
436 this._annotationList.add(vAnnotationArray[i]);
441 * Sets the value of field 'gapChar'.
443 * @param gapChar the value of field 'gapChar'.
445 public void setGapChar(
446 final java.lang.String gapChar) {
447 this._gapChar = gapChar;
455 * @throws java.lang.IndexOutOfBoundsException if the index
456 * given is outside the bounds of the collection
458 public void setSequence(
460 final jalview.binding.Sequence vSequence)
461 throws java.lang.IndexOutOfBoundsException {
462 // check bounds for index
463 if (index < 0 || index >= this._sequenceList.size()) {
464 throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
467 this._sequenceList.set(index, vSequence);
473 * @param vSequenceArray
475 public void setSequence(
476 final jalview.binding.Sequence[] vSequenceArray) {
478 _sequenceList.clear();
480 for (int i = 0; i < vSequenceArray.length; i++) {
481 this._sequenceList.add(vSequenceArray[i]);
489 * @throws org.exolab.castor.xml.MarshalException if object is
490 * null or if any SAXException is thrown during marshaling
491 * @throws org.exolab.castor.xml.ValidationException if this
492 * object is an invalid instance according to the schema
493 * @return the unmarshaled jalview.binding.SequenceSet
495 public static jalview.binding.SequenceSet unmarshal(
496 final java.io.Reader reader)
497 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
498 return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);
504 * @throws org.exolab.castor.xml.ValidationException if this
505 * object is an invalid instance according to the schema
507 public void validate(
509 throws org.exolab.castor.xml.ValidationException {
510 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
511 validator.validate(this);