1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) 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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.schemabinding.version2;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
40 * @version $Revision$ $Date$
42 public class JSeq implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
55 * keeps track of state for field: _colour
57 private boolean _has_colour;
65 * keeps track of state for field: _start
67 private boolean _has_start;
75 * keeps track of state for field: _end
77 private boolean _has_end;
82 private java.lang.String _id;
87 private boolean _hidden;
90 * keeps track of state for field: _hidden
92 private boolean _has_hidden;
95 * Field _viewreference.
97 private boolean _viewreference;
100 * keeps track of state for field: _viewreference
102 private boolean _has_viewreference;
105 * Field _featuresList.
107 private java.util.Vector _featuresList;
112 private java.util.Vector _pdbidsList;
115 * Field _hiddenSequencesList.
117 private java.util.Vector _hiddenSequencesList;
120 * Reference to a viewer showing RNA structure for this sequence. Schema
121 * supports one viewer showing multiple annotations for multiple sequences,
122 * though currently only one annotation for one sequence (gapped or trimmed)
126 private java.util.Vector _rnaViewerList;
135 this._featuresList = new java.util.Vector();
136 this._pdbidsList = new java.util.Vector();
137 this._hiddenSequencesList = new java.util.Vector();
138 this._rnaViewerList = new java.util.Vector();
149 * @throws java.lang.IndexOutOfBoundsException
150 * if the index given is outside the bounds of the collection
152 public void addFeatures(
153 final jalview.schemabinding.version2.Features vFeatures)
154 throws java.lang.IndexOutOfBoundsException
156 this._featuresList.addElement(vFeatures);
164 * @throws java.lang.IndexOutOfBoundsException
165 * if the index given is outside the bounds of the collection
167 public void addFeatures(final int index,
168 final jalview.schemabinding.version2.Features vFeatures)
169 throws java.lang.IndexOutOfBoundsException
171 this._featuresList.add(index, vFeatures);
177 * @param vHiddenSequences
178 * @throws java.lang.IndexOutOfBoundsException
179 * if the index given is outside the bounds of the collection
181 public void addHiddenSequences(final int vHiddenSequences)
182 throws java.lang.IndexOutOfBoundsException
184 this._hiddenSequencesList.addElement(new java.lang.Integer(
192 * @param vHiddenSequences
193 * @throws java.lang.IndexOutOfBoundsException
194 * if the index given is outside the bounds of the collection
196 public void addHiddenSequences(final int index, final int vHiddenSequences)
197 throws java.lang.IndexOutOfBoundsException
199 this._hiddenSequencesList.add(index, new java.lang.Integer(
207 * @throws java.lang.IndexOutOfBoundsException
208 * if the index given is outside the bounds of the collection
210 public void addPdbids(final jalview.schemabinding.version2.Pdbids vPdbids)
211 throws java.lang.IndexOutOfBoundsException
213 this._pdbidsList.addElement(vPdbids);
221 * @throws java.lang.IndexOutOfBoundsException
222 * if the index given is outside the bounds of the collection
224 public void addPdbids(final int index,
225 final jalview.schemabinding.version2.Pdbids vPdbids)
226 throws java.lang.IndexOutOfBoundsException
228 this._pdbidsList.add(index, vPdbids);
235 * @throws java.lang.IndexOutOfBoundsException
236 * if the index given is outside the bounds of the collection
238 public void addRnaViewer(
239 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
240 throws java.lang.IndexOutOfBoundsException
242 this._rnaViewerList.addElement(vRnaViewer);
250 * @throws java.lang.IndexOutOfBoundsException
251 * if the index given is outside the bounds of the collection
253 public void addRnaViewer(final int index,
254 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
255 throws java.lang.IndexOutOfBoundsException
257 this._rnaViewerList.add(index, vRnaViewer);
262 public void deleteColour()
264 this._has_colour = false;
269 public void deleteEnd()
271 this._has_end = false;
276 public void deleteHidden()
278 this._has_hidden = false;
283 public void deleteStart()
285 this._has_start = false;
290 public void deleteViewreference()
292 this._has_viewreference = false;
296 * Method enumerateFeatures.
298 * @return an Enumeration over all jalview.schemabinding.version2.Features
301 public java.util.Enumeration enumerateFeatures()
303 return this._featuresList.elements();
307 * Method enumerateHiddenSequences.
309 * @return an Enumeration over all int elements
311 public java.util.Enumeration enumerateHiddenSequences()
313 return this._hiddenSequencesList.elements();
317 * Method enumeratePdbids.
319 * @return an Enumeration over all jalview.schemabinding.version2.Pdbids
322 public java.util.Enumeration enumeratePdbids()
324 return this._pdbidsList.elements();
328 * Method enumerateRnaViewer.
330 * @return an Enumeration over all jalview.schemabinding.version2.RnaViewer
333 public java.util.Enumeration enumerateRnaViewer()
335 return this._rnaViewerList.elements();
339 * Returns the value of field 'colour'.
341 * @return the value of field 'Colour'.
343 public int getColour()
349 * Returns the value of field 'end'.
351 * @return the value of field 'End'.
359 * Method getFeatures.
362 * @throws java.lang.IndexOutOfBoundsException
363 * if the index given is outside the bounds of the collection
364 * @return the value of the jalview.schemabinding.version2.Features at the
367 public jalview.schemabinding.version2.Features getFeatures(final int index)
368 throws java.lang.IndexOutOfBoundsException
370 // check bounds for index
371 if (index < 0 || index >= this._featuresList.size())
373 throw new IndexOutOfBoundsException("getFeatures: Index value '"
374 + index + "' not in range [0.."
375 + (this._featuresList.size() - 1) + "]");
378 return (jalview.schemabinding.version2.Features) _featuresList
383 * Method getFeatures.Returns the contents of the collection in an Array.
385 * Note: Just in case the collection contents are changing in another thread,
386 * we pass a 0-length Array of the correct type into the API call. This way we
387 * <i>know</i> that the Array returned is of exactly the correct length.
389 * @return this collection as an Array
391 public jalview.schemabinding.version2.Features[] getFeatures()
393 jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
394 return (jalview.schemabinding.version2.Features[]) this._featuresList
399 * Method getFeaturesCount.
401 * @return the size of this collection
403 public int getFeaturesCount()
405 return this._featuresList.size();
409 * Returns the value of field 'hidden'.
411 * @return the value of field 'Hidden'.
413 public boolean getHidden()
419 * Method getHiddenSequences.
422 * @throws java.lang.IndexOutOfBoundsException
423 * if the index given is outside the bounds of the collection
424 * @return the value of the int at the given index
426 public int getHiddenSequences(final int index)
427 throws java.lang.IndexOutOfBoundsException
429 // check bounds for index
430 if (index < 0 || index >= this._hiddenSequencesList.size())
432 throw new IndexOutOfBoundsException(
433 "getHiddenSequences: Index value '" + index
434 + "' not in range [0.."
435 + (this._hiddenSequencesList.size() - 1) + "]");
438 return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
442 * Method getHiddenSequences.Returns the contents of the collection in an
445 * @return this collection as an Array
447 public int[] getHiddenSequences()
449 int size = this._hiddenSequencesList.size();
450 int[] array = new int[size];
451 java.util.Iterator iter = _hiddenSequencesList.iterator();
452 for (int index = 0; index < size; index++)
454 array[index] = ((java.lang.Integer) iter.next()).intValue();
460 * Method getHiddenSequencesCount.
462 * @return the size of this collection
464 public int getHiddenSequencesCount()
466 return this._hiddenSequencesList.size();
470 * Returns the value of field 'id'.
472 * @return the value of field 'Id'.
474 public java.lang.String getId()
483 * @throws java.lang.IndexOutOfBoundsException
484 * if the index given is outside the bounds of the collection
485 * @return the value of the jalview.schemabinding.version2.Pdbids at the given
488 public jalview.schemabinding.version2.Pdbids getPdbids(final int index)
489 throws java.lang.IndexOutOfBoundsException
491 // check bounds for index
492 if (index < 0 || index >= this._pdbidsList.size())
494 throw new IndexOutOfBoundsException("getPdbids: Index value '"
495 + index + "' not in range [0.."
496 + (this._pdbidsList.size() - 1) + "]");
499 return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
503 * Method getPdbids.Returns the contents of the collection in an Array.
505 * Note: Just in case the collection contents are changing in another thread,
506 * we pass a 0-length Array of the correct type into the API call. This way we
507 * <i>know</i> that the Array returned is of exactly the correct length.
509 * @return this collection as an Array
511 public jalview.schemabinding.version2.Pdbids[] getPdbids()
513 jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
514 return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList
519 * Method getPdbidsCount.
521 * @return the size of this collection
523 public int getPdbidsCount()
525 return this._pdbidsList.size();
529 * Method getRnaViewer.
532 * @throws java.lang.IndexOutOfBoundsException
533 * if the index given is outside the bounds of the collection
534 * @return the value of the jalview.schemabinding.version2.RnaViewer at the
537 public jalview.schemabinding.version2.RnaViewer getRnaViewer(
538 final int index) throws java.lang.IndexOutOfBoundsException
540 // check bounds for index
541 if (index < 0 || index >= this._rnaViewerList.size())
543 throw new IndexOutOfBoundsException("getRnaViewer: Index value '"
544 + index + "' not in range [0.."
545 + (this._rnaViewerList.size() - 1) + "]");
548 return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList
553 * Method getRnaViewer.Returns the contents of the collection in an Array.
555 * Note: Just in case the collection contents are changing in another thread,
556 * we pass a 0-length Array of the correct type into the API call. This way we
557 * <i>know</i> that the Array returned is of exactly the correct length.
559 * @return this collection as an Array
561 public jalview.schemabinding.version2.RnaViewer[] getRnaViewer()
563 jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0];
564 return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList
569 * Method getRnaViewerCount.
571 * @return the size of this collection
573 public int getRnaViewerCount()
575 return this._rnaViewerList.size();
579 * Returns the value of field 'start'.
581 * @return the value of field 'Start'.
583 public int getStart()
589 * Returns the value of field 'viewreference'.
591 * @return the value of field 'Viewreference'.
593 public boolean getViewreference()
595 return this._viewreference;
601 * @return true if at least one Colour has been added
603 public boolean hasColour()
605 return this._has_colour;
611 * @return true if at least one End has been added
613 public boolean hasEnd()
615 return this._has_end;
621 * @return true if at least one Hidden has been added
623 public boolean hasHidden()
625 return this._has_hidden;
631 * @return true if at least one Start has been added
633 public boolean hasStart()
635 return this._has_start;
639 * Method hasViewreference.
641 * @return true if at least one Viewreference has been added
643 public boolean hasViewreference()
645 return this._has_viewreference;
649 * Returns the value of field 'hidden'.
651 * @return the value of field 'Hidden'.
653 public boolean isHidden()
661 * @return true if this object is valid according to the schema
663 public boolean isValid()
668 } catch (org.exolab.castor.xml.ValidationException vex)
676 * Returns the value of field 'viewreference'.
678 * @return the value of field 'Viewreference'.
680 public boolean isViewreference()
682 return this._viewreference;
689 * @throws org.exolab.castor.xml.MarshalException
690 * if object is null or if any SAXException is thrown during
692 * @throws org.exolab.castor.xml.ValidationException
693 * if this object is an invalid instance according to the schema
695 public void marshal(final java.io.Writer out)
696 throws org.exolab.castor.xml.MarshalException,
697 org.exolab.castor.xml.ValidationException
699 Marshaller.marshal(this, out);
706 * @throws java.io.IOException
707 * if an IOException occurs during marshaling
708 * @throws org.exolab.castor.xml.ValidationException
709 * if this object is an invalid instance according to the schema
710 * @throws org.exolab.castor.xml.MarshalException
711 * if object is null or if any SAXException is thrown during
714 public void marshal(final org.xml.sax.ContentHandler handler)
715 throws java.io.IOException,
716 org.exolab.castor.xml.MarshalException,
717 org.exolab.castor.xml.ValidationException
719 Marshaller.marshal(this, handler);
724 public void removeAllFeatures()
726 this._featuresList.clear();
731 public void removeAllHiddenSequences()
733 this._hiddenSequencesList.clear();
738 public void removeAllPdbids()
740 this._pdbidsList.clear();
745 public void removeAllRnaViewer()
747 this._rnaViewerList.clear();
751 * Method removeFeatures.
754 * @return true if the object was removed from the collection.
756 public boolean removeFeatures(
757 final jalview.schemabinding.version2.Features vFeatures)
759 boolean removed = _featuresList.remove(vFeatures);
764 * Method removeFeaturesAt.
767 * @return the element removed from the collection
769 public jalview.schemabinding.version2.Features removeFeaturesAt(
772 java.lang.Object obj = this._featuresList.remove(index);
773 return (jalview.schemabinding.version2.Features) obj;
777 * Method removeHiddenSequences.
779 * @param vHiddenSequences
780 * @return true if the object was removed from the collection.
782 public boolean removeHiddenSequences(final int vHiddenSequences)
784 boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(
790 * Method removeHiddenSequencesAt.
793 * @return the element removed from the collection
795 public int removeHiddenSequencesAt(final int index)
797 java.lang.Object obj = this._hiddenSequencesList.remove(index);
798 return ((java.lang.Integer) obj).intValue();
802 * Method removePdbids.
805 * @return true if the object was removed from the collection.
807 public boolean removePdbids(
808 final jalview.schemabinding.version2.Pdbids vPdbids)
810 boolean removed = _pdbidsList.remove(vPdbids);
815 * Method removePdbidsAt.
818 * @return the element removed from the collection
820 public jalview.schemabinding.version2.Pdbids removePdbidsAt(
823 java.lang.Object obj = this._pdbidsList.remove(index);
824 return (jalview.schemabinding.version2.Pdbids) obj;
828 * Method removeRnaViewer.
831 * @return true if the object was removed from the collection.
833 public boolean removeRnaViewer(
834 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
836 boolean removed = _rnaViewerList.remove(vRnaViewer);
841 * Method removeRnaViewerAt.
844 * @return the element removed from the collection
846 public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt(
849 java.lang.Object obj = this._rnaViewerList.remove(index);
850 return (jalview.schemabinding.version2.RnaViewer) obj;
854 * Sets the value of field 'colour'.
857 * the value of field 'colour'.
859 public void setColour(final int colour)
861 this._colour = colour;
862 this._has_colour = true;
866 * Sets the value of field 'end'.
869 * the value of field 'end'.
871 public void setEnd(final int end)
874 this._has_end = true;
882 * @throws java.lang.IndexOutOfBoundsException
883 * if the index given is outside the bounds of the collection
885 public void setFeatures(final int index,
886 final jalview.schemabinding.version2.Features vFeatures)
887 throws java.lang.IndexOutOfBoundsException
889 // check bounds for index
890 if (index < 0 || index >= this._featuresList.size())
892 throw new IndexOutOfBoundsException("setFeatures: Index value '"
893 + index + "' not in range [0.."
894 + (this._featuresList.size() - 1) + "]");
897 this._featuresList.set(index, vFeatures);
903 * @param vFeaturesArray
905 public void setFeatures(
906 final jalview.schemabinding.version2.Features[] vFeaturesArray)
909 _featuresList.clear();
911 for (int i = 0; i < vFeaturesArray.length; i++)
913 this._featuresList.add(vFeaturesArray[i]);
918 * Sets the value of field 'hidden'.
921 * the value of field 'hidden'.
923 public void setHidden(final boolean hidden)
925 this._hidden = hidden;
926 this._has_hidden = true;
933 * @param vHiddenSequences
934 * @throws java.lang.IndexOutOfBoundsException
935 * if the index given is outside the bounds of the collection
937 public void setHiddenSequences(final int index, final int vHiddenSequences)
938 throws java.lang.IndexOutOfBoundsException
940 // check bounds for index
941 if (index < 0 || index >= this._hiddenSequencesList.size())
943 throw new IndexOutOfBoundsException(
944 "setHiddenSequences: Index value '" + index
945 + "' not in range [0.."
946 + (this._hiddenSequencesList.size() - 1) + "]");
949 this._hiddenSequencesList.set(index, new java.lang.Integer(
956 * @param vHiddenSequencesArray
958 public void setHiddenSequences(final int[] vHiddenSequencesArray)
961 _hiddenSequencesList.clear();
963 for (int i = 0; i < vHiddenSequencesArray.length; i++)
965 this._hiddenSequencesList.add(new java.lang.Integer(
966 vHiddenSequencesArray[i]));
971 * Sets the value of field 'id'.
974 * the value of field 'id'.
976 public void setId(final java.lang.String id)
986 * @throws java.lang.IndexOutOfBoundsException
987 * if the index given is outside the bounds of the collection
989 public void setPdbids(final int index,
990 final jalview.schemabinding.version2.Pdbids vPdbids)
991 throws java.lang.IndexOutOfBoundsException
993 // check bounds for index
994 if (index < 0 || index >= this._pdbidsList.size())
996 throw new IndexOutOfBoundsException("setPdbids: Index value '"
997 + index + "' not in range [0.."
998 + (this._pdbidsList.size() - 1) + "]");
1001 this._pdbidsList.set(index, vPdbids);
1007 * @param vPdbidsArray
1009 public void setPdbids(
1010 final jalview.schemabinding.version2.Pdbids[] vPdbidsArray)
1013 _pdbidsList.clear();
1015 for (int i = 0; i < vPdbidsArray.length; i++)
1017 this._pdbidsList.add(vPdbidsArray[i]);
1026 * @throws java.lang.IndexOutOfBoundsException
1027 * if the index given is outside the bounds of the collection
1029 public void setRnaViewer(final int index,
1030 final jalview.schemabinding.version2.RnaViewer vRnaViewer)
1031 throws java.lang.IndexOutOfBoundsException
1033 // check bounds for index
1034 if (index < 0 || index >= this._rnaViewerList.size())
1036 throw new IndexOutOfBoundsException("setRnaViewer: Index value '"
1037 + index + "' not in range [0.."
1038 + (this._rnaViewerList.size() - 1) + "]");
1041 this._rnaViewerList.set(index, vRnaViewer);
1047 * @param vRnaViewerArray
1049 public void setRnaViewer(
1050 final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray)
1053 _rnaViewerList.clear();
1055 for (int i = 0; i < vRnaViewerArray.length; i++)
1057 this._rnaViewerList.add(vRnaViewerArray[i]);
1062 * Sets the value of field 'start'.
1065 * the value of field 'start'.
1067 public void setStart(final int start)
1069 this._start = start;
1070 this._has_start = true;
1074 * Sets the value of field 'viewreference'.
1076 * @param viewreference
1077 * the value of field 'viewreference'.
1079 public void setViewreference(final boolean viewreference)
1081 this._viewreference = viewreference;
1082 this._has_viewreference = true;
1089 * @throws org.exolab.castor.xml.MarshalException
1090 * if object is null or if any SAXException is thrown during
1092 * @throws org.exolab.castor.xml.ValidationException
1093 * if this object is an invalid instance according to the schema
1094 * @return the unmarshaled jalview.schemabinding.version2.JSeq
1096 public static jalview.schemabinding.version2.JSeq unmarshal(
1097 final java.io.Reader reader)
1098 throws org.exolab.castor.xml.MarshalException,
1099 org.exolab.castor.xml.ValidationException
1101 return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(
1102 jalview.schemabinding.version2.JSeq.class, reader);
1108 * @throws org.exolab.castor.xml.ValidationException
1109 * if this object is an invalid instance according to the schema
1111 public void validate() throws org.exolab.castor.xml.ValidationException
1113 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1114 validator.validate(this);