2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.schemabinding.version2;
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 JSeq implements java.io.Serializable {
25 //--------------------------/
26 //- Class/Member Variables -/
27 //--------------------------/
35 * keeps track of state for field: _colour
37 private boolean _has_colour;
45 * keeps track of state for field: _start
47 private boolean _has_start;
55 * keeps track of state for field: _end
57 private boolean _has_end;
62 private java.lang.String _id;
67 private boolean _hidden;
70 * keeps track of state for field: _hidden
72 private boolean _has_hidden;
75 * Field _featuresList.
77 private java.util.Vector _featuresList;
82 private java.util.Vector _pdbidsList;
85 * Field _hiddenSequencesList.
87 private java.util.Vector _hiddenSequencesList;
90 * Reference to a viewer showing RNA structure
91 * for this sequence. Schema supports one viewer showing
93 * annotations for multiple sequences, though currently only
95 * annotation for one sequence (gapped or trimmed) is used
98 private java.util.Vector _rnaViewerList;
107 this._featuresList = new java.util.Vector();
108 this._pdbidsList = new java.util.Vector();
109 this._hiddenSequencesList = new java.util.Vector();
110 this._rnaViewerList = new java.util.Vector();
122 * @throws java.lang.IndexOutOfBoundsException if the index
123 * given is outside the bounds of the collection
125 public void addFeatures(
126 final jalview.schemabinding.version2.Features vFeatures)
127 throws java.lang.IndexOutOfBoundsException {
128 this._featuresList.addElement(vFeatures);
136 * @throws java.lang.IndexOutOfBoundsException if the index
137 * given is outside the bounds of the collection
139 public void addFeatures(
141 final jalview.schemabinding.version2.Features vFeatures)
142 throws java.lang.IndexOutOfBoundsException {
143 this._featuresList.add(index, vFeatures);
149 * @param vHiddenSequences
150 * @throws java.lang.IndexOutOfBoundsException if the index
151 * given is outside the bounds of the collection
153 public void addHiddenSequences(
154 final int vHiddenSequences)
155 throws java.lang.IndexOutOfBoundsException {
156 this._hiddenSequencesList.addElement(new java.lang.Integer(vHiddenSequences));
163 * @param vHiddenSequences
164 * @throws java.lang.IndexOutOfBoundsException if the index
165 * given is outside the bounds of the collection
167 public void addHiddenSequences(
169 final int vHiddenSequences)
170 throws java.lang.IndexOutOfBoundsException {
171 this._hiddenSequencesList.add(index, new java.lang.Integer(vHiddenSequences));
178 * @throws java.lang.IndexOutOfBoundsException if the index
179 * given is outside the bounds of the collection
181 public void addPdbids(
182 final jalview.schemabinding.version2.Pdbids vPdbids)
183 throws java.lang.IndexOutOfBoundsException {
184 this._pdbidsList.addElement(vPdbids);
192 * @throws java.lang.IndexOutOfBoundsException if the index
193 * given is outside the bounds of the collection
195 public void addPdbids(
197 final jalview.schemabinding.version2.Pdbids vPdbids)
198 throws java.lang.IndexOutOfBoundsException {
199 this._pdbidsList.add(index, vPdbids);
206 * @throws java.lang.IndexOutOfBoundsException if the index
207 * given is outside the bounds of the collection
209 public void addRnaViewer(
210 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
211 throws java.lang.IndexOutOfBoundsException {
212 this._rnaViewerList.addElement(vRnaViewer);
220 * @throws java.lang.IndexOutOfBoundsException if the index
221 * given is outside the bounds of the collection
223 public void addRnaViewer(
225 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
226 throws java.lang.IndexOutOfBoundsException {
227 this._rnaViewerList.add(index, vRnaViewer);
232 public void deleteColour(
234 this._has_colour= false;
239 public void deleteEnd(
241 this._has_end= false;
246 public void deleteHidden(
248 this._has_hidden= false;
253 public void deleteStart(
255 this._has_start= false;
259 * Method enumerateFeatures.
261 * @return an Enumeration over all
262 * jalview.schemabinding.version2.Features elements
264 public java.util.Enumeration enumerateFeatures(
266 return this._featuresList.elements();
270 * Method enumerateHiddenSequences.
272 * @return an Enumeration over all int elements
274 public java.util.Enumeration enumerateHiddenSequences(
276 return this._hiddenSequencesList.elements();
280 * Method enumeratePdbids.
282 * @return an Enumeration over all
283 * jalview.schemabinding.version2.Pdbids elements
285 public java.util.Enumeration enumeratePdbids(
287 return this._pdbidsList.elements();
291 * Method enumerateRnaViewer.
293 * @return an Enumeration over all
294 * jalview.schemabinding.version2.RnaViewer elements
296 public java.util.Enumeration enumerateRnaViewer(
298 return this._rnaViewerList.elements();
302 * Returns the value of field 'colour'.
304 * @return the value of field 'Colour'.
306 public int getColour(
312 * Returns the value of field 'end'.
314 * @return the value of field 'End'.
322 * Method getFeatures.
325 * @throws java.lang.IndexOutOfBoundsException if the index
326 * given is outside the bounds of the collection
327 * @return the value of the
328 * jalview.schemabinding.version2.Features at the given index
330 public jalview.schemabinding.version2.Features getFeatures(
332 throws java.lang.IndexOutOfBoundsException {
333 // check bounds for index
334 if (index < 0 || index >= this._featuresList.size()) {
335 throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
338 return (jalview.schemabinding.version2.Features) _featuresList.get(index);
342 * Method getFeatures.Returns the contents of the collection in
343 * an Array. <p>Note: Just in case the collection contents
344 * are changing in another thread, we pass a 0-length Array of
345 * the correct type into the API call. This way we <i>know</i>
346 * that the Array returned is of exactly the correct length.
348 * @return this collection as an Array
350 public jalview.schemabinding.version2.Features[] getFeatures(
352 jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
353 return (jalview.schemabinding.version2.Features[]) this._featuresList.toArray(array);
357 * Method getFeaturesCount.
359 * @return the size of this collection
361 public int getFeaturesCount(
363 return this._featuresList.size();
367 * Returns the value of field 'hidden'.
369 * @return the value of field 'Hidden'.
371 public boolean getHidden(
377 * Method getHiddenSequences.
380 * @throws java.lang.IndexOutOfBoundsException if the index
381 * given is outside the bounds of the collection
382 * @return the value of the int at the given index
384 public int getHiddenSequences(
386 throws java.lang.IndexOutOfBoundsException {
387 // check bounds for index
388 if (index < 0 || index >= this._hiddenSequencesList.size()) {
389 throw new IndexOutOfBoundsException("getHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
392 return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
396 * Method getHiddenSequences.Returns the contents of the
397 * collection in an Array.
399 * @return this collection as an Array
401 public int[] getHiddenSequences(
403 int size = this._hiddenSequencesList.size();
404 int[] array = new int[size];
405 java.util.Iterator iter = _hiddenSequencesList.iterator();
406 for (int index = 0; index < size; index++) {
407 array[index] = ((java.lang.Integer) iter.next()).intValue();
413 * Method getHiddenSequencesCount.
415 * @return the size of this collection
417 public int getHiddenSequencesCount(
419 return this._hiddenSequencesList.size();
423 * Returns the value of field 'id'.
425 * @return the value of field 'Id'.
427 public java.lang.String getId(
436 * @throws java.lang.IndexOutOfBoundsException if the index
437 * given is outside the bounds of the collection
438 * @return the value of the
439 * jalview.schemabinding.version2.Pdbids at the given index
441 public jalview.schemabinding.version2.Pdbids getPdbids(
443 throws java.lang.IndexOutOfBoundsException {
444 // check bounds for index
445 if (index < 0 || index >= this._pdbidsList.size()) {
446 throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
449 return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
453 * Method getPdbids.Returns the contents of the collection in
454 * an Array. <p>Note: Just in case the collection contents
455 * are changing in another thread, we pass a 0-length Array of
456 * the correct type into the API call. This way we <i>know</i>
457 * that the Array returned is of exactly the correct length.
459 * @return this collection as an Array
461 public jalview.schemabinding.version2.Pdbids[] getPdbids(
463 jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
464 return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList.toArray(array);
468 * Method getPdbidsCount.
470 * @return the size of this collection
472 public int getPdbidsCount(
474 return this._pdbidsList.size();
478 * Method getRnaViewer.
481 * @throws java.lang.IndexOutOfBoundsException if the index
482 * given is outside the bounds of the collection
483 * @return the value of the
484 * jalview.schemabinding.version2.RnaViewer at the given index
486 public jalview.schemabinding.version2.RnaViewer getRnaViewer(
488 throws java.lang.IndexOutOfBoundsException {
489 // check bounds for index
490 if (index < 0 || index >= this._rnaViewerList.size()) {
491 throw new IndexOutOfBoundsException("getRnaViewer: Index value '" + index + "' not in range [0.." + (this._rnaViewerList.size() - 1) + "]");
494 return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList.get(index);
498 * Method getRnaViewer.Returns the contents of the collection
499 * in an Array. <p>Note: Just in case the collection contents
500 * are changing in another thread, we pass a 0-length Array of
501 * the correct type into the API call. This way we <i>know</i>
502 * that the Array returned is of exactly the correct length.
504 * @return this collection as an Array
506 public jalview.schemabinding.version2.RnaViewer[] getRnaViewer(
508 jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0];
509 return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList.toArray(array);
513 * Method getRnaViewerCount.
515 * @return the size of this collection
517 public int getRnaViewerCount(
519 return this._rnaViewerList.size();
523 * Returns the value of field 'start'.
525 * @return the value of field 'Start'.
535 * @return true if at least one Colour has been added
537 public boolean hasColour(
539 return this._has_colour;
545 * @return true if at least one End has been added
547 public boolean hasEnd(
549 return this._has_end;
555 * @return true if at least one Hidden has been added
557 public boolean hasHidden(
559 return this._has_hidden;
565 * @return true if at least one Start has been added
567 public boolean hasStart(
569 return this._has_start;
573 * Returns the value of field 'hidden'.
575 * @return the value of field 'Hidden'.
577 public boolean isHidden(
585 * @return true if this object is valid according to the schema
587 public boolean isValid(
591 } catch (org.exolab.castor.xml.ValidationException vex) {
601 * @throws org.exolab.castor.xml.MarshalException if object is
602 * null or if any SAXException is thrown during marshaling
603 * @throws org.exolab.castor.xml.ValidationException if this
604 * object is an invalid instance according to the schema
607 final java.io.Writer out)
608 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
609 Marshaller.marshal(this, out);
616 * @throws java.io.IOException if an IOException occurs during
618 * @throws org.exolab.castor.xml.ValidationException if this
619 * object is an invalid instance according to the schema
620 * @throws org.exolab.castor.xml.MarshalException if object is
621 * null or if any SAXException is thrown during marshaling
624 final org.xml.sax.ContentHandler handler)
625 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
626 Marshaller.marshal(this, handler);
631 public void removeAllFeatures(
633 this._featuresList.clear();
638 public void removeAllHiddenSequences(
640 this._hiddenSequencesList.clear();
645 public void removeAllPdbids(
647 this._pdbidsList.clear();
652 public void removeAllRnaViewer(
654 this._rnaViewerList.clear();
658 * Method removeFeatures.
661 * @return true if the object was removed from the collection.
663 public boolean removeFeatures(
664 final jalview.schemabinding.version2.Features vFeatures) {
665 boolean removed = _featuresList.remove(vFeatures);
670 * Method removeFeaturesAt.
673 * @return the element removed from the collection
675 public jalview.schemabinding.version2.Features removeFeaturesAt(
677 java.lang.Object obj = this._featuresList.remove(index);
678 return (jalview.schemabinding.version2.Features) obj;
682 * Method removeHiddenSequences.
684 * @param vHiddenSequences
685 * @return true if the object was removed from the collection.
687 public boolean removeHiddenSequences(
688 final int vHiddenSequences) {
689 boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(vHiddenSequences));
694 * Method removeHiddenSequencesAt.
697 * @return the element removed from the collection
699 public int removeHiddenSequencesAt(
701 java.lang.Object obj = this._hiddenSequencesList.remove(index);
702 return ((java.lang.Integer) obj).intValue();
706 * Method removePdbids.
709 * @return true if the object was removed from the collection.
711 public boolean removePdbids(
712 final jalview.schemabinding.version2.Pdbids vPdbids) {
713 boolean removed = _pdbidsList.remove(vPdbids);
718 * Method removePdbidsAt.
721 * @return the element removed from the collection
723 public jalview.schemabinding.version2.Pdbids removePdbidsAt(
725 java.lang.Object obj = this._pdbidsList.remove(index);
726 return (jalview.schemabinding.version2.Pdbids) obj;
730 * Method removeRnaViewer.
733 * @return true if the object was removed from the collection.
735 public boolean removeRnaViewer(
736 final jalview.schemabinding.version2.RnaViewer vRnaViewer) {
737 boolean removed = _rnaViewerList.remove(vRnaViewer);
742 * Method removeRnaViewerAt.
745 * @return the element removed from the collection
747 public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt(
749 java.lang.Object obj = this._rnaViewerList.remove(index);
750 return (jalview.schemabinding.version2.RnaViewer) obj;
754 * Sets the value of field 'colour'.
756 * @param colour the value of field 'colour'.
758 public void setColour(
760 this._colour = colour;
761 this._has_colour = true;
765 * Sets the value of field 'end'.
767 * @param end the value of field 'end'.
772 this._has_end = true;
780 * @throws java.lang.IndexOutOfBoundsException if the index
781 * given is outside the bounds of the collection
783 public void setFeatures(
785 final jalview.schemabinding.version2.Features vFeatures)
786 throws java.lang.IndexOutOfBoundsException {
787 // check bounds for index
788 if (index < 0 || index >= this._featuresList.size()) {
789 throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
792 this._featuresList.set(index, vFeatures);
798 * @param vFeaturesArray
800 public void setFeatures(
801 final jalview.schemabinding.version2.Features[] vFeaturesArray) {
803 _featuresList.clear();
805 for (int i = 0; i < vFeaturesArray.length; i++) {
806 this._featuresList.add(vFeaturesArray[i]);
811 * Sets the value of field 'hidden'.
813 * @param hidden the value of field 'hidden'.
815 public void setHidden(
816 final boolean hidden) {
817 this._hidden = hidden;
818 this._has_hidden = true;
825 * @param vHiddenSequences
826 * @throws java.lang.IndexOutOfBoundsException if the index
827 * given is outside the bounds of the collection
829 public void setHiddenSequences(
831 final int vHiddenSequences)
832 throws java.lang.IndexOutOfBoundsException {
833 // check bounds for index
834 if (index < 0 || index >= this._hiddenSequencesList.size()) {
835 throw new IndexOutOfBoundsException("setHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
838 this._hiddenSequencesList.set(index, new java.lang.Integer(vHiddenSequences));
844 * @param vHiddenSequencesArray
846 public void setHiddenSequences(
847 final int[] vHiddenSequencesArray) {
849 _hiddenSequencesList.clear();
851 for (int i = 0; i < vHiddenSequencesArray.length; i++) {
852 this._hiddenSequencesList.add(new java.lang.Integer(vHiddenSequencesArray[i]));
857 * Sets the value of field 'id'.
859 * @param id the value of field 'id'.
862 final java.lang.String id) {
871 * @throws java.lang.IndexOutOfBoundsException if the index
872 * given is outside the bounds of the collection
874 public void setPdbids(
876 final jalview.schemabinding.version2.Pdbids vPdbids)
877 throws java.lang.IndexOutOfBoundsException {
878 // check bounds for index
879 if (index < 0 || index >= this._pdbidsList.size()) {
880 throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
883 this._pdbidsList.set(index, vPdbids);
889 * @param vPdbidsArray
891 public void setPdbids(
892 final jalview.schemabinding.version2.Pdbids[] vPdbidsArray) {
896 for (int i = 0; i < vPdbidsArray.length; i++) {
897 this._pdbidsList.add(vPdbidsArray[i]);
906 * @throws java.lang.IndexOutOfBoundsException if the index
907 * given is outside the bounds of the collection
909 public void setRnaViewer(
911 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
912 throws java.lang.IndexOutOfBoundsException {
913 // check bounds for index
914 if (index < 0 || index >= this._rnaViewerList.size()) {
915 throw new IndexOutOfBoundsException("setRnaViewer: Index value '" + index + "' not in range [0.." + (this._rnaViewerList.size() - 1) + "]");
918 this._rnaViewerList.set(index, vRnaViewer);
924 * @param vRnaViewerArray
926 public void setRnaViewer(
927 final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray) {
929 _rnaViewerList.clear();
931 for (int i = 0; i < vRnaViewerArray.length; i++) {
932 this._rnaViewerList.add(vRnaViewerArray[i]);
937 * Sets the value of field 'start'.
939 * @param start the value of field 'start'.
941 public void setStart(
944 this._has_start = true;
951 * @throws org.exolab.castor.xml.MarshalException if object is
952 * null or if any SAXException is thrown during marshaling
953 * @throws org.exolab.castor.xml.ValidationException if this
954 * object is an invalid instance according to the schema
955 * @return the unmarshaled jalview.schemabinding.version2.JSeq
957 public static jalview.schemabinding.version2.JSeq unmarshal(
958 final java.io.Reader reader)
959 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
960 return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(jalview.schemabinding.version2.JSeq.class, reader);
966 * @throws org.exolab.castor.xml.ValidationException if this
967 * object is an invalid instance according to the schema
969 public void validate(
971 throws org.exolab.castor.xml.ValidationException {
972 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
973 validator.validate(this);