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 for this sequence. Schema
91 * supports one viewer showing multiple annotations for multiple sequences,
92 * though currently only one annotation for one sequence (gapped or trimmed)
96 private java.util.Vector _rnaViewerList;
105 this._featuresList = new java.util.Vector();
106 this._pdbidsList = new java.util.Vector();
107 this._hiddenSequencesList = new java.util.Vector();
108 this._rnaViewerList = new java.util.Vector();
119 * @throws java.lang.IndexOutOfBoundsException
120 * if the index given is outside the bounds of the collection
122 public void addFeatures(
123 final jalview.schemabinding.version2.Features vFeatures)
124 throws java.lang.IndexOutOfBoundsException
126 this._featuresList.addElement(vFeatures);
134 * @throws java.lang.IndexOutOfBoundsException
135 * if the index given is outside the bounds of the collection
137 public void addFeatures(final int index,
138 final jalview.schemabinding.version2.Features vFeatures)
139 throws java.lang.IndexOutOfBoundsException
141 this._featuresList.add(index, vFeatures);
147 * @param vHiddenSequences
148 * @throws java.lang.IndexOutOfBoundsException
149 * if the index given is outside the bounds of the collection
151 public void addHiddenSequences(final int vHiddenSequences)
152 throws java.lang.IndexOutOfBoundsException
154 this._hiddenSequencesList.addElement(new java.lang.Integer(
162 * @param vHiddenSequences
163 * @throws java.lang.IndexOutOfBoundsException
164 * if the index given is outside the bounds of the collection
166 public void addHiddenSequences(final int index, final int vHiddenSequences)
167 throws java.lang.IndexOutOfBoundsException
169 this._hiddenSequencesList.add(index, new java.lang.Integer(
177 * @throws java.lang.IndexOutOfBoundsException
178 * if the index given is outside the bounds of the collection
180 public void addPdbids(final jalview.schemabinding.version2.Pdbids vPdbids)
181 throws java.lang.IndexOutOfBoundsException
183 this._pdbidsList.addElement(vPdbids);
191 * @throws java.lang.IndexOutOfBoundsException
192 * if the index given is outside the bounds of the collection
194 public void addPdbids(final int index,
195 final jalview.schemabinding.version2.Pdbids vPdbids)
196 throws java.lang.IndexOutOfBoundsException
198 this._pdbidsList.add(index, vPdbids);
205 * @throws java.lang.IndexOutOfBoundsException
206 * if the index given is outside the bounds of the collection
208 public void addRnaViewer(
209 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
210 throws java.lang.IndexOutOfBoundsException
212 this._rnaViewerList.addElement(vRnaViewer);
220 * @throws java.lang.IndexOutOfBoundsException
221 * if the index given is outside the bounds of the collection
223 public void addRnaViewer(final int index,
224 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
225 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 jalview.schemabinding.version2.Features
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 jalview.schemabinding.version2.Pdbids
285 public java.util.Enumeration enumeratePdbids()
287 return this._pdbidsList.elements();
291 * Method enumerateRnaViewer.
293 * @return an Enumeration over all jalview.schemabinding.version2.RnaViewer
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
326 * if the index given is outside the bounds of the collection
327 * @return the value of the jalview.schemabinding.version2.Features at the
330 public jalview.schemabinding.version2.Features getFeatures(final int index)
331 throws java.lang.IndexOutOfBoundsException
333 // check bounds for index
334 if (index < 0 || index >= this._featuresList.size())
336 throw new IndexOutOfBoundsException("getFeatures: Index value '"
337 + index + "' not in range [0.."
338 + (this._featuresList.size() - 1) + "]");
341 return (jalview.schemabinding.version2.Features) _featuresList
346 * Method getFeatures.Returns the contents of the collection in an Array.
348 * Note: Just in case the collection contents are changing in another thread,
349 * we pass a 0-length Array of the correct type into the API call. This way we
350 * <i>know</i> that the Array returned is of exactly the correct length.
352 * @return this collection as an Array
354 public jalview.schemabinding.version2.Features[] getFeatures()
356 jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
357 return (jalview.schemabinding.version2.Features[]) this._featuresList
362 * Method getFeaturesCount.
364 * @return the size of this collection
366 public int getFeaturesCount()
368 return this._featuresList.size();
372 * Returns the value of field 'hidden'.
374 * @return the value of field 'Hidden'.
376 public boolean getHidden()
382 * Method getHiddenSequences.
385 * @throws java.lang.IndexOutOfBoundsException
386 * if the index given is outside the bounds of the collection
387 * @return the value of the int at the given index
389 public int getHiddenSequences(final int index)
390 throws java.lang.IndexOutOfBoundsException
392 // check bounds for index
393 if (index < 0 || index >= this._hiddenSequencesList.size())
395 throw new IndexOutOfBoundsException(
396 "getHiddenSequences: Index value '" + index
397 + "' not in range [0.."
398 + (this._hiddenSequencesList.size() - 1) + "]");
401 return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
405 * Method getHiddenSequences.Returns the contents of the collection in an
408 * @return this collection as an Array
410 public int[] getHiddenSequences()
412 int size = this._hiddenSequencesList.size();
413 int[] array = new int[size];
414 java.util.Iterator iter = _hiddenSequencesList.iterator();
415 for (int index = 0; index < size; index++)
417 array[index] = ((java.lang.Integer) iter.next()).intValue();
423 * Method getHiddenSequencesCount.
425 * @return the size of this collection
427 public int getHiddenSequencesCount()
429 return this._hiddenSequencesList.size();
433 * Returns the value of field 'id'.
435 * @return the value of field 'Id'.
437 public java.lang.String getId()
446 * @throws java.lang.IndexOutOfBoundsException
447 * if the index given is outside the bounds of the collection
448 * @return the value of the jalview.schemabinding.version2.Pdbids at the given
451 public jalview.schemabinding.version2.Pdbids getPdbids(final int index)
452 throws java.lang.IndexOutOfBoundsException
454 // check bounds for index
455 if (index < 0 || index >= this._pdbidsList.size())
457 throw new IndexOutOfBoundsException("getPdbids: Index value '"
458 + index + "' not in range [0.."
459 + (this._pdbidsList.size() - 1) + "]");
462 return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
466 * Method getPdbids.Returns the contents of the collection in an Array.
468 * Note: Just in case the collection contents are changing in another thread,
469 * we pass a 0-length Array of the correct type into the API call. This way we
470 * <i>know</i> that the Array returned is of exactly the correct length.
472 * @return this collection as an Array
474 public jalview.schemabinding.version2.Pdbids[] getPdbids()
476 jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
477 return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList
482 * Method getPdbidsCount.
484 * @return the size of this collection
486 public int getPdbidsCount()
488 return this._pdbidsList.size();
492 * Method getRnaViewer.
495 * @throws java.lang.IndexOutOfBoundsException
496 * if the index given is outside the bounds of the collection
497 * @return the value of the jalview.schemabinding.version2.RnaViewer at the
500 public jalview.schemabinding.version2.RnaViewer getRnaViewer(
501 final int index) throws java.lang.IndexOutOfBoundsException
503 // check bounds for index
504 if (index < 0 || index >= this._rnaViewerList.size())
506 throw new IndexOutOfBoundsException("getRnaViewer: Index value '"
507 + index + "' not in range [0.."
508 + (this._rnaViewerList.size() - 1) + "]");
511 return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList
516 * Method getRnaViewer.Returns the contents of the collection in an Array.
518 * Note: Just in case the collection contents are changing in another thread,
519 * we pass a 0-length Array of the correct type into the API call. This way we
520 * <i>know</i> that the Array returned is of exactly the correct length.
522 * @return this collection as an Array
524 public jalview.schemabinding.version2.RnaViewer[] getRnaViewer()
526 jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0];
527 return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList
532 * Method getRnaViewerCount.
534 * @return the size of this collection
536 public int getRnaViewerCount()
538 return this._rnaViewerList.size();
542 * Returns the value of field 'start'.
544 * @return the value of field 'Start'.
546 public int getStart()
554 * @return true if at least one Colour has been added
556 public boolean hasColour()
558 return this._has_colour;
564 * @return true if at least one End has been added
566 public boolean hasEnd()
568 return this._has_end;
574 * @return true if at least one Hidden has been added
576 public boolean hasHidden()
578 return this._has_hidden;
584 * @return true if at least one Start has been added
586 public boolean hasStart()
588 return this._has_start;
592 * Returns the value of field 'hidden'.
594 * @return the value of field 'Hidden'.
596 public boolean isHidden()
604 * @return true if this object is valid according to the schema
606 public boolean isValid()
611 } catch (org.exolab.castor.xml.ValidationException vex)
622 * @throws org.exolab.castor.xml.MarshalException
623 * if object is null or if any SAXException is thrown during
625 * @throws org.exolab.castor.xml.ValidationException
626 * if this object is an invalid instance according to the schema
628 public void marshal(final java.io.Writer out)
629 throws org.exolab.castor.xml.MarshalException,
630 org.exolab.castor.xml.ValidationException
632 Marshaller.marshal(this, out);
639 * @throws java.io.IOException
640 * if an IOException occurs during marshaling
641 * @throws org.exolab.castor.xml.ValidationException
642 * if this object is an invalid instance according to the schema
643 * @throws org.exolab.castor.xml.MarshalException
644 * if object is null or if any SAXException is thrown during
647 public void marshal(final org.xml.sax.ContentHandler handler)
648 throws java.io.IOException,
649 org.exolab.castor.xml.MarshalException,
650 org.exolab.castor.xml.ValidationException
652 Marshaller.marshal(this, handler);
657 public void removeAllFeatures()
659 this._featuresList.clear();
664 public void removeAllHiddenSequences()
666 this._hiddenSequencesList.clear();
671 public void removeAllPdbids()
673 this._pdbidsList.clear();
678 public void removeAllRnaViewer()
680 this._rnaViewerList.clear();
684 * Method removeFeatures.
687 * @return true if the object was removed from the collection.
689 public boolean removeFeatures(
690 final jalview.schemabinding.version2.Features vFeatures)
692 boolean removed = _featuresList.remove(vFeatures);
697 * Method removeFeaturesAt.
700 * @return the element removed from the collection
702 public jalview.schemabinding.version2.Features removeFeaturesAt(
705 java.lang.Object obj = this._featuresList.remove(index);
706 return (jalview.schemabinding.version2.Features) obj;
710 * Method removeHiddenSequences.
712 * @param vHiddenSequences
713 * @return true if the object was removed from the collection.
715 public boolean removeHiddenSequences(final int vHiddenSequences)
717 boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(
723 * Method removeHiddenSequencesAt.
726 * @return the element removed from the collection
728 public int removeHiddenSequencesAt(final int index)
730 java.lang.Object obj = this._hiddenSequencesList.remove(index);
731 return ((java.lang.Integer) obj).intValue();
735 * Method removePdbids.
738 * @return true if the object was removed from the collection.
740 public boolean removePdbids(
741 final jalview.schemabinding.version2.Pdbids vPdbids)
743 boolean removed = _pdbidsList.remove(vPdbids);
748 * Method removePdbidsAt.
751 * @return the element removed from the collection
753 public jalview.schemabinding.version2.Pdbids removePdbidsAt(
756 java.lang.Object obj = this._pdbidsList.remove(index);
757 return (jalview.schemabinding.version2.Pdbids) obj;
761 * Method removeRnaViewer.
764 * @return true if the object was removed from the collection.
766 public boolean removeRnaViewer(
767 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
769 boolean removed = _rnaViewerList.remove(vRnaViewer);
774 * Method removeRnaViewerAt.
777 * @return the element removed from the collection
779 public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt(
782 java.lang.Object obj = this._rnaViewerList.remove(index);
783 return (jalview.schemabinding.version2.RnaViewer) obj;
787 * Sets the value of field 'colour'.
790 * the value of field 'colour'.
792 public void setColour(final int colour)
794 this._colour = colour;
795 this._has_colour = true;
799 * Sets the value of field 'end'.
802 * the value of field 'end'.
804 public void setEnd(final int end)
807 this._has_end = true;
815 * @throws java.lang.IndexOutOfBoundsException
816 * if the index given is outside the bounds of the collection
818 public void setFeatures(final int index,
819 final jalview.schemabinding.version2.Features vFeatures)
820 throws java.lang.IndexOutOfBoundsException
822 // check bounds for index
823 if (index < 0 || index >= this._featuresList.size())
825 throw new IndexOutOfBoundsException("setFeatures: Index value '"
826 + index + "' not in range [0.."
827 + (this._featuresList.size() - 1) + "]");
830 this._featuresList.set(index, vFeatures);
836 * @param vFeaturesArray
838 public void setFeatures(
839 final jalview.schemabinding.version2.Features[] vFeaturesArray)
842 _featuresList.clear();
844 for (int i = 0; i < vFeaturesArray.length; i++)
846 this._featuresList.add(vFeaturesArray[i]);
851 * Sets the value of field 'hidden'.
854 * the value of field 'hidden'.
856 public void setHidden(final boolean hidden)
858 this._hidden = hidden;
859 this._has_hidden = true;
866 * @param vHiddenSequences
867 * @throws java.lang.IndexOutOfBoundsException
868 * if the index given is outside the bounds of the collection
870 public void setHiddenSequences(final int index, final int vHiddenSequences)
871 throws java.lang.IndexOutOfBoundsException
873 // check bounds for index
874 if (index < 0 || index >= this._hiddenSequencesList.size())
876 throw new IndexOutOfBoundsException(
877 "setHiddenSequences: Index value '" + index
878 + "' not in range [0.."
879 + (this._hiddenSequencesList.size() - 1) + "]");
882 this._hiddenSequencesList.set(index, new java.lang.Integer(
889 * @param vHiddenSequencesArray
891 public void setHiddenSequences(final int[] vHiddenSequencesArray)
894 _hiddenSequencesList.clear();
896 for (int i = 0; i < vHiddenSequencesArray.length; i++)
898 this._hiddenSequencesList.add(new java.lang.Integer(
899 vHiddenSequencesArray[i]));
904 * Sets the value of field 'id'.
907 * the value of field 'id'.
909 public void setId(final java.lang.String id)
919 * @throws java.lang.IndexOutOfBoundsException
920 * if the index given is outside the bounds of the collection
922 public void setPdbids(final int index,
923 final jalview.schemabinding.version2.Pdbids vPdbids)
924 throws java.lang.IndexOutOfBoundsException
926 // check bounds for index
927 if (index < 0 || index >= this._pdbidsList.size())
929 throw new IndexOutOfBoundsException("setPdbids: Index value '"
930 + index + "' not in range [0.."
931 + (this._pdbidsList.size() - 1) + "]");
934 this._pdbidsList.set(index, vPdbids);
940 * @param vPdbidsArray
942 public void setPdbids(
943 final jalview.schemabinding.version2.Pdbids[] vPdbidsArray)
948 for (int i = 0; i < vPdbidsArray.length; i++)
950 this._pdbidsList.add(vPdbidsArray[i]);
959 * @throws java.lang.IndexOutOfBoundsException
960 * if the index given is outside the bounds of the collection
962 public void setRnaViewer(final int index,
963 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
964 throws java.lang.IndexOutOfBoundsException
966 // check bounds for index
967 if (index < 0 || index >= this._rnaViewerList.size())
969 throw new IndexOutOfBoundsException("setRnaViewer: Index value '"
970 + index + "' not in range [0.."
971 + (this._rnaViewerList.size() - 1) + "]");
974 this._rnaViewerList.set(index, vRnaViewer);
980 * @param vRnaViewerArray
982 public void setRnaViewer(
983 final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray)
986 _rnaViewerList.clear();
988 for (int i = 0; i < vRnaViewerArray.length; i++)
990 this._rnaViewerList.add(vRnaViewerArray[i]);
995 * Sets the value of field 'start'.
998 * the value of field 'start'.
1000 public void setStart(final int start)
1002 this._start = start;
1003 this._has_start = true;
1010 * @throws org.exolab.castor.xml.MarshalException
1011 * if object is null or if any SAXException is thrown during
1013 * @throws org.exolab.castor.xml.ValidationException
1014 * if this object is an invalid instance according to the schema
1015 * @return the unmarshaled jalview.schemabinding.version2.JSeq
1017 public static jalview.schemabinding.version2.JSeq unmarshal(
1018 final java.io.Reader reader)
1019 throws org.exolab.castor.xml.MarshalException,
1020 org.exolab.castor.xml.ValidationException
1022 return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(
1023 jalview.schemabinding.version2.JSeq.class, reader);
1029 * @throws org.exolab.castor.xml.ValidationException
1030 * if this object is an invalid instance according to the schema
1032 public void validate() throws org.exolab.castor.xml.ValidationException
1034 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1035 validator.validate(this);