2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
31 * @version $Revision$ $Date$
\r
33 public class JGroup implements java.io.Serializable
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
46 * keeps track of state for field: _start
\r
48 private boolean _has_start;
\r
56 * keeps track of state for field: _end
\r
58 private boolean _has_end;
\r
63 private java.lang.String _name;
\r
68 private java.lang.String _colour;
\r
71 * Field _consThreshold.
\r
73 private int _consThreshold;
\r
76 * keeps track of state for field: _consThreshold
\r
78 private boolean _has_consThreshold;
\r
81 * Field _pidThreshold.
\r
83 private int _pidThreshold;
\r
86 * keeps track of state for field: _pidThreshold
\r
88 private boolean _has_pidThreshold;
\r
91 * Field _outlineColour.
\r
93 private int _outlineColour;
\r
96 * keeps track of state for field: _outlineColour
\r
98 private boolean _has_outlineColour;
\r
101 * Field _displayBoxes.
\r
103 private boolean _displayBoxes;
\r
106 * keeps track of state for field: _displayBoxes
\r
108 private boolean _has_displayBoxes;
\r
111 * Field _displayText.
\r
113 private boolean _displayText;
\r
116 * keeps track of state for field: _displayText
\r
118 private boolean _has_displayText;
\r
121 * Field _colourText.
\r
123 private boolean _colourText;
\r
126 * keeps track of state for field: _colourText
\r
128 private boolean _has_colourText;
\r
133 private int _textCol1;
\r
136 * keeps track of state for field: _textCol1
\r
138 private boolean _has_textCol1;
\r
143 private int _textCol2;
\r
146 * keeps track of state for field: _textCol2
\r
148 private boolean _has_textCol2;
\r
151 * Field _textColThreshold.
\r
153 private int _textColThreshold;
\r
156 * keeps track of state for field: _textColThreshold
\r
158 private boolean _has_textColThreshold;
\r
163 private java.util.Vector _seqList;
\r
165 // ----------------/
\r
166 // - Constructors -/
\r
167 // ----------------/
\r
172 this._seqList = new java.util.Vector();
\r
183 * @throws java.lang.IndexOutOfBoundsException
\r
184 * if the index given is outside the bounds of the collection
\r
186 public void addSeq(final java.lang.String vSeq)
\r
187 throws java.lang.IndexOutOfBoundsException
\r
189 this._seqList.addElement(vSeq);
\r
197 * @throws java.lang.IndexOutOfBoundsException
\r
198 * if the index given is outside the bounds of the collection
\r
200 public void addSeq(final int index, final java.lang.String vSeq)
\r
201 throws java.lang.IndexOutOfBoundsException
\r
203 this._seqList.add(index, vSeq);
\r
208 public void deleteColourText()
\r
210 this._has_colourText = false;
\r
215 public void deleteConsThreshold()
\r
217 this._has_consThreshold = false;
\r
222 public void deleteDisplayBoxes()
\r
224 this._has_displayBoxes = false;
\r
229 public void deleteDisplayText()
\r
231 this._has_displayText = false;
\r
236 public void deleteEnd()
\r
238 this._has_end = false;
\r
243 public void deleteOutlineColour()
\r
245 this._has_outlineColour = false;
\r
250 public void deletePidThreshold()
\r
252 this._has_pidThreshold = false;
\r
257 public void deleteStart()
\r
259 this._has_start = false;
\r
264 public void deleteTextCol1()
\r
266 this._has_textCol1 = false;
\r
271 public void deleteTextCol2()
\r
273 this._has_textCol2 = false;
\r
278 public void deleteTextColThreshold()
\r
280 this._has_textColThreshold = false;
\r
284 * Method enumerateSeq.
\r
286 * @return an Enumeration over all java.lang.String elements
\r
288 public java.util.Enumeration enumerateSeq()
\r
290 return this._seqList.elements();
\r
294 * Returns the value of field 'colour'.
\r
296 * @return the value of field 'Colour'.
\r
298 public java.lang.String getColour()
\r
300 return this._colour;
\r
304 * Returns the value of field 'colourText'.
\r
306 * @return the value of field 'ColourText'.
\r
308 public boolean getColourText()
\r
310 return this._colourText;
\r
314 * Returns the value of field 'consThreshold'.
\r
316 * @return the value of field 'ConsThreshold'.
\r
318 public int getConsThreshold()
\r
320 return this._consThreshold;
\r
324 * Returns the value of field 'displayBoxes'.
\r
326 * @return the value of field 'DisplayBoxes'.
\r
328 public boolean getDisplayBoxes()
\r
330 return this._displayBoxes;
\r
334 * Returns the value of field 'displayText'.
\r
336 * @return the value of field 'DisplayText'.
\r
338 public boolean getDisplayText()
\r
340 return this._displayText;
\r
344 * Returns the value of field 'end'.
\r
346 * @return the value of field 'End'.
\r
348 public int getEnd()
\r
354 * Returns the value of field 'name'.
\r
356 * @return the value of field 'Name'.
\r
358 public java.lang.String getName()
\r
364 * Returns the value of field 'outlineColour'.
\r
366 * @return the value of field 'OutlineColour'.
\r
368 public int getOutlineColour()
\r
370 return this._outlineColour;
\r
374 * Returns the value of field 'pidThreshold'.
\r
376 * @return the value of field 'PidThreshold'.
\r
378 public int getPidThreshold()
\r
380 return this._pidThreshold;
\r
387 * @throws java.lang.IndexOutOfBoundsException
\r
388 * if the index given is outside the bounds of the collection
\r
389 * @return the value of the java.lang.String at the given index
\r
391 public java.lang.String getSeq(final int index)
\r
392 throws java.lang.IndexOutOfBoundsException
\r
394 // check bounds for index
\r
395 if (index < 0 || index >= this._seqList.size())
\r
397 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
\r
398 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
\r
401 return (java.lang.String) _seqList.get(index);
\r
405 * Method getSeq.Returns the contents of the collection in an Array.
\r
407 * Note: Just in case the collection contents are changing in another thread,
\r
408 * we pass a 0-length Array of the correct type into the API call. This way we
\r
409 * <i>know</i> that the Array returned is of exactly the correct length.
\r
411 * @return this collection as an Array
\r
413 public java.lang.String[] getSeq()
\r
415 java.lang.String[] array = new java.lang.String[0];
\r
416 return (java.lang.String[]) this._seqList.toArray(array);
\r
420 * Method getSeqCount.
\r
422 * @return the size of this collection
\r
424 public int getSeqCount()
\r
426 return this._seqList.size();
\r
430 * Returns the value of field 'start'.
\r
432 * @return the value of field 'Start'.
\r
434 public int getStart()
\r
436 return this._start;
\r
440 * Returns the value of field 'textCol1'.
\r
442 * @return the value of field 'TextCol1'.
\r
444 public int getTextCol1()
\r
446 return this._textCol1;
\r
450 * Returns the value of field 'textCol2'.
\r
452 * @return the value of field 'TextCol2'.
\r
454 public int getTextCol2()
\r
456 return this._textCol2;
\r
460 * Returns the value of field 'textColThreshold'.
\r
462 * @return the value of field 'TextColThreshold'.
\r
464 public int getTextColThreshold()
\r
466 return this._textColThreshold;
\r
470 * Method hasColourText.
\r
472 * @return true if at least one ColourText has been added
\r
474 public boolean hasColourText()
\r
476 return this._has_colourText;
\r
480 * Method hasConsThreshold.
\r
482 * @return true if at least one ConsThreshold has been added
\r
484 public boolean hasConsThreshold()
\r
486 return this._has_consThreshold;
\r
490 * Method hasDisplayBoxes.
\r
492 * @return true if at least one DisplayBoxes has been added
\r
494 public boolean hasDisplayBoxes()
\r
496 return this._has_displayBoxes;
\r
500 * Method hasDisplayText.
\r
502 * @return true if at least one DisplayText has been added
\r
504 public boolean hasDisplayText()
\r
506 return this._has_displayText;
\r
512 * @return true if at least one End has been added
\r
514 public boolean hasEnd()
\r
516 return this._has_end;
\r
520 * Method hasOutlineColour.
\r
522 * @return true if at least one OutlineColour has been added
\r
524 public boolean hasOutlineColour()
\r
526 return this._has_outlineColour;
\r
530 * Method hasPidThreshold.
\r
532 * @return true if at least one PidThreshold has been added
\r
534 public boolean hasPidThreshold()
\r
536 return this._has_pidThreshold;
\r
542 * @return true if at least one Start has been added
\r
544 public boolean hasStart()
\r
546 return this._has_start;
\r
550 * Method hasTextCol1.
\r
552 * @return true if at least one TextCol1 has been added
\r
554 public boolean hasTextCol1()
\r
556 return this._has_textCol1;
\r
560 * Method hasTextCol2.
\r
562 * @return true if at least one TextCol2 has been added
\r
564 public boolean hasTextCol2()
\r
566 return this._has_textCol2;
\r
570 * Method hasTextColThreshold.
\r
572 * @return true if at least one TextColThreshold has been added
\r
574 public boolean hasTextColThreshold()
\r
576 return this._has_textColThreshold;
\r
580 * Returns the value of field 'colourText'.
\r
582 * @return the value of field 'ColourText'.
\r
584 public boolean isColourText()
\r
586 return this._colourText;
\r
590 * Returns the value of field 'displayBoxes'.
\r
592 * @return the value of field 'DisplayBoxes'.
\r
594 public boolean isDisplayBoxes()
\r
596 return this._displayBoxes;
\r
600 * Returns the value of field 'displayText'.
\r
602 * @return the value of field 'DisplayText'.
\r
604 public boolean isDisplayText()
\r
606 return this._displayText;
\r
612 * @return true if this object is valid according to the schema
\r
614 public boolean isValid()
\r
619 } catch (org.exolab.castor.xml.ValidationException vex)
\r
630 * @throws org.exolab.castor.xml.MarshalException
\r
631 * if object is null or if any SAXException is thrown during
\r
633 * @throws org.exolab.castor.xml.ValidationException
\r
634 * if this object is an invalid instance according to the
\r
637 public void marshal(final java.io.Writer out)
\r
638 throws org.exolab.castor.xml.MarshalException,
\r
639 org.exolab.castor.xml.ValidationException
\r
641 Marshaller.marshal(this, out);
\r
648 * @throws java.io.IOException
\r
649 * if an IOException occurs during marshaling
\r
650 * @throws org.exolab.castor.xml.ValidationException
\r
651 * if this object is an invalid instance according to the
\r
653 * @throws org.exolab.castor.xml.MarshalException
\r
654 * if object is null or if any SAXException is thrown during
\r
657 public void marshal(final org.xml.sax.ContentHandler handler)
\r
658 throws java.io.IOException,
\r
659 org.exolab.castor.xml.MarshalException,
\r
660 org.exolab.castor.xml.ValidationException
\r
662 Marshaller.marshal(this, handler);
\r
667 public void removeAllSeq()
\r
669 this._seqList.clear();
\r
673 * Method removeSeq.
\r
676 * @return true if the object was removed from the collection.
\r
678 public boolean removeSeq(final java.lang.String vSeq)
\r
680 boolean removed = _seqList.remove(vSeq);
\r
685 * Method removeSeqAt.
\r
688 * @return the element removed from the collection
\r
690 public java.lang.String removeSeqAt(final int index)
\r
692 java.lang.Object obj = this._seqList.remove(index);
\r
693 return (java.lang.String) obj;
\r
697 * Sets the value of field 'colour'.
\r
700 * the value of field 'colour'.
\r
702 public void setColour(final java.lang.String colour)
\r
704 this._colour = colour;
\r
708 * Sets the value of field 'colourText'.
\r
710 * @param colourText
\r
711 * the value of field 'colourText'.
\r
713 public void setColourText(final boolean colourText)
\r
715 this._colourText = colourText;
\r
716 this._has_colourText = true;
\r
720 * Sets the value of field 'consThreshold'.
\r
722 * @param consThreshold
\r
723 * the value of field 'consThreshold'.
\r
725 public void setConsThreshold(final int consThreshold)
\r
727 this._consThreshold = consThreshold;
\r
728 this._has_consThreshold = true;
\r
732 * Sets the value of field 'displayBoxes'.
\r
734 * @param displayBoxes
\r
735 * the value of field 'displayBoxes'.
\r
737 public void setDisplayBoxes(final boolean displayBoxes)
\r
739 this._displayBoxes = displayBoxes;
\r
740 this._has_displayBoxes = true;
\r
744 * Sets the value of field 'displayText'.
\r
746 * @param displayText
\r
747 * the value of field 'displayText'.
\r
749 public void setDisplayText(final boolean displayText)
\r
751 this._displayText = displayText;
\r
752 this._has_displayText = true;
\r
756 * Sets the value of field 'end'.
\r
759 * the value of field 'end'.
\r
761 public void setEnd(final int end)
\r
764 this._has_end = true;
\r
768 * Sets the value of field 'name'.
\r
771 * the value of field 'name'.
\r
773 public void setName(final java.lang.String name)
\r
779 * Sets the value of field 'outlineColour'.
\r
781 * @param outlineColour
\r
782 * the value of field 'outlineColour'.
\r
784 public void setOutlineColour(final int outlineColour)
\r
786 this._outlineColour = outlineColour;
\r
787 this._has_outlineColour = true;
\r
791 * Sets the value of field 'pidThreshold'.
\r
793 * @param pidThreshold
\r
794 * the value of field 'pidThreshold'.
\r
796 public void setPidThreshold(final int pidThreshold)
\r
798 this._pidThreshold = pidThreshold;
\r
799 this._has_pidThreshold = true;
\r
807 * @throws java.lang.IndexOutOfBoundsException
\r
808 * if the index given is outside the bounds of the collection
\r
810 public void setSeq(final int index, final java.lang.String vSeq)
\r
811 throws java.lang.IndexOutOfBoundsException
\r
813 // check bounds for index
\r
814 if (index < 0 || index >= this._seqList.size())
\r
816 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
\r
817 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
\r
820 this._seqList.set(index, vSeq);
\r
828 public void setSeq(final java.lang.String[] vSeqArray)
\r
833 for (int i = 0; i < vSeqArray.length; i++)
\r
835 this._seqList.add(vSeqArray[i]);
\r
840 * Sets the value of field 'start'.
\r
843 * the value of field 'start'.
\r
845 public void setStart(final int start)
\r
847 this._start = start;
\r
848 this._has_start = true;
\r
852 * Sets the value of field 'textCol1'.
\r
855 * the value of field 'textCol1'.
\r
857 public void setTextCol1(final int textCol1)
\r
859 this._textCol1 = textCol1;
\r
860 this._has_textCol1 = true;
\r
864 * Sets the value of field 'textCol2'.
\r
867 * the value of field 'textCol2'.
\r
869 public void setTextCol2(final int textCol2)
\r
871 this._textCol2 = textCol2;
\r
872 this._has_textCol2 = true;
\r
876 * Sets the value of field 'textColThreshold'.
\r
878 * @param textColThreshold
\r
879 * the value of field 'textColThreshold'
\r
881 public void setTextColThreshold(final int textColThreshold)
\r
883 this._textColThreshold = textColThreshold;
\r
884 this._has_textColThreshold = true;
\r
888 * Method unmarshal.
\r
891 * @throws org.exolab.castor.xml.MarshalException
\r
892 * if object is null or if any SAXException is thrown during
\r
894 * @throws org.exolab.castor.xml.ValidationException
\r
895 * if this object is an invalid instance according to the
\r
897 * @return the unmarshaled jalview.schemabinding.version2.JGroup
\r
899 public static jalview.schemabinding.version2.JGroup unmarshal(
\r
900 final java.io.Reader reader)
\r
901 throws org.exolab.castor.xml.MarshalException,
\r
902 org.exolab.castor.xml.ValidationException
\r
904 return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(
\r
905 jalview.schemabinding.version2.JGroup.class, reader);
\r
911 * @throws org.exolab.castor.xml.ValidationException
\r
912 * if this object is an invalid instance according to the
\r
915 public void validate() throws org.exolab.castor.xml.ValidationException
\r
917 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
918 validator.validate(this);
\r