1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
39 * @version $Revision$ $Date$
41 public class SequenceSet implements java.io.Serializable
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
51 private java.lang.String _gapChar;
54 * reference to set where jalview will gather the dataset sequences for all
55 * sequences in the set.
58 private java.lang.String _datasetId;
61 * Field _sequenceList.
63 private java.util.Vector _sequenceList;
66 * Field _annotationList.
68 private java.util.Vector _annotationList;
71 * Field _sequenceSetPropertiesList.
73 private java.util.Vector _sequenceSetPropertiesList;
76 * Field _alcodonFrameList.
78 private java.util.Vector _alcodonFrameList;
87 this._sequenceList = new java.util.Vector();
88 this._annotationList = new java.util.Vector();
89 this._sequenceSetPropertiesList = new java.util.Vector();
90 this._alcodonFrameList = new java.util.Vector();
100 * @param vAlcodonFrame
101 * @throws java.lang.IndexOutOfBoundsException
102 * if the index given is outside the bounds of the collection
104 public void addAlcodonFrame(
105 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
106 throws java.lang.IndexOutOfBoundsException
108 this._alcodonFrameList.addElement(vAlcodonFrame);
115 * @param vAlcodonFrame
116 * @throws java.lang.IndexOutOfBoundsException
117 * if the index given is outside the bounds of the collection
119 public void addAlcodonFrame(final int index,
120 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
121 throws java.lang.IndexOutOfBoundsException
123 this._alcodonFrameList.add(index, vAlcodonFrame);
130 * @throws java.lang.IndexOutOfBoundsException
131 * if the index given is outside the bounds of the collection
133 public void addAnnotation(
134 final jalview.schemabinding.version2.Annotation vAnnotation)
135 throws java.lang.IndexOutOfBoundsException
137 this._annotationList.addElement(vAnnotation);
145 * @throws java.lang.IndexOutOfBoundsException
146 * if the index given is outside the bounds of the collection
148 public void addAnnotation(final int index,
149 final jalview.schemabinding.version2.Annotation vAnnotation)
150 throws java.lang.IndexOutOfBoundsException
152 this._annotationList.add(index, vAnnotation);
159 * @throws java.lang.IndexOutOfBoundsException
160 * if the index given is outside the bounds of the collection
162 public void addSequence(
163 final jalview.schemabinding.version2.Sequence vSequence)
164 throws java.lang.IndexOutOfBoundsException
166 this._sequenceList.addElement(vSequence);
174 * @throws java.lang.IndexOutOfBoundsException
175 * if the index given is outside the bounds of the collection
177 public void addSequence(final int index,
178 final jalview.schemabinding.version2.Sequence vSequence)
179 throws java.lang.IndexOutOfBoundsException
181 this._sequenceList.add(index, vSequence);
187 * @param vSequenceSetProperties
188 * @throws java.lang.IndexOutOfBoundsException
189 * if the index given is outside the bounds of the collection
191 public void addSequenceSetProperties(
192 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
193 throws java.lang.IndexOutOfBoundsException
195 this._sequenceSetPropertiesList.addElement(vSequenceSetProperties);
202 * @param vSequenceSetProperties
203 * @throws java.lang.IndexOutOfBoundsException
204 * if the index given is outside the bounds of the collection
206 public void addSequenceSetProperties(
208 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
209 throws java.lang.IndexOutOfBoundsException
211 this._sequenceSetPropertiesList.add(index, vSequenceSetProperties);
215 * Method enumerateAlcodonFrame.
217 * @return an Enumeration over all jalview.schemabinding.version2.AlcodonFrame
220 public java.util.Enumeration enumerateAlcodonFrame()
222 return this._alcodonFrameList.elements();
226 * Method enumerateAnnotation.
228 * @return an Enumeration over all jalview.schemabinding.version2.Annotation
231 public java.util.Enumeration enumerateAnnotation()
233 return this._annotationList.elements();
237 * Method enumerateSequence.
239 * @return an Enumeration over all jalview.schemabinding.version2.Sequence
242 public java.util.Enumeration enumerateSequence()
244 return this._sequenceList.elements();
248 * Method enumerateSequenceSetProperties.
250 * @return an Enumeration over all
251 * jalview.schemabinding.version2.SequenceSetProperties elements
253 public java.util.Enumeration enumerateSequenceSetProperties()
255 return this._sequenceSetPropertiesList.elements();
259 * Method getAlcodonFrame.
262 * @throws java.lang.IndexOutOfBoundsException
263 * if the index given is outside the bounds of the collection
264 * @return the value of the jalview.schemabinding.version2.AlcodonFrame at the
267 public jalview.schemabinding.version2.AlcodonFrame getAlcodonFrame(
268 final int index) throws java.lang.IndexOutOfBoundsException
270 // check bounds for index
271 if (index < 0 || index >= this._alcodonFrameList.size())
273 throw new IndexOutOfBoundsException("getAlcodonFrame: Index value '"
274 + index + "' not in range [0.."
275 + (this._alcodonFrameList.size() - 1) + "]");
278 return (jalview.schemabinding.version2.AlcodonFrame) _alcodonFrameList
283 * Method getAlcodonFrame.Returns the contents of the collection in an Array.
285 * Note: Just in case the collection contents are changing in another thread,
286 * we pass a 0-length Array of the correct type into the API call. This way we
287 * <i>know</i> that the Array returned is of exactly the correct length.
289 * @return this collection as an Array
291 public jalview.schemabinding.version2.AlcodonFrame[] getAlcodonFrame()
293 jalview.schemabinding.version2.AlcodonFrame[] array = new jalview.schemabinding.version2.AlcodonFrame[0];
294 return (jalview.schemabinding.version2.AlcodonFrame[]) this._alcodonFrameList
299 * Method getAlcodonFrameCount.
301 * @return the size of this collection
303 public int getAlcodonFrameCount()
305 return this._alcodonFrameList.size();
309 * Method getAnnotation.
312 * @throws java.lang.IndexOutOfBoundsException
313 * if the index given is outside the bounds of the collection
314 * @return the value of the jalview.schemabinding.version2.Annotation at the
317 public jalview.schemabinding.version2.Annotation getAnnotation(
318 final int index) throws java.lang.IndexOutOfBoundsException
320 // check bounds for index
321 if (index < 0 || index >= this._annotationList.size())
323 throw new IndexOutOfBoundsException("getAnnotation: Index value '"
324 + index + "' not in range [0.."
325 + (this._annotationList.size() - 1) + "]");
328 return (jalview.schemabinding.version2.Annotation) _annotationList
333 * Method getAnnotation.Returns the contents of the collection in an Array.
335 * Note: Just in case the collection contents are changing in another thread,
336 * we pass a 0-length Array of the correct type into the API call. This way we
337 * <i>know</i> that the Array returned is of exactly the correct length.
339 * @return this collection as an Array
341 public jalview.schemabinding.version2.Annotation[] getAnnotation()
343 jalview.schemabinding.version2.Annotation[] array = new jalview.schemabinding.version2.Annotation[0];
344 return (jalview.schemabinding.version2.Annotation[]) this._annotationList
349 * Method getAnnotationCount.
351 * @return the size of this collection
353 public int getAnnotationCount()
355 return this._annotationList.size();
359 * Returns the value of field 'datasetId'. The field 'datasetId' has the
360 * following description: reference to set where jalview will gather the
361 * dataset sequences for all sequences in the set.
364 * @return the value of field 'DatasetId'.
366 public java.lang.String getDatasetId()
368 return this._datasetId;
372 * Returns the value of field 'gapChar'.
374 * @return the value of field 'GapChar'.
376 public java.lang.String getGapChar()
378 return this._gapChar;
382 * Method getSequence.
385 * @throws java.lang.IndexOutOfBoundsException
386 * if the index given is outside the bounds of the collection
387 * @return the value of the jalview.schemabinding.version2.Sequence at the
390 public jalview.schemabinding.version2.Sequence getSequence(final int index)
391 throws java.lang.IndexOutOfBoundsException
393 // check bounds for index
394 if (index < 0 || index >= this._sequenceList.size())
396 throw new IndexOutOfBoundsException("getSequence: Index value '"
397 + index + "' not in range [0.."
398 + (this._sequenceList.size() - 1) + "]");
401 return (jalview.schemabinding.version2.Sequence) _sequenceList
406 * Method getSequence.Returns the contents of the collection in an Array.
408 * Note: Just in case the collection contents are changing in another thread,
409 * we pass a 0-length Array of the correct type into the API call. This way we
410 * <i>know</i> that the Array returned is of exactly the correct length.
412 * @return this collection as an Array
414 public jalview.schemabinding.version2.Sequence[] getSequence()
416 jalview.schemabinding.version2.Sequence[] array = new jalview.schemabinding.version2.Sequence[0];
417 return (jalview.schemabinding.version2.Sequence[]) this._sequenceList
422 * Method getSequenceCount.
424 * @return the size of this collection
426 public int getSequenceCount()
428 return this._sequenceList.size();
432 * Method getSequenceSetProperties.
435 * @throws java.lang.IndexOutOfBoundsException
436 * if the index given is outside the bounds of the collection
437 * @return the value of the
438 * jalview.schemabinding.version2.SequenceSetProperties at the given
441 public jalview.schemabinding.version2.SequenceSetProperties getSequenceSetProperties(
442 final int index) throws java.lang.IndexOutOfBoundsException
444 // check bounds for index
445 if (index < 0 || index >= this._sequenceSetPropertiesList.size())
447 throw new IndexOutOfBoundsException(
448 "getSequenceSetProperties: Index value '" + index
449 + "' not in range [0.."
450 + (this._sequenceSetPropertiesList.size() - 1) + "]");
453 return (jalview.schemabinding.version2.SequenceSetProperties) _sequenceSetPropertiesList
458 * Method getSequenceSetProperties.Returns the contents of the collection in
461 * Note: Just in case the collection contents are changing in another thread,
462 * we pass a 0-length Array of the correct type into the API call. This way we
463 * <i>know</i> that the Array returned is of exactly the correct length.
465 * @return this collection as an Array
467 public jalview.schemabinding.version2.SequenceSetProperties[] getSequenceSetProperties()
469 jalview.schemabinding.version2.SequenceSetProperties[] array = new jalview.schemabinding.version2.SequenceSetProperties[0];
470 return (jalview.schemabinding.version2.SequenceSetProperties[]) this._sequenceSetPropertiesList
475 * Method getSequenceSetPropertiesCount.
477 * @return the size of this collection
479 public int getSequenceSetPropertiesCount()
481 return this._sequenceSetPropertiesList.size();
487 * @return true if this object is valid according to the schema
489 public boolean isValid()
494 } catch (org.exolab.castor.xml.ValidationException vex)
505 * @throws org.exolab.castor.xml.MarshalException
506 * if object is null or if any SAXException is thrown during
508 * @throws org.exolab.castor.xml.ValidationException
509 * if this object is an invalid instance according to the schema
511 public void marshal(final java.io.Writer out)
512 throws org.exolab.castor.xml.MarshalException,
513 org.exolab.castor.xml.ValidationException
515 Marshaller.marshal(this, out);
522 * @throws java.io.IOException
523 * if an IOException occurs during marshaling
524 * @throws org.exolab.castor.xml.ValidationException
525 * if this object is an invalid instance according to the schema
526 * @throws org.exolab.castor.xml.MarshalException
527 * if object is null or if any SAXException is thrown during
530 public void marshal(final org.xml.sax.ContentHandler handler)
531 throws java.io.IOException,
532 org.exolab.castor.xml.MarshalException,
533 org.exolab.castor.xml.ValidationException
535 Marshaller.marshal(this, handler);
539 * Method removeAlcodonFrame.
541 * @param vAlcodonFrame
542 * @return true if the object was removed from the collection.
544 public boolean removeAlcodonFrame(
545 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
547 boolean removed = _alcodonFrameList.remove(vAlcodonFrame);
552 * Method removeAlcodonFrameAt.
555 * @return the element removed from the collection
557 public jalview.schemabinding.version2.AlcodonFrame removeAlcodonFrameAt(
560 java.lang.Object obj = this._alcodonFrameList.remove(index);
561 return (jalview.schemabinding.version2.AlcodonFrame) obj;
566 public void removeAllAlcodonFrame()
568 this._alcodonFrameList.clear();
573 public void removeAllAnnotation()
575 this._annotationList.clear();
580 public void removeAllSequence()
582 this._sequenceList.clear();
587 public void removeAllSequenceSetProperties()
589 this._sequenceSetPropertiesList.clear();
593 * Method removeAnnotation.
596 * @return true if the object was removed from the collection.
598 public boolean removeAnnotation(
599 final jalview.schemabinding.version2.Annotation vAnnotation)
601 boolean removed = _annotationList.remove(vAnnotation);
606 * Method removeAnnotationAt.
609 * @return the element removed from the collection
611 public jalview.schemabinding.version2.Annotation removeAnnotationAt(
614 java.lang.Object obj = this._annotationList.remove(index);
615 return (jalview.schemabinding.version2.Annotation) obj;
619 * Method removeSequence.
622 * @return true if the object was removed from the collection.
624 public boolean removeSequence(
625 final jalview.schemabinding.version2.Sequence vSequence)
627 boolean removed = _sequenceList.remove(vSequence);
632 * Method removeSequenceAt.
635 * @return the element removed from the collection
637 public jalview.schemabinding.version2.Sequence removeSequenceAt(
640 java.lang.Object obj = this._sequenceList.remove(index);
641 return (jalview.schemabinding.version2.Sequence) obj;
645 * Method removeSequenceSetProperties.
647 * @param vSequenceSetProperties
648 * @return true if the object was removed from the collection.
650 public boolean removeSequenceSetProperties(
651 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
653 boolean removed = _sequenceSetPropertiesList
654 .remove(vSequenceSetProperties);
659 * Method removeSequenceSetPropertiesAt.
662 * @return the element removed from the collection
664 public jalview.schemabinding.version2.SequenceSetProperties removeSequenceSetPropertiesAt(
667 java.lang.Object obj = this._sequenceSetPropertiesList.remove(index);
668 return (jalview.schemabinding.version2.SequenceSetProperties) obj;
675 * @param vAlcodonFrame
676 * @throws java.lang.IndexOutOfBoundsException
677 * if the index given is outside the bounds of the collection
679 public void setAlcodonFrame(final int index,
680 final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
681 throws java.lang.IndexOutOfBoundsException
683 // check bounds for index
684 if (index < 0 || index >= this._alcodonFrameList.size())
686 throw new IndexOutOfBoundsException("setAlcodonFrame: Index value '"
687 + index + "' not in range [0.."
688 + (this._alcodonFrameList.size() - 1) + "]");
691 this._alcodonFrameList.set(index, vAlcodonFrame);
697 * @param vAlcodonFrameArray
699 public void setAlcodonFrame(
700 final jalview.schemabinding.version2.AlcodonFrame[] vAlcodonFrameArray)
703 _alcodonFrameList.clear();
705 for (int i = 0; i < vAlcodonFrameArray.length; i++)
707 this._alcodonFrameList.add(vAlcodonFrameArray[i]);
716 * @throws java.lang.IndexOutOfBoundsException
717 * if the index given is outside the bounds of the collection
719 public void setAnnotation(final int index,
720 final jalview.schemabinding.version2.Annotation vAnnotation)
721 throws java.lang.IndexOutOfBoundsException
723 // check bounds for index
724 if (index < 0 || index >= this._annotationList.size())
726 throw new IndexOutOfBoundsException("setAnnotation: Index value '"
727 + index + "' not in range [0.."
728 + (this._annotationList.size() - 1) + "]");
731 this._annotationList.set(index, vAnnotation);
737 * @param vAnnotationArray
739 public void setAnnotation(
740 final jalview.schemabinding.version2.Annotation[] vAnnotationArray)
743 _annotationList.clear();
745 for (int i = 0; i < vAnnotationArray.length; i++)
747 this._annotationList.add(vAnnotationArray[i]);
752 * Sets the value of field 'datasetId'. The field 'datasetId' has the
753 * following description: reference to set where jalview will gather the
754 * dataset sequences for all sequences in the set.
758 * the value of field 'datasetId'.
760 public void setDatasetId(final java.lang.String datasetId)
762 this._datasetId = datasetId;
766 * Sets the value of field 'gapChar'.
769 * the value of field 'gapChar'.
771 public void setGapChar(final java.lang.String gapChar)
773 this._gapChar = gapChar;
781 * @throws java.lang.IndexOutOfBoundsException
782 * if the index given is outside the bounds of the collection
784 public void setSequence(final int index,
785 final jalview.schemabinding.version2.Sequence vSequence)
786 throws java.lang.IndexOutOfBoundsException
788 // check bounds for index
789 if (index < 0 || index >= this._sequenceList.size())
791 throw new IndexOutOfBoundsException("setSequence: Index value '"
792 + index + "' not in range [0.."
793 + (this._sequenceList.size() - 1) + "]");
796 this._sequenceList.set(index, vSequence);
802 * @param vSequenceArray
804 public void setSequence(
805 final jalview.schemabinding.version2.Sequence[] vSequenceArray)
808 _sequenceList.clear();
810 for (int i = 0; i < vSequenceArray.length; i++)
812 this._sequenceList.add(vSequenceArray[i]);
820 * @param vSequenceSetProperties
821 * @throws java.lang.IndexOutOfBoundsException
822 * if the index given is outside the bounds of the collection
824 public void setSequenceSetProperties(
826 final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
827 throws java.lang.IndexOutOfBoundsException
829 // check bounds for index
830 if (index < 0 || index >= this._sequenceSetPropertiesList.size())
832 throw new IndexOutOfBoundsException(
833 "setSequenceSetProperties: Index value '" + index
834 + "' not in range [0.."
835 + (this._sequenceSetPropertiesList.size() - 1) + "]");
838 this._sequenceSetPropertiesList.set(index, vSequenceSetProperties);
844 * @param vSequenceSetPropertiesArray
846 public void setSequenceSetProperties(
847 final jalview.schemabinding.version2.SequenceSetProperties[] vSequenceSetPropertiesArray)
850 _sequenceSetPropertiesList.clear();
852 for (int i = 0; i < vSequenceSetPropertiesArray.length; i++)
854 this._sequenceSetPropertiesList.add(vSequenceSetPropertiesArray[i]);
862 * @throws org.exolab.castor.xml.MarshalException
863 * if object is null or if any SAXException is thrown during
865 * @throws org.exolab.castor.xml.ValidationException
866 * if this object is an invalid instance according to the schema
867 * @return the unmarshaled jalview.schemabinding.version2.SequenceSet
869 public static jalview.schemabinding.version2.SequenceSet unmarshal(
870 final java.io.Reader reader)
871 throws org.exolab.castor.xml.MarshalException,
872 org.exolab.castor.xml.ValidationException
874 return (jalview.schemabinding.version2.SequenceSet) Unmarshaller
875 .unmarshal(jalview.schemabinding.version2.SequenceSet.class,
882 * @throws org.exolab.castor.xml.ValidationException
883 * if this object is an invalid instance according to the schema
885 public void validate() throws org.exolab.castor.xml.ValidationException
887 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
888 validator.validate(this);