1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, 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 JSeq implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
52 * keeps track of state for field: _colour
54 private boolean _has_colour;
62 * keeps track of state for field: _start
64 private boolean _has_start;
72 * keeps track of state for field: _end
74 private boolean _has_end;
79 private java.lang.String _id;
84 private boolean _hidden;
87 * keeps track of state for field: _hidden
89 private boolean _has_hidden;
92 * Field _featuresList.
94 private java.util.Vector _featuresList;
99 private java.util.Vector _pdbidsList;
102 * Field _hiddenSequencesList.
104 private java.util.Vector _hiddenSequencesList;
113 this._featuresList = new java.util.Vector();
114 this._pdbidsList = new java.util.Vector();
115 this._hiddenSequencesList = new java.util.Vector();
127 * @throws java.lang.IndexOutOfBoundsException if the index
128 * given is outside the bounds of the collection
130 public void addFeatures(
131 final jalview.schemabinding.version2.Features vFeatures)
132 throws java.lang.IndexOutOfBoundsException {
133 this._featuresList.addElement(vFeatures);
141 * @throws java.lang.IndexOutOfBoundsException if the index
142 * given is outside the bounds of the collection
144 public void addFeatures(
146 final jalview.schemabinding.version2.Features vFeatures)
147 throws java.lang.IndexOutOfBoundsException {
148 this._featuresList.add(index, vFeatures);
154 * @param vHiddenSequences
155 * @throws java.lang.IndexOutOfBoundsException if the index
156 * given is outside the bounds of the collection
158 public void addHiddenSequences(
159 final int vHiddenSequences)
160 throws java.lang.IndexOutOfBoundsException {
161 this._hiddenSequencesList.addElement(new java.lang.Integer(vHiddenSequences));
168 * @param vHiddenSequences
169 * @throws java.lang.IndexOutOfBoundsException if the index
170 * given is outside the bounds of the collection
172 public void addHiddenSequences(
174 final int vHiddenSequences)
175 throws java.lang.IndexOutOfBoundsException {
176 this._hiddenSequencesList.add(index, new java.lang.Integer(vHiddenSequences));
183 * @throws java.lang.IndexOutOfBoundsException if the index
184 * given is outside the bounds of the collection
186 public void addPdbids(
187 final jalview.schemabinding.version2.Pdbids vPdbids)
188 throws java.lang.IndexOutOfBoundsException {
189 this._pdbidsList.addElement(vPdbids);
197 * @throws java.lang.IndexOutOfBoundsException if the index
198 * given is outside the bounds of the collection
200 public void addPdbids(
202 final jalview.schemabinding.version2.Pdbids vPdbids)
203 throws java.lang.IndexOutOfBoundsException {
204 this._pdbidsList.add(index, vPdbids);
209 public void deleteColour(
211 this._has_colour= false;
216 public void deleteEnd(
218 this._has_end= false;
223 public void deleteHidden(
225 this._has_hidden= false;
230 public void deleteStart(
232 this._has_start= false;
236 * Method enumerateFeatures.
238 * @return an Enumeration over all
239 * jalview.schemabinding.version2.Features elements
241 public java.util.Enumeration enumerateFeatures(
243 return this._featuresList.elements();
247 * Method enumerateHiddenSequences.
249 * @return an Enumeration over all int elements
251 public java.util.Enumeration enumerateHiddenSequences(
253 return this._hiddenSequencesList.elements();
257 * Method enumeratePdbids.
259 * @return an Enumeration over all
260 * jalview.schemabinding.version2.Pdbids elements
262 public java.util.Enumeration enumeratePdbids(
264 return this._pdbidsList.elements();
268 * Returns the value of field 'colour'.
270 * @return the value of field 'Colour'.
272 public int getColour(
278 * Returns the value of field 'end'.
280 * @return the value of field 'End'.
288 * Method getFeatures.
291 * @throws java.lang.IndexOutOfBoundsException if the index
292 * given is outside the bounds of the collection
293 * @return the value of the
294 * jalview.schemabinding.version2.Features at the given index
296 public jalview.schemabinding.version2.Features getFeatures(
298 throws java.lang.IndexOutOfBoundsException {
299 // check bounds for index
300 if (index < 0 || index >= this._featuresList.size()) {
301 throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
304 return (jalview.schemabinding.version2.Features) _featuresList.get(index);
308 * Method getFeatures.Returns the contents of the collection in
309 * an Array. <p>Note: Just in case the collection contents
310 * are changing in another thread, we pass a 0-length Array of
311 * the correct type into the API call. This way we <i>know</i>
312 * that the Array returned is of exactly the correct length.
314 * @return this collection as an Array
316 public jalview.schemabinding.version2.Features[] getFeatures(
318 jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
319 return (jalview.schemabinding.version2.Features[]) this._featuresList.toArray(array);
323 * Method getFeaturesCount.
325 * @return the size of this collection
327 public int getFeaturesCount(
329 return this._featuresList.size();
333 * Returns the value of field 'hidden'.
335 * @return the value of field 'Hidden'.
337 public boolean getHidden(
343 * Method getHiddenSequences.
346 * @throws java.lang.IndexOutOfBoundsException if the index
347 * given is outside the bounds of the collection
348 * @return the value of the int at the given index
350 public int getHiddenSequences(
352 throws java.lang.IndexOutOfBoundsException {
353 // check bounds for index
354 if (index < 0 || index >= this._hiddenSequencesList.size()) {
355 throw new IndexOutOfBoundsException("getHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
358 return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
362 * Method getHiddenSequences.Returns the contents of the
363 * collection in an Array.
365 * @return this collection as an Array
367 public int[] getHiddenSequences(
369 int size = this._hiddenSequencesList.size();
370 int[] array = new int[size];
371 java.util.Iterator iter = _hiddenSequencesList.iterator();
372 for (int index = 0; index < size; index++) {
373 array[index] = ((java.lang.Integer) iter.next()).intValue();
379 * Method getHiddenSequencesCount.
381 * @return the size of this collection
383 public int getHiddenSequencesCount(
385 return this._hiddenSequencesList.size();
389 * Returns the value of field 'id'.
391 * @return the value of field 'Id'.
393 public java.lang.String getId(
402 * @throws java.lang.IndexOutOfBoundsException if the index
403 * given is outside the bounds of the collection
404 * @return the value of the
405 * jalview.schemabinding.version2.Pdbids at the given index
407 public jalview.schemabinding.version2.Pdbids getPdbids(
409 throws java.lang.IndexOutOfBoundsException {
410 // check bounds for index
411 if (index < 0 || index >= this._pdbidsList.size()) {
412 throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
415 return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
419 * Method getPdbids.Returns the contents of the collection in
420 * an Array. <p>Note: Just in case the collection contents
421 * are changing in another thread, we pass a 0-length Array of
422 * the correct type into the API call. This way we <i>know</i>
423 * that the Array returned is of exactly the correct length.
425 * @return this collection as an Array
427 public jalview.schemabinding.version2.Pdbids[] getPdbids(
429 jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
430 return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList.toArray(array);
434 * Method getPdbidsCount.
436 * @return the size of this collection
438 public int getPdbidsCount(
440 return this._pdbidsList.size();
444 * Returns the value of field 'start'.
446 * @return the value of field 'Start'.
456 * @return true if at least one Colour has been added
458 public boolean hasColour(
460 return this._has_colour;
466 * @return true if at least one End has been added
468 public boolean hasEnd(
470 return this._has_end;
476 * @return true if at least one Hidden has been added
478 public boolean hasHidden(
480 return this._has_hidden;
486 * @return true if at least one Start has been added
488 public boolean hasStart(
490 return this._has_start;
494 * Returns the value of field 'hidden'.
496 * @return the value of field 'Hidden'.
498 public boolean isHidden(
506 * @return true if this object is valid according to the schema
508 public boolean isValid(
512 } catch (org.exolab.castor.xml.ValidationException vex) {
522 * @throws org.exolab.castor.xml.MarshalException if object is
523 * null or if any SAXException is thrown during marshaling
524 * @throws org.exolab.castor.xml.ValidationException if this
525 * object is an invalid instance according to the schema
528 final java.io.Writer out)
529 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
530 Marshaller.marshal(this, out);
537 * @throws java.io.IOException if an IOException occurs during
539 * @throws org.exolab.castor.xml.ValidationException if this
540 * object is an invalid instance according to the schema
541 * @throws org.exolab.castor.xml.MarshalException if object is
542 * null or if any SAXException is thrown during marshaling
545 final org.xml.sax.ContentHandler handler)
546 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
547 Marshaller.marshal(this, handler);
552 public void removeAllFeatures(
554 this._featuresList.clear();
559 public void removeAllHiddenSequences(
561 this._hiddenSequencesList.clear();
566 public void removeAllPdbids(
568 this._pdbidsList.clear();
572 * Method removeFeatures.
575 * @return true if the object was removed from the collection.
577 public boolean removeFeatures(
578 final jalview.schemabinding.version2.Features vFeatures) {
579 boolean removed = _featuresList.remove(vFeatures);
584 * Method removeFeaturesAt.
587 * @return the element removed from the collection
589 public jalview.schemabinding.version2.Features removeFeaturesAt(
591 java.lang.Object obj = this._featuresList.remove(index);
592 return (jalview.schemabinding.version2.Features) obj;
596 * Method removeHiddenSequences.
598 * @param vHiddenSequences
599 * @return true if the object was removed from the collection.
601 public boolean removeHiddenSequences(
602 final int vHiddenSequences) {
603 boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(vHiddenSequences));
608 * Method removeHiddenSequencesAt.
611 * @return the element removed from the collection
613 public int removeHiddenSequencesAt(
615 java.lang.Object obj = this._hiddenSequencesList.remove(index);
616 return ((java.lang.Integer) obj).intValue();
620 * Method removePdbids.
623 * @return true if the object was removed from the collection.
625 public boolean removePdbids(
626 final jalview.schemabinding.version2.Pdbids vPdbids) {
627 boolean removed = _pdbidsList.remove(vPdbids);
632 * Method removePdbidsAt.
635 * @return the element removed from the collection
637 public jalview.schemabinding.version2.Pdbids removePdbidsAt(
639 java.lang.Object obj = this._pdbidsList.remove(index);
640 return (jalview.schemabinding.version2.Pdbids) obj;
644 * Sets the value of field 'colour'.
646 * @param colour the value of field 'colour'.
648 public void setColour(
650 this._colour = colour;
651 this._has_colour = true;
655 * Sets the value of field 'end'.
657 * @param end the value of field 'end'.
662 this._has_end = true;
670 * @throws java.lang.IndexOutOfBoundsException if the index
671 * given is outside the bounds of the collection
673 public void setFeatures(
675 final jalview.schemabinding.version2.Features vFeatures)
676 throws java.lang.IndexOutOfBoundsException {
677 // check bounds for index
678 if (index < 0 || index >= this._featuresList.size()) {
679 throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
682 this._featuresList.set(index, vFeatures);
688 * @param vFeaturesArray
690 public void setFeatures(
691 final jalview.schemabinding.version2.Features[] vFeaturesArray) {
693 _featuresList.clear();
695 for (int i = 0; i < vFeaturesArray.length; i++) {
696 this._featuresList.add(vFeaturesArray[i]);
701 * Sets the value of field 'hidden'.
703 * @param hidden the value of field 'hidden'.
705 public void setHidden(
706 final boolean hidden) {
707 this._hidden = hidden;
708 this._has_hidden = true;
715 * @param vHiddenSequences
716 * @throws java.lang.IndexOutOfBoundsException if the index
717 * given is outside the bounds of the collection
719 public void setHiddenSequences(
721 final int vHiddenSequences)
722 throws java.lang.IndexOutOfBoundsException {
723 // check bounds for index
724 if (index < 0 || index >= this._hiddenSequencesList.size()) {
725 throw new IndexOutOfBoundsException("setHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
728 this._hiddenSequencesList.set(index, new java.lang.Integer(vHiddenSequences));
734 * @param vHiddenSequencesArray
736 public void setHiddenSequences(
737 final int[] vHiddenSequencesArray) {
739 _hiddenSequencesList.clear();
741 for (int i = 0; i < vHiddenSequencesArray.length; i++) {
742 this._hiddenSequencesList.add(new java.lang.Integer(vHiddenSequencesArray[i]));
747 * Sets the value of field 'id'.
749 * @param id the value of field 'id'.
752 final java.lang.String id) {
761 * @throws java.lang.IndexOutOfBoundsException if the index
762 * given is outside the bounds of the collection
764 public void setPdbids(
766 final jalview.schemabinding.version2.Pdbids vPdbids)
767 throws java.lang.IndexOutOfBoundsException {
768 // check bounds for index
769 if (index < 0 || index >= this._pdbidsList.size()) {
770 throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
773 this._pdbidsList.set(index, vPdbids);
779 * @param vPdbidsArray
781 public void setPdbids(
782 final jalview.schemabinding.version2.Pdbids[] vPdbidsArray) {
786 for (int i = 0; i < vPdbidsArray.length; i++) {
787 this._pdbidsList.add(vPdbidsArray[i]);
792 * Sets the value of field 'start'.
794 * @param start the value of field 'start'.
796 public void setStart(
799 this._has_start = true;
806 * @throws org.exolab.castor.xml.MarshalException if object is
807 * null or if any SAXException is thrown during marshaling
808 * @throws org.exolab.castor.xml.ValidationException if this
809 * object is an invalid instance according to the schema
810 * @return the unmarshaled jalview.schemabinding.version2.JSeq
812 public static jalview.schemabinding.version2.JSeq unmarshal(
813 final java.io.Reader reader)
814 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
815 return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(jalview.schemabinding.version2.JSeq.class, reader);
821 * @throws org.exolab.castor.xml.ValidationException if this
822 * object is an invalid instance according to the schema
824 public void validate(
826 throws org.exolab.castor.xml.ValidationException {
827 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
828 validator.validate(this);