1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
37 * @version $Revision$ $Date$
39 public class SequenceSet implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
49 private java.lang.String _gapChar;
52 * reference to set where jalview will gather the dataset
53 * sequences for all sequences in the set.
56 private java.lang.String _datasetId;
59 * Field _sequenceList.
61 private java.util.Vector _sequenceList;
64 * Field _annotationList.
66 private java.util.Vector _annotationList;
69 * Field _sequenceSetPropertiesList.
71 private java.util.Vector _sequenceSetPropertiesList;
74 * Field _alcodonFrameList.
76 private java.util.Vector _alcodonFrameList;
83 public SequenceSet() {
85 this._sequenceList = new java.util.Vector();
86 this._annotationList = new java.util.Vector();
87 this._sequenceSetPropertiesList = new java.util.Vector();
88 this._alcodonFrameList = new java.util.Vector();
99 * @param vAlcodonFrame
100 * @throws java.lang.IndexOutOfBoundsException if the index
101 * given is outside the bounds of the collection
103 public void addAlcodonFrame(
104 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
105 throws java.lang.IndexOutOfBoundsException {
106 this._alcodonFrameList.addElement(vAlcodonFrame);
113 * @param vAlcodonFrame
114 * @throws java.lang.IndexOutOfBoundsException if the index
115 * given is outside the bounds of the collection
117 public void addAlcodonFrame(
119 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
120 throws java.lang.IndexOutOfBoundsException {
121 this._alcodonFrameList.add(index, vAlcodonFrame);
128 * @throws java.lang.IndexOutOfBoundsException if the index
129 * given is outside the bounds of the collection
131 public void addAnnotation(
132 final jalview.schemabinding.version2.Annotation vAnnotation)
133 throws java.lang.IndexOutOfBoundsException {
134 this._annotationList.addElement(vAnnotation);
142 * @throws java.lang.IndexOutOfBoundsException if the index
143 * given is outside the bounds of the collection
145 public void addAnnotation(
147 final jalview.schemabinding.version2.Annotation vAnnotation)
148 throws java.lang.IndexOutOfBoundsException {
149 this._annotationList.add(index, vAnnotation);
156 * @throws java.lang.IndexOutOfBoundsException if the index
157 * given is outside the bounds of the collection
159 public void addSequence(
160 final jalview.schemabinding.version2.Sequence vSequence)
161 throws java.lang.IndexOutOfBoundsException {
162 this._sequenceList.addElement(vSequence);
170 * @throws java.lang.IndexOutOfBoundsException if the index
171 * given is outside the bounds of the collection
173 public void addSequence(
175 final jalview.schemabinding.version2.Sequence vSequence)
176 throws java.lang.IndexOutOfBoundsException {
177 this._sequenceList.add(index, vSequence);
183 * @param vSequenceSetProperties
184 * @throws java.lang.IndexOutOfBoundsException if the index
185 * given is outside the bounds of the collection
187 public void addSequenceSetProperties(
188 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
189 throws java.lang.IndexOutOfBoundsException {
190 this._sequenceSetPropertiesList.addElement(vSequenceSetProperties);
197 * @param vSequenceSetProperties
198 * @throws java.lang.IndexOutOfBoundsException if the index
199 * given is outside the bounds of the collection
201 public void addSequenceSetProperties(
203 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
204 throws java.lang.IndexOutOfBoundsException {
205 this._sequenceSetPropertiesList.add(index, vSequenceSetProperties);
209 * Method enumerateAlcodonFrame.
211 * @return an Enumeration over all
212 * jalview.schemabinding.version2.AlcodonFrame elements
214 public java.util.Enumeration enumerateAlcodonFrame(
216 return this._alcodonFrameList.elements();
220 * Method enumerateAnnotation.
222 * @return an Enumeration over all
223 * jalview.schemabinding.version2.Annotation elements
225 public java.util.Enumeration enumerateAnnotation(
227 return this._annotationList.elements();
231 * Method enumerateSequence.
233 * @return an Enumeration over all
234 * jalview.schemabinding.version2.Sequence elements
236 public java.util.Enumeration enumerateSequence(
238 return this._sequenceList.elements();
242 * Method enumerateSequenceSetProperties.
244 * @return an Enumeration over all
245 * jalview.schemabinding.version2.SequenceSetProperties elements
247 public java.util.Enumeration enumerateSequenceSetProperties(
249 return this._sequenceSetPropertiesList.elements();
253 * Method getAlcodonFrame.
256 * @throws java.lang.IndexOutOfBoundsException if the index
257 * given is outside the bounds of the collection
258 * @return the value of the
259 * jalview.schemabinding.version2.AlcodonFrame at the given inde
261 public jalview.schemabinding.version2.AlcodonFrame getAlcodonFrame(
263 throws java.lang.IndexOutOfBoundsException {
264 // check bounds for index
265 if (index < 0 || index >= this._alcodonFrameList.size()) {
266 throw new IndexOutOfBoundsException("getAlcodonFrame: Index value '" + index + "' not in range [0.." + (this._alcodonFrameList.size() - 1) + "]");
269 return (jalview.schemabinding.version2.AlcodonFrame) _alcodonFrameList.get(index);
273 * Method getAlcodonFrame.Returns the contents of the
274 * collection in an Array. <p>Note: Just in case the
275 * collection contents are changing in another thread, we pass
276 * a 0-length Array of the correct type into the API call.
277 * This way we <i>know</i> that the Array returned is of
278 * exactly the correct length.
280 * @return this collection as an Array
282 public jalview.schemabinding.version2.AlcodonFrame[] getAlcodonFrame(
284 jalview.schemabinding.version2.AlcodonFrame[] array = new jalview.schemabinding.version2.AlcodonFrame[0];
285 return (jalview.schemabinding.version2.AlcodonFrame[]) this._alcodonFrameList.toArray(array);
289 * Method getAlcodonFrameCount.
291 * @return the size of this collection
293 public int getAlcodonFrameCount(
295 return this._alcodonFrameList.size();
299 * Method getAnnotation.
302 * @throws java.lang.IndexOutOfBoundsException if the index
303 * given is outside the bounds of the collection
304 * @return the value of the
305 * jalview.schemabinding.version2.Annotation at the given index
307 public jalview.schemabinding.version2.Annotation getAnnotation(
309 throws java.lang.IndexOutOfBoundsException {
310 // check bounds for index
311 if (index < 0 || index >= this._annotationList.size()) {
312 throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
315 return (jalview.schemabinding.version2.Annotation) _annotationList.get(index);
319 * Method getAnnotation.Returns the contents of the collection
320 * in an Array. <p>Note: Just in case the collection contents
321 * are changing in another thread, we pass a 0-length Array of
322 * the correct type into the API call. This way we <i>know</i>
323 * that the Array returned is of exactly the correct length.
325 * @return this collection as an Array
327 public jalview.schemabinding.version2.Annotation[] getAnnotation(
329 jalview.schemabinding.version2.Annotation[] array = new jalview.schemabinding.version2.Annotation[0];
330 return (jalview.schemabinding.version2.Annotation[]) this._annotationList.toArray(array);
334 * Method getAnnotationCount.
336 * @return the size of this collection
338 public int getAnnotationCount(
340 return this._annotationList.size();
344 * Returns the value of field 'datasetId'. The field
345 * 'datasetId' has the following description: reference to set
346 * where jalview will gather the dataset sequences for all
347 * sequences in the set.
350 * @return the value of field 'DatasetId'.
352 public java.lang.String getDatasetId(
354 return this._datasetId;
358 * Returns the value of field 'gapChar'.
360 * @return the value of field 'GapChar'.
362 public java.lang.String getGapChar(
364 return this._gapChar;
368 * Method getSequence.
371 * @throws java.lang.IndexOutOfBoundsException if the index
372 * given is outside the bounds of the collection
373 * @return the value of the
374 * jalview.schemabinding.version2.Sequence at the given index
376 public jalview.schemabinding.version2.Sequence getSequence(
378 throws java.lang.IndexOutOfBoundsException {
379 // check bounds for index
380 if (index < 0 || index >= this._sequenceList.size()) {
381 throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
384 return (jalview.schemabinding.version2.Sequence) _sequenceList.get(index);
388 * Method getSequence.Returns the contents of the collection in
389 * an Array. <p>Note: Just in case the collection contents
390 * are changing in another thread, we pass a 0-length Array of
391 * the correct type into the API call. This way we <i>know</i>
392 * that the Array returned is of exactly the correct length.
394 * @return this collection as an Array
396 public jalview.schemabinding.version2.Sequence[] getSequence(
398 jalview.schemabinding.version2.Sequence[] array = new jalview.schemabinding.version2.Sequence[0];
399 return (jalview.schemabinding.version2.Sequence[]) this._sequenceList.toArray(array);
403 * Method getSequenceCount.
405 * @return the size of this collection
407 public int getSequenceCount(
409 return this._sequenceList.size();
413 * Method getSequenceSetProperties.
416 * @throws java.lang.IndexOutOfBoundsException if the index
417 * given is outside the bounds of the collection
418 * @return the value of the
419 * jalview.schemabinding.version2.SequenceSetProperties at the
422 public jalview.schemabinding.version2.SequenceSetProperties getSequenceSetProperties(
424 throws java.lang.IndexOutOfBoundsException {
425 // check bounds for index
426 if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {
427 throw new IndexOutOfBoundsException("getSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");
430 return (jalview.schemabinding.version2.SequenceSetProperties) _sequenceSetPropertiesList.get(index);
434 * Method getSequenceSetProperties.Returns the contents of the
435 * collection in an Array. <p>Note: Just in case the
436 * collection contents are changing in another thread, we pass
437 * a 0-length Array of the correct type into the API call.
438 * This way we <i>know</i> that the Array returned is of
439 * exactly the correct length.
441 * @return this collection as an Array
443 public jalview.schemabinding.version2.SequenceSetProperties[] getSequenceSetProperties(
445 jalview.schemabinding.version2.SequenceSetProperties[] array = new jalview.schemabinding.version2.SequenceSetProperties[0];
446 return (jalview.schemabinding.version2.SequenceSetProperties[]) this._sequenceSetPropertiesList.toArray(array);
450 * Method getSequenceSetPropertiesCount.
452 * @return the size of this collection
454 public int getSequenceSetPropertiesCount(
456 return this._sequenceSetPropertiesList.size();
462 * @return true if this object is valid according to the schema
464 public boolean isValid(
468 } catch (org.exolab.castor.xml.ValidationException vex) {
478 * @throws org.exolab.castor.xml.MarshalException if object is
479 * null or if any SAXException is thrown during marshaling
480 * @throws org.exolab.castor.xml.ValidationException if this
481 * object is an invalid instance according to the schema
484 final java.io.Writer out)
485 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
486 Marshaller.marshal(this, out);
493 * @throws java.io.IOException if an IOException occurs during
495 * @throws org.exolab.castor.xml.ValidationException if this
496 * object is an invalid instance according to the schema
497 * @throws org.exolab.castor.xml.MarshalException if object is
498 * null or if any SAXException is thrown during marshaling
501 final org.xml.sax.ContentHandler handler)
502 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
503 Marshaller.marshal(this, handler);
507 * Method removeAlcodonFrame.
509 * @param vAlcodonFrame
510 * @return true if the object was removed from the collection.
512 public boolean removeAlcodonFrame(
513 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame) {
514 boolean removed = _alcodonFrameList.remove(vAlcodonFrame);
519 * Method removeAlcodonFrameAt.
522 * @return the element removed from the collection
524 public jalview.schemabinding.version2.AlcodonFrame removeAlcodonFrameAt(
526 java.lang.Object obj = this._alcodonFrameList.remove(index);
527 return (jalview.schemabinding.version2.AlcodonFrame) obj;
532 public void removeAllAlcodonFrame(
534 this._alcodonFrameList.clear();
539 public void removeAllAnnotation(
541 this._annotationList.clear();
546 public void removeAllSequence(
548 this._sequenceList.clear();
553 public void removeAllSequenceSetProperties(
555 this._sequenceSetPropertiesList.clear();
559 * Method removeAnnotation.
562 * @return true if the object was removed from the collection.
564 public boolean removeAnnotation(
565 final jalview.schemabinding.version2.Annotation vAnnotation) {
566 boolean removed = _annotationList.remove(vAnnotation);
571 * Method removeAnnotationAt.
574 * @return the element removed from the collection
576 public jalview.schemabinding.version2.Annotation removeAnnotationAt(
578 java.lang.Object obj = this._annotationList.remove(index);
579 return (jalview.schemabinding.version2.Annotation) obj;
583 * Method removeSequence.
586 * @return true if the object was removed from the collection.
588 public boolean removeSequence(
589 final jalview.schemabinding.version2.Sequence vSequence) {
590 boolean removed = _sequenceList.remove(vSequence);
595 * Method removeSequenceAt.
598 * @return the element removed from the collection
600 public jalview.schemabinding.version2.Sequence removeSequenceAt(
602 java.lang.Object obj = this._sequenceList.remove(index);
603 return (jalview.schemabinding.version2.Sequence) obj;
607 * Method removeSequenceSetProperties.
609 * @param vSequenceSetProperties
610 * @return true if the object was removed from the collection.
612 public boolean removeSequenceSetProperties(
613 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties) {
614 boolean removed = _sequenceSetPropertiesList.remove(vSequenceSetProperties);
619 * Method removeSequenceSetPropertiesAt.
622 * @return the element removed from the collection
624 public jalview.schemabinding.version2.SequenceSetProperties removeSequenceSetPropertiesAt(
626 java.lang.Object obj = this._sequenceSetPropertiesList.remove(index);
627 return (jalview.schemabinding.version2.SequenceSetProperties) obj;
634 * @param vAlcodonFrame
635 * @throws java.lang.IndexOutOfBoundsException if the index
636 * given is outside the bounds of the collection
638 public void setAlcodonFrame(
640 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
641 throws java.lang.IndexOutOfBoundsException {
642 // check bounds for index
643 if (index < 0 || index >= this._alcodonFrameList.size()) {
644 throw new IndexOutOfBoundsException("setAlcodonFrame: Index value '" + index + "' not in range [0.." + (this._alcodonFrameList.size() - 1) + "]");
647 this._alcodonFrameList.set(index, vAlcodonFrame);
653 * @param vAlcodonFrameArray
655 public void setAlcodonFrame(
656 final jalview.schemabinding.version2.AlcodonFrame[] vAlcodonFrameArray) {
658 _alcodonFrameList.clear();
660 for (int i = 0; i < vAlcodonFrameArray.length; i++) {
661 this._alcodonFrameList.add(vAlcodonFrameArray[i]);
670 * @throws java.lang.IndexOutOfBoundsException if the index
671 * given is outside the bounds of the collection
673 public void setAnnotation(
675 final jalview.schemabinding.version2.Annotation vAnnotation)
676 throws java.lang.IndexOutOfBoundsException {
677 // check bounds for index
678 if (index < 0 || index >= this._annotationList.size()) {
679 throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
682 this._annotationList.set(index, vAnnotation);
688 * @param vAnnotationArray
690 public void setAnnotation(
691 final jalview.schemabinding.version2.Annotation[] vAnnotationArray) {
693 _annotationList.clear();
695 for (int i = 0; i < vAnnotationArray.length; i++) {
696 this._annotationList.add(vAnnotationArray[i]);
701 * Sets the value of field 'datasetId'. The field 'datasetId'
702 * has the following description: reference to set where
703 * jalview will gather the dataset sequences for all sequences
707 * @param datasetId the value of field 'datasetId'.
709 public void setDatasetId(
710 final java.lang.String datasetId) {
711 this._datasetId = datasetId;
715 * Sets the value of field 'gapChar'.
717 * @param gapChar the value of field 'gapChar'.
719 public void setGapChar(
720 final java.lang.String gapChar) {
721 this._gapChar = gapChar;
729 * @throws java.lang.IndexOutOfBoundsException if the index
730 * given is outside the bounds of the collection
732 public void setSequence(
734 final jalview.schemabinding.version2.Sequence vSequence)
735 throws java.lang.IndexOutOfBoundsException {
736 // check bounds for index
737 if (index < 0 || index >= this._sequenceList.size()) {
738 throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
741 this._sequenceList.set(index, vSequence);
747 * @param vSequenceArray
749 public void setSequence(
750 final jalview.schemabinding.version2.Sequence[] vSequenceArray) {
752 _sequenceList.clear();
754 for (int i = 0; i < vSequenceArray.length; i++) {
755 this._sequenceList.add(vSequenceArray[i]);
763 * @param vSequenceSetProperties
764 * @throws java.lang.IndexOutOfBoundsException if the index
765 * given is outside the bounds of the collection
767 public void setSequenceSetProperties(
769 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
770 throws java.lang.IndexOutOfBoundsException {
771 // check bounds for index
772 if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {
773 throw new IndexOutOfBoundsException("setSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");
776 this._sequenceSetPropertiesList.set(index, vSequenceSetProperties);
782 * @param vSequenceSetPropertiesArray
784 public void setSequenceSetProperties(
785 final jalview.schemabinding.version2.SequenceSetProperties[] vSequenceSetPropertiesArray) {
787 _sequenceSetPropertiesList.clear();
789 for (int i = 0; i < vSequenceSetPropertiesArray.length; i++) {
790 this._sequenceSetPropertiesList.add(vSequenceSetPropertiesArray[i]);
798 * @throws org.exolab.castor.xml.MarshalException if object is
799 * null or if any SAXException is thrown during marshaling
800 * @throws org.exolab.castor.xml.ValidationException if this
801 * object is an invalid instance according to the schema
802 * @return the unmarshaled
803 * jalview.schemabinding.version2.SequenceSet
805 public static jalview.schemabinding.version2.SequenceSet unmarshal(
806 final java.io.Reader reader)
807 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
808 return (jalview.schemabinding.version2.SequenceSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceSet.class, reader);
814 * @throws org.exolab.castor.xml.ValidationException if this
815 * object is an invalid instance according to the schema
817 public void validate(
819 throws org.exolab.castor.xml.ValidationException {
820 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
821 validator.validate(this);