2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
\r
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemabinding.version2;
\r
20 //---------------------------------/
\r
21 //- Imported classes and packages -/
\r
22 //---------------------------------/
\r
24 import org.exolab.castor.xml.Marshaller;
\r
25 import org.exolab.castor.xml.Unmarshaller;
\r
30 * @version $Revision$ $Date$
\r
32 public class JGroup implements java.io.Serializable
\r
35 // --------------------------/
\r
36 // - Class/Member Variables -/
\r
37 // --------------------------/
\r
45 * keeps track of state for field: _start
\r
47 private boolean _has_start;
\r
55 * keeps track of state for field: _end
\r
57 private boolean _has_end;
\r
62 private java.lang.String _name;
\r
67 private java.lang.String _colour;
\r
70 * Field _consThreshold.
\r
72 private int _consThreshold;
\r
75 * keeps track of state for field: _consThreshold
\r
77 private boolean _has_consThreshold;
\r
80 * Field _pidThreshold.
\r
82 private int _pidThreshold;
\r
85 * keeps track of state for field: _pidThreshold
\r
87 private boolean _has_pidThreshold;
\r
90 * Field _outlineColour.
\r
92 private int _outlineColour;
\r
95 * keeps track of state for field: _outlineColour
\r
97 private boolean _has_outlineColour;
\r
100 * Field _displayBoxes.
\r
102 private boolean _displayBoxes;
\r
105 * keeps track of state for field: _displayBoxes
\r
107 private boolean _has_displayBoxes;
\r
110 * Field _displayText.
\r
112 private boolean _displayText;
\r
115 * keeps track of state for field: _displayText
\r
117 private boolean _has_displayText;
\r
120 * Field _colourText.
\r
122 private boolean _colourText;
\r
125 * keeps track of state for field: _colourText
\r
127 private boolean _has_colourText;
\r
132 private int _textCol1;
\r
135 * keeps track of state for field: _textCol1
\r
137 private boolean _has_textCol1;
\r
142 private int _textCol2;
\r
145 * keeps track of state for field: _textCol2
\r
147 private boolean _has_textCol2;
\r
150 * Field _textColThreshold.
\r
152 private int _textColThreshold;
\r
155 * keeps track of state for field: _textColThreshold
\r
157 private boolean _has_textColThreshold;
\r
160 * Field _showUnconserved.
\r
162 private boolean _showUnconserved;
\r
165 * keeps track of state for field: _showUnconserved
\r
167 private boolean _has_showUnconserved;
\r
170 * Field _ignoreGapsinConsensus.
\r
172 private boolean _ignoreGapsinConsensus = true;
\r
175 * keeps track of state for field: _ignoreGapsinConsensus
\r
177 private boolean _has_ignoreGapsinConsensus;
\r
180 * Field _showConsensusHistogram.
\r
182 private boolean _showConsensusHistogram = true;
\r
185 * keeps track of state for field: _showConsensusHistogram
\r
187 private boolean _has_showConsensusHistogram;
\r
190 * Field _showSequenceLogo.
\r
192 private boolean _showSequenceLogo = false;
\r
195 * keeps track of state for field: _showSequenceLogo
\r
197 private boolean _has_showSequenceLogo;
\r
200 * Optional sequence group ID (only needs to be unique for this alignment)
\r
203 private java.lang.String _id;
\r
208 private java.util.Vector _seqList;
\r
210 // ----------------/
\r
211 // - Constructors -/
\r
212 // ----------------/
\r
217 this._seqList = new java.util.Vector();
\r
228 * @throws java.lang.IndexOutOfBoundsException
\r
229 * if the index given is outside the bounds of the collection
\r
231 public void addSeq(final java.lang.String vSeq)
\r
232 throws java.lang.IndexOutOfBoundsException
\r
234 this._seqList.addElement(vSeq);
\r
242 * @throws java.lang.IndexOutOfBoundsException
\r
243 * if the index given is outside the bounds of the collection
\r
245 public void addSeq(final int index, final java.lang.String vSeq)
\r
246 throws java.lang.IndexOutOfBoundsException
\r
248 this._seqList.add(index, vSeq);
\r
253 public void deleteColourText()
\r
255 this._has_colourText = false;
\r
260 public void deleteConsThreshold()
\r
262 this._has_consThreshold = false;
\r
267 public void deleteDisplayBoxes()
\r
269 this._has_displayBoxes = false;
\r
274 public void deleteDisplayText()
\r
276 this._has_displayText = false;
\r
281 public void deleteEnd()
\r
283 this._has_end = false;
\r
288 public void deleteIgnoreGapsinConsensus()
\r
290 this._has_ignoreGapsinConsensus = false;
\r
295 public void deleteOutlineColour()
\r
297 this._has_outlineColour = false;
\r
302 public void deletePidThreshold()
\r
304 this._has_pidThreshold = false;
\r
309 public void deleteShowConsensusHistogram()
\r
311 this._has_showConsensusHistogram = false;
\r
316 public void deleteShowSequenceLogo()
\r
318 this._has_showSequenceLogo = false;
\r
323 public void deleteShowUnconserved()
\r
325 this._has_showUnconserved = false;
\r
330 public void deleteStart()
\r
332 this._has_start = false;
\r
337 public void deleteTextCol1()
\r
339 this._has_textCol1 = false;
\r
344 public void deleteTextCol2()
\r
346 this._has_textCol2 = false;
\r
351 public void deleteTextColThreshold()
\r
353 this._has_textColThreshold = false;
\r
357 * Method enumerateSeq.
\r
359 * @return an Enumeration over all java.lang.String elements
\r
361 public java.util.Enumeration enumerateSeq()
\r
363 return this._seqList.elements();
\r
367 * Returns the value of field 'colour'.
\r
369 * @return the value of field 'Colour'.
\r
371 public java.lang.String getColour()
\r
373 return this._colour;
\r
377 * Returns the value of field 'colourText'.
\r
379 * @return the value of field 'ColourText'.
\r
381 public boolean getColourText()
\r
383 return this._colourText;
\r
387 * Returns the value of field 'consThreshold'.
\r
389 * @return the value of field 'ConsThreshold'.
\r
391 public int getConsThreshold()
\r
393 return this._consThreshold;
\r
397 * Returns the value of field 'displayBoxes'.
\r
399 * @return the value of field 'DisplayBoxes'.
\r
401 public boolean getDisplayBoxes()
\r
403 return this._displayBoxes;
\r
407 * Returns the value of field 'displayText'.
\r
409 * @return the value of field 'DisplayText'.
\r
411 public boolean getDisplayText()
\r
413 return this._displayText;
\r
417 * Returns the value of field 'end'.
\r
419 * @return the value of field 'End'.
\r
421 public int getEnd()
\r
427 * Returns the value of field 'id'. The field 'id' has the following
\r
428 * description: Optional sequence group ID (only needs to be unique for this
\r
432 * @return the value of field 'Id'.
\r
434 public java.lang.String getId()
\r
440 * Returns the value of field 'ignoreGapsinConsensus'.
\r
442 * @return the value of field 'IgnoreGapsinConsensus'.
\r
444 public boolean getIgnoreGapsinConsensus()
\r
446 return this._ignoreGapsinConsensus;
\r
450 * Returns the value of field 'name'.
\r
452 * @return the value of field 'Name'.
\r
454 public java.lang.String getName()
\r
460 * Returns the value of field 'outlineColour'.
\r
462 * @return the value of field 'OutlineColour'.
\r
464 public int getOutlineColour()
\r
466 return this._outlineColour;
\r
470 * Returns the value of field 'pidThreshold'.
\r
472 * @return the value of field 'PidThreshold'.
\r
474 public int getPidThreshold()
\r
476 return this._pidThreshold;
\r
483 * @throws java.lang.IndexOutOfBoundsException
\r
484 * if the index given is outside the bounds of the collection
\r
485 * @return the value of the java.lang.String at the given index
\r
487 public java.lang.String getSeq(final int index)
\r
488 throws java.lang.IndexOutOfBoundsException
\r
490 // check bounds for index
\r
491 if (index < 0 || index >= this._seqList.size())
\r
493 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
\r
494 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
\r
497 return (java.lang.String) _seqList.get(index);
\r
501 * Method getSeq.Returns the contents of the collection in an Array.
\r
503 * Note: Just in case the collection contents are changing in another thread,
\r
504 * we pass a 0-length Array of the correct type into the API call. This way we
\r
505 * <i>know</i> that the Array returned is of exactly the correct length.
\r
507 * @return this collection as an Array
\r
509 public java.lang.String[] getSeq()
\r
511 java.lang.String[] array = new java.lang.String[0];
\r
512 return (java.lang.String[]) this._seqList.toArray(array);
\r
516 * Method getSeqCount.
\r
518 * @return the size of this collection
\r
520 public int getSeqCount()
\r
522 return this._seqList.size();
\r
526 * Returns the value of field 'showConsensusHistogram'.
\r
528 * @return the value of field 'ShowConsensusHistogram'.
\r
530 public boolean getShowConsensusHistogram()
\r
532 return this._showConsensusHistogram;
\r
536 * Returns the value of field 'showSequenceLogo'.
\r
538 * @return the value of field 'ShowSequenceLogo'.
\r
540 public boolean getShowSequenceLogo()
\r
542 return this._showSequenceLogo;
\r
546 * Returns the value of field 'showUnconserved'.
\r
548 * @return the value of field 'ShowUnconserved'.
\r
550 public boolean getShowUnconserved()
\r
552 return this._showUnconserved;
\r
556 * Returns the value of field 'start'.
\r
558 * @return the value of field 'Start'.
\r
560 public int getStart()
\r
562 return this._start;
\r
566 * Returns the value of field 'textCol1'.
\r
568 * @return the value of field 'TextCol1'.
\r
570 public int getTextCol1()
\r
572 return this._textCol1;
\r
576 * Returns the value of field 'textCol2'.
\r
578 * @return the value of field 'TextCol2'.
\r
580 public int getTextCol2()
\r
582 return this._textCol2;
\r
586 * Returns the value of field 'textColThreshold'.
\r
588 * @return the value of field 'TextColThreshold'.
\r
590 public int getTextColThreshold()
\r
592 return this._textColThreshold;
\r
596 * Method hasColourText.
\r
598 * @return true if at least one ColourText has been added
\r
600 public boolean hasColourText()
\r
602 return this._has_colourText;
\r
606 * Method hasConsThreshold.
\r
608 * @return true if at least one ConsThreshold has been added
\r
610 public boolean hasConsThreshold()
\r
612 return this._has_consThreshold;
\r
616 * Method hasDisplayBoxes.
\r
618 * @return true if at least one DisplayBoxes has been added
\r
620 public boolean hasDisplayBoxes()
\r
622 return this._has_displayBoxes;
\r
626 * Method hasDisplayText.
\r
628 * @return true if at least one DisplayText has been added
\r
630 public boolean hasDisplayText()
\r
632 return this._has_displayText;
\r
638 * @return true if at least one End has been added
\r
640 public boolean hasEnd()
\r
642 return this._has_end;
\r
646 * Method hasIgnoreGapsinConsensus.
\r
648 * @return true if at least one IgnoreGapsinConsensus has been added
\r
650 public boolean hasIgnoreGapsinConsensus()
\r
652 return this._has_ignoreGapsinConsensus;
\r
656 * Method hasOutlineColour.
\r
658 * @return true if at least one OutlineColour has been added
\r
660 public boolean hasOutlineColour()
\r
662 return this._has_outlineColour;
\r
666 * Method hasPidThreshold.
\r
668 * @return true if at least one PidThreshold has been added
\r
670 public boolean hasPidThreshold()
\r
672 return this._has_pidThreshold;
\r
676 * Method hasShowConsensusHistogram.
\r
678 * @return true if at least one ShowConsensusHistogram has been added
\r
680 public boolean hasShowConsensusHistogram()
\r
682 return this._has_showConsensusHistogram;
\r
686 * Method hasShowSequenceLogo.
\r
688 * @return true if at least one ShowSequenceLogo has been added
\r
690 public boolean hasShowSequenceLogo()
\r
692 return this._has_showSequenceLogo;
\r
696 * Method hasShowUnconserved.
\r
698 * @return true if at least one ShowUnconserved has been added
\r
700 public boolean hasShowUnconserved()
\r
702 return this._has_showUnconserved;
\r
708 * @return true if at least one Start has been added
\r
710 public boolean hasStart()
\r
712 return this._has_start;
\r
716 * Method hasTextCol1.
\r
718 * @return true if at least one TextCol1 has been added
\r
720 public boolean hasTextCol1()
\r
722 return this._has_textCol1;
\r
726 * Method hasTextCol2.
\r
728 * @return true if at least one TextCol2 has been added
\r
730 public boolean hasTextCol2()
\r
732 return this._has_textCol2;
\r
736 * Method hasTextColThreshold.
\r
738 * @return true if at least one TextColThreshold has been added
\r
740 public boolean hasTextColThreshold()
\r
742 return this._has_textColThreshold;
\r
746 * Returns the value of field 'colourText'.
\r
748 * @return the value of field 'ColourText'.
\r
750 public boolean isColourText()
\r
752 return this._colourText;
\r
756 * Returns the value of field 'displayBoxes'.
\r
758 * @return the value of field 'DisplayBoxes'.
\r
760 public boolean isDisplayBoxes()
\r
762 return this._displayBoxes;
\r
766 * Returns the value of field 'displayText'.
\r
768 * @return the value of field 'DisplayText'.
\r
770 public boolean isDisplayText()
\r
772 return this._displayText;
\r
776 * Returns the value of field 'ignoreGapsinConsensus'.
\r
778 * @return the value of field 'IgnoreGapsinConsensus'.
\r
780 public boolean isIgnoreGapsinConsensus()
\r
782 return this._ignoreGapsinConsensus;
\r
786 * Returns the value of field 'showConsensusHistogram'.
\r
788 * @return the value of field 'ShowConsensusHistogram'.
\r
790 public boolean isShowConsensusHistogram()
\r
792 return this._showConsensusHistogram;
\r
796 * Returns the value of field 'showSequenceLogo'.
\r
798 * @return the value of field 'ShowSequenceLogo'.
\r
800 public boolean isShowSequenceLogo()
\r
802 return this._showSequenceLogo;
\r
806 * Returns the value of field 'showUnconserved'.
\r
808 * @return the value of field 'ShowUnconserved'.
\r
810 public boolean isShowUnconserved()
\r
812 return this._showUnconserved;
\r
818 * @return true if this object is valid according to the schema
\r
820 public boolean isValid()
\r
825 } catch (org.exolab.castor.xml.ValidationException vex)
\r
836 * @throws org.exolab.castor.xml.MarshalException
\r
837 * if object is null or if any SAXException is thrown during
\r
839 * @throws org.exolab.castor.xml.ValidationException
\r
840 * if this object is an invalid instance according to the schema
\r
842 public void marshal(final java.io.Writer out)
\r
843 throws org.exolab.castor.xml.MarshalException,
\r
844 org.exolab.castor.xml.ValidationException
\r
846 Marshaller.marshal(this, out);
\r
853 * @throws java.io.IOException
\r
854 * if an IOException occurs during marshaling
\r
855 * @throws org.exolab.castor.xml.ValidationException
\r
856 * if this object is an invalid instance according to the schema
\r
857 * @throws org.exolab.castor.xml.MarshalException
\r
858 * if object is null or if any SAXException is thrown during
\r
861 public void marshal(final org.xml.sax.ContentHandler handler)
\r
862 throws java.io.IOException,
\r
863 org.exolab.castor.xml.MarshalException,
\r
864 org.exolab.castor.xml.ValidationException
\r
866 Marshaller.marshal(this, handler);
\r
871 public void removeAllSeq()
\r
873 this._seqList.clear();
\r
877 * Method removeSeq.
\r
880 * @return true if the object was removed from the collection.
\r
882 public boolean removeSeq(final java.lang.String vSeq)
\r
884 boolean removed = _seqList.remove(vSeq);
\r
889 * Method removeSeqAt.
\r
892 * @return the element removed from the collection
\r
894 public java.lang.String removeSeqAt(final int index)
\r
896 java.lang.Object obj = this._seqList.remove(index);
\r
897 return (java.lang.String) obj;
\r
901 * Sets the value of field 'colour'.
\r
904 * the value of field 'colour'.
\r
906 public void setColour(final java.lang.String colour)
\r
908 this._colour = colour;
\r
912 * Sets the value of field 'colourText'.
\r
914 * @param colourText
\r
915 * the value of field 'colourText'.
\r
917 public void setColourText(final boolean colourText)
\r
919 this._colourText = colourText;
\r
920 this._has_colourText = true;
\r
924 * Sets the value of field 'consThreshold'.
\r
926 * @param consThreshold
\r
927 * the value of field 'consThreshold'.
\r
929 public void setConsThreshold(final int consThreshold)
\r
931 this._consThreshold = consThreshold;
\r
932 this._has_consThreshold = true;
\r
936 * Sets the value of field 'displayBoxes'.
\r
938 * @param displayBoxes
\r
939 * the value of field 'displayBoxes'.
\r
941 public void setDisplayBoxes(final boolean displayBoxes)
\r
943 this._displayBoxes = displayBoxes;
\r
944 this._has_displayBoxes = true;
\r
948 * Sets the value of field 'displayText'.
\r
950 * @param displayText
\r
951 * the value of field 'displayText'.
\r
953 public void setDisplayText(final boolean displayText)
\r
955 this._displayText = displayText;
\r
956 this._has_displayText = true;
\r
960 * Sets the value of field 'end'.
\r
963 * the value of field 'end'.
\r
965 public void setEnd(final int end)
\r
968 this._has_end = true;
\r
972 * Sets the value of field 'id'. The field 'id' has the following description:
\r
973 * Optional sequence group ID (only needs to be unique for this alignment)
\r
977 * the value of field 'id'.
\r
979 public void setId(final java.lang.String id)
\r
985 * Sets the value of field 'ignoreGapsinConsensus'.
\r
987 * @param ignoreGapsinConsensus
\r
988 * the value of field 'ignoreGapsinConsensus'.
\r
990 public void setIgnoreGapsinConsensus(final boolean ignoreGapsinConsensus)
\r
992 this._ignoreGapsinConsensus = ignoreGapsinConsensus;
\r
993 this._has_ignoreGapsinConsensus = true;
\r
997 * Sets the value of field 'name'.
\r
1000 * the value of field 'name'.
\r
1002 public void setName(final java.lang.String name)
\r
1004 this._name = name;
\r
1008 * Sets the value of field 'outlineColour'.
\r
1010 * @param outlineColour
\r
1011 * the value of field 'outlineColour'.
\r
1013 public void setOutlineColour(final int outlineColour)
\r
1015 this._outlineColour = outlineColour;
\r
1016 this._has_outlineColour = true;
\r
1020 * Sets the value of field 'pidThreshold'.
\r
1022 * @param pidThreshold
\r
1023 * the value of field 'pidThreshold'.
\r
1025 public void setPidThreshold(final int pidThreshold)
\r
1027 this._pidThreshold = pidThreshold;
\r
1028 this._has_pidThreshold = true;
\r
1036 * @throws java.lang.IndexOutOfBoundsException
\r
1037 * if the index given is outside the bounds of the collection
\r
1039 public void setSeq(final int index, final java.lang.String vSeq)
\r
1040 throws java.lang.IndexOutOfBoundsException
\r
1042 // check bounds for index
\r
1043 if (index < 0 || index >= this._seqList.size())
\r
1045 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
\r
1046 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
\r
1049 this._seqList.set(index, vSeq);
\r
1055 * @param vSeqArray
\r
1057 public void setSeq(final java.lang.String[] vSeqArray)
\r
1062 for (int i = 0; i < vSeqArray.length; i++)
\r
1064 this._seqList.add(vSeqArray[i]);
\r
1069 * Sets the value of field 'showConsensusHistogram'.
\r
1071 * @param showConsensusHistogram
\r
1072 * the value of field 'showConsensusHistogram'.
\r
1074 public void setShowConsensusHistogram(final boolean showConsensusHistogram)
\r
1076 this._showConsensusHistogram = showConsensusHistogram;
\r
1077 this._has_showConsensusHistogram = true;
\r
1081 * Sets the value of field 'showSequenceLogo'.
\r
1083 * @param showSequenceLogo
\r
1084 * the value of field 'showSequenceLogo'
\r
1086 public void setShowSequenceLogo(final boolean showSequenceLogo)
\r
1088 this._showSequenceLogo = showSequenceLogo;
\r
1089 this._has_showSequenceLogo = true;
\r
1093 * Sets the value of field 'showUnconserved'.
\r
1095 * @param showUnconserved
\r
1096 * the value of field 'showUnconserved'.
\r
1098 public void setShowUnconserved(final boolean showUnconserved)
\r
1100 this._showUnconserved = showUnconserved;
\r
1101 this._has_showUnconserved = true;
\r
1105 * Sets the value of field 'start'.
\r
1108 * the value of field 'start'.
\r
1110 public void setStart(final int start)
\r
1112 this._start = start;
\r
1113 this._has_start = true;
\r
1117 * Sets the value of field 'textCol1'.
\r
1120 * the value of field 'textCol1'.
\r
1122 public void setTextCol1(final int textCol1)
\r
1124 this._textCol1 = textCol1;
\r
1125 this._has_textCol1 = true;
\r
1129 * Sets the value of field 'textCol2'.
\r
1132 * the value of field 'textCol2'.
\r
1134 public void setTextCol2(final int textCol2)
\r
1136 this._textCol2 = textCol2;
\r
1137 this._has_textCol2 = true;
\r
1141 * Sets the value of field 'textColThreshold'.
\r
1143 * @param textColThreshold
\r
1144 * the value of field 'textColThreshold'
\r
1146 public void setTextColThreshold(final int textColThreshold)
\r
1148 this._textColThreshold = textColThreshold;
\r
1149 this._has_textColThreshold = true;
\r
1153 * Method unmarshal.
\r
1156 * @throws org.exolab.castor.xml.MarshalException
\r
1157 * if object is null or if any SAXException is thrown during
\r
1159 * @throws org.exolab.castor.xml.ValidationException
\r
1160 * if this object is an invalid instance according to the schema
\r
1161 * @return the unmarshaled jalview.schemabinding.version2.JGroup
\r
1163 public static jalview.schemabinding.version2.JGroup unmarshal(
\r
1164 final java.io.Reader reader)
\r
1165 throws org.exolab.castor.xml.MarshalException,
\r
1166 org.exolab.castor.xml.ValidationException
\r
1168 return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(
\r
1169 jalview.schemabinding.version2.JGroup.class, reader);
\r
1175 * @throws org.exolab.castor.xml.ValidationException
\r
1176 * if this object is an invalid instance according to the schema
\r
1178 public void validate() throws org.exolab.castor.xml.ValidationException
\r
1180 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
1181 validator.validate(this);
\r