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;
61 this._sequenceList = new java.util.Vector();
62 this._annotationList = new java.util.Vector();
73 * @throws java.lang.IndexOutOfBoundsException
74 * if the index given is outside the bounds of the collection
76 public void addAnnotation(final jalview.binding.Annotation vAnnotation)
77 throws java.lang.IndexOutOfBoundsException
79 this._annotationList.addElement(vAnnotation);
87 * @throws java.lang.IndexOutOfBoundsException
88 * if the index given is outside the bounds of the collection
90 public void addAnnotation(final int index,
91 final jalview.binding.Annotation vAnnotation)
92 throws java.lang.IndexOutOfBoundsException
94 this._annotationList.add(index, vAnnotation);
101 * @throws java.lang.IndexOutOfBoundsException
102 * if the index given is outside the bounds of the collection
104 public void addSequence(final jalview.binding.Sequence vSequence)
105 throws java.lang.IndexOutOfBoundsException
107 this._sequenceList.addElement(vSequence);
115 * @throws java.lang.IndexOutOfBoundsException
116 * if the index given is outside the bounds of the collection
118 public void addSequence(final int index,
119 final jalview.binding.Sequence vSequence)
120 throws java.lang.IndexOutOfBoundsException
122 this._sequenceList.add(index, vSequence);
127 public void deleteAligned()
129 this._has_aligned = false;
133 * Method enumerateAnnotation.
135 * @return an Enumeration over all jalview.binding.Annotation elements
137 public java.util.Enumeration enumerateAnnotation()
139 return this._annotationList.elements();
143 * Method enumerateSequence.
145 * @return an Enumeration over all jalview.binding.Sequence elements
147 public java.util.Enumeration enumerateSequence()
149 return this._sequenceList.elements();
153 * Returns the value of field 'aligned'.
155 * @return the value of field 'Aligned'.
157 public boolean getAligned()
159 return this._aligned;
163 * Method getAnnotation.
166 * @throws java.lang.IndexOutOfBoundsException
167 * if the index given is outside the bounds of the collection
168 * @return the value of the jalview.binding.Annotation at the given index
170 public jalview.binding.Annotation getAnnotation(final int index)
171 throws java.lang.IndexOutOfBoundsException
173 // check bounds for index
174 if (index < 0 || index >= this._annotationList.size())
176 throw new IndexOutOfBoundsException("getAnnotation: Index value '"
177 + index + "' not in range [0.."
178 + (this._annotationList.size() - 1) + "]");
181 return (jalview.binding.Annotation) _annotationList.get(index);
185 * Method getAnnotation.Returns the contents of the collection in an Array.
187 * Note: Just in case the collection contents are changing in another thread,
188 * we pass a 0-length Array of the correct type into the API call. This way we
189 * <i>know</i> that the Array returned is of exactly the correct length.
191 * @return this collection as an Array
193 public jalview.binding.Annotation[] getAnnotation()
195 jalview.binding.Annotation[] array = new jalview.binding.Annotation[0];
196 return (jalview.binding.Annotation[]) this._annotationList
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
225 * if the index given is outside the bounds of the collection
226 * @return the value of the jalview.binding.Sequence at the given index
228 public jalview.binding.Sequence getSequence(final int index)
229 throws java.lang.IndexOutOfBoundsException
231 // check bounds for index
232 if (index < 0 || index >= this._sequenceList.size())
234 throw new IndexOutOfBoundsException("getSequence: Index value '"
235 + index + "' not in range [0.."
236 + (this._sequenceList.size() - 1) + "]");
239 return (jalview.binding.Sequence) _sequenceList.get(index);
243 * Method getSequence.Returns the contents of the collection in an Array.
245 * Note: Just in case the collection contents are changing in another thread,
246 * we pass a 0-length Array of the correct type into the API call. This way we
247 * <i>know</i> that the Array returned is of exactly the correct length.
249 * @return this collection as an Array
251 public jalview.binding.Sequence[] getSequence()
253 jalview.binding.Sequence[] array = new jalview.binding.Sequence[0];
254 return (jalview.binding.Sequence[]) this._sequenceList.toArray(array);
258 * Method getSequenceCount.
260 * @return the size of this collection
262 public int getSequenceCount()
264 return this._sequenceList.size();
270 * @return true if at least one Aligned has been added
272 public boolean hasAligned()
274 return this._has_aligned;
278 * Returns the value of field 'aligned'.
280 * @return the value of field 'Aligned'.
282 public boolean isAligned()
284 return this._aligned;
290 * @return true if this object is valid according to the schema
292 public boolean isValid()
297 } catch (org.exolab.castor.xml.ValidationException vex)
308 * @throws org.exolab.castor.xml.MarshalException
309 * if object is null or if any SAXException is thrown during
311 * @throws org.exolab.castor.xml.ValidationException
312 * if this object is an invalid instance according to the schema
314 public void marshal(final java.io.Writer out)
315 throws org.exolab.castor.xml.MarshalException,
316 org.exolab.castor.xml.ValidationException
318 Marshaller.marshal(this, out);
325 * @throws java.io.IOException
326 * if an IOException occurs during marshaling
327 * @throws org.exolab.castor.xml.ValidationException
328 * if this object is an invalid instance according to the schema
329 * @throws org.exolab.castor.xml.MarshalException
330 * if object is null or if any SAXException is thrown during
333 public void marshal(final org.xml.sax.ContentHandler handler)
334 throws java.io.IOException,
335 org.exolab.castor.xml.MarshalException,
336 org.exolab.castor.xml.ValidationException
338 Marshaller.marshal(this, handler);
343 public void removeAllAnnotation()
345 this._annotationList.clear();
350 public void removeAllSequence()
352 this._sequenceList.clear();
356 * Method removeAnnotation.
359 * @return true if the object was removed from the collection.
361 public boolean removeAnnotation(
362 final jalview.binding.Annotation vAnnotation)
364 boolean removed = _annotationList.remove(vAnnotation);
369 * Method removeAnnotationAt.
372 * @return the element removed from the collection
374 public jalview.binding.Annotation removeAnnotationAt(final int index)
376 java.lang.Object obj = this._annotationList.remove(index);
377 return (jalview.binding.Annotation) obj;
381 * Method removeSequence.
384 * @return true if the object was removed from the collection.
386 public boolean removeSequence(final jalview.binding.Sequence vSequence)
388 boolean removed = _sequenceList.remove(vSequence);
393 * Method removeSequenceAt.
396 * @return the element removed from the collection
398 public jalview.binding.Sequence removeSequenceAt(final int index)
400 java.lang.Object obj = this._sequenceList.remove(index);
401 return (jalview.binding.Sequence) obj;
405 * Sets the value of field 'aligned'.
408 * the value of field 'aligned'.
410 public void setAligned(final boolean aligned)
412 this._aligned = aligned;
413 this._has_aligned = true;
421 * @throws java.lang.IndexOutOfBoundsException
422 * if the index given is outside the bounds of the collection
424 public void setAnnotation(final int index,
425 final jalview.binding.Annotation vAnnotation)
426 throws java.lang.IndexOutOfBoundsException
428 // check bounds for index
429 if (index < 0 || index >= this._annotationList.size())
431 throw new IndexOutOfBoundsException("setAnnotation: Index value '"
432 + index + "' not in range [0.."
433 + (this._annotationList.size() - 1) + "]");
436 this._annotationList.set(index, vAnnotation);
442 * @param vAnnotationArray
444 public void setAnnotation(
445 final jalview.binding.Annotation[] vAnnotationArray)
448 _annotationList.clear();
450 for (int i = 0; i < vAnnotationArray.length; i++)
452 this._annotationList.add(vAnnotationArray[i]);
457 * Sets the value of field 'gapChar'.
460 * the value of field 'gapChar'.
462 public void setGapChar(final java.lang.String gapChar)
464 this._gapChar = gapChar;
472 * @throws java.lang.IndexOutOfBoundsException
473 * if the index given is outside the bounds of the collection
475 public void setSequence(final int index,
476 final jalview.binding.Sequence vSequence)
477 throws java.lang.IndexOutOfBoundsException
479 // check bounds for index
480 if (index < 0 || index >= this._sequenceList.size())
482 throw new IndexOutOfBoundsException("setSequence: Index value '"
483 + index + "' not in range [0.."
484 + (this._sequenceList.size() - 1) + "]");
487 this._sequenceList.set(index, vSequence);
493 * @param vSequenceArray
495 public void setSequence(final jalview.binding.Sequence[] vSequenceArray)
498 _sequenceList.clear();
500 for (int i = 0; i < vSequenceArray.length; i++)
502 this._sequenceList.add(vSequenceArray[i]);
510 * @throws org.exolab.castor.xml.MarshalException
511 * if object is null or if any SAXException is thrown during
513 * @throws org.exolab.castor.xml.ValidationException
514 * if this object is an invalid instance according to the schema
515 * @return the unmarshaled jalview.binding.SequenceSet
517 public static jalview.binding.SequenceSet unmarshal(
518 final java.io.Reader reader)
519 throws org.exolab.castor.xml.MarshalException,
520 org.exolab.castor.xml.ValidationException
522 return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(
523 jalview.binding.SequenceSet.class, reader);
529 * @throws org.exolab.castor.xml.ValidationException
530 * if this object is an invalid instance according to the schema
532 public void validate() throws org.exolab.castor.xml.ValidationException
534 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
535 validator.validate(this);