2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 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 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 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
31 * @version $Revision$ $Date$
33 public class JGroup implements java.io.Serializable
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
46 * keeps track of state for field: _start
48 private boolean _has_start;
56 * keeps track of state for field: _end
58 private boolean _has_end;
63 private java.lang.String _name;
68 private java.lang.String _colour;
71 * Field _consThreshold.
73 private int _consThreshold;
76 * keeps track of state for field: _consThreshold
78 private boolean _has_consThreshold;
81 * Field _pidThreshold.
83 private int _pidThreshold;
86 * keeps track of state for field: _pidThreshold
88 private boolean _has_pidThreshold;
91 * Field _outlineColour.
93 private int _outlineColour;
96 * keeps track of state for field: _outlineColour
98 private boolean _has_outlineColour;
101 * Field _displayBoxes.
103 private boolean _displayBoxes;
106 * keeps track of state for field: _displayBoxes
108 private boolean _has_displayBoxes;
111 * Field _displayText.
113 private boolean _displayText;
116 * keeps track of state for field: _displayText
118 private boolean _has_displayText;
123 private boolean _colourText;
126 * keeps track of state for field: _colourText
128 private boolean _has_colourText;
133 private int _textCol1;
136 * keeps track of state for field: _textCol1
138 private boolean _has_textCol1;
143 private int _textCol2;
146 * keeps track of state for field: _textCol2
148 private boolean _has_textCol2;
151 * Field _textColThreshold.
153 private int _textColThreshold;
156 * keeps track of state for field: _textColThreshold
158 private boolean _has_textColThreshold;
161 * Field _showUnconserved.
163 private boolean _showUnconserved;
166 * keeps track of state for field: _showUnconserved
168 private boolean _has_showUnconserved;
171 * Field _ignoreGapsinConsensus.
173 private boolean _ignoreGapsinConsensus = true;
176 * keeps track of state for field: _ignoreGapsinConsensus
178 private boolean _has_ignoreGapsinConsensus;
181 * Field _showConsensusHistogram.
183 private boolean _showConsensusHistogram = true;
186 * keeps track of state for field: _showConsensusHistogram
188 private boolean _has_showConsensusHistogram;
191 * Field _showSequenceLogo.
193 private boolean _showSequenceLogo = false;
196 * keeps track of state for field: _showSequenceLogo
198 private boolean _has_showSequenceLogo;
201 * Field _normaliseSequenceLogo.
203 private boolean _normaliseSequenceLogo = false;
206 * keeps track of state for field: _normaliseSequenceLogo
208 private boolean _has_normaliseSequenceLogo;
211 * Optional sequence group ID (only needs to be unique for this alignment)
214 private java.lang.String _id;
219 private java.util.Vector _seqList;
228 this._seqList = new java.util.Vector();
239 * @throws java.lang.IndexOutOfBoundsException
240 * if the index given is outside the bounds of the collection
242 public void addSeq(final java.lang.String vSeq)
243 throws java.lang.IndexOutOfBoundsException
245 this._seqList.addElement(vSeq);
253 * @throws java.lang.IndexOutOfBoundsException
254 * if the index given is outside the bounds of the collection
256 public void addSeq(final int index, final java.lang.String vSeq)
257 throws java.lang.IndexOutOfBoundsException
259 this._seqList.add(index, vSeq);
264 public void deleteColourText()
266 this._has_colourText = false;
271 public void deleteConsThreshold()
273 this._has_consThreshold = false;
278 public void deleteDisplayBoxes()
280 this._has_displayBoxes = false;
285 public void deleteDisplayText()
287 this._has_displayText = false;
292 public void deleteEnd()
294 this._has_end = false;
299 public void deleteIgnoreGapsinConsensus()
301 this._has_ignoreGapsinConsensus = false;
306 public void deleteNormaliseSequenceLogo()
308 this._has_normaliseSequenceLogo = false;
313 public void deleteOutlineColour()
315 this._has_outlineColour = false;
320 public void deletePidThreshold()
322 this._has_pidThreshold = false;
327 public void deleteShowConsensusHistogram()
329 this._has_showConsensusHistogram = false;
334 public void deleteShowSequenceLogo()
336 this._has_showSequenceLogo = false;
341 public void deleteShowUnconserved()
343 this._has_showUnconserved = false;
348 public void deleteStart()
350 this._has_start = false;
355 public void deleteTextCol1()
357 this._has_textCol1 = false;
362 public void deleteTextCol2()
364 this._has_textCol2 = false;
369 public void deleteTextColThreshold()
371 this._has_textColThreshold = false;
375 * Method enumerateSeq.
377 * @return an Enumeration over all java.lang.String elements
379 public java.util.Enumeration enumerateSeq()
381 return this._seqList.elements();
385 * Returns the value of field 'colour'.
387 * @return the value of field 'Colour'.
389 public java.lang.String getColour()
395 * Returns the value of field 'colourText'.
397 * @return the value of field 'ColourText'.
399 public boolean getColourText()
401 return this._colourText;
405 * Returns the value of field 'consThreshold'.
407 * @return the value of field 'ConsThreshold'.
409 public int getConsThreshold()
411 return this._consThreshold;
415 * Returns the value of field 'displayBoxes'.
417 * @return the value of field 'DisplayBoxes'.
419 public boolean getDisplayBoxes()
421 return this._displayBoxes;
425 * Returns the value of field 'displayText'.
427 * @return the value of field 'DisplayText'.
429 public boolean getDisplayText()
431 return this._displayText;
435 * Returns the value of field 'end'.
437 * @return the value of field 'End'.
445 * Returns the value of field 'id'. The field 'id' has the following
446 * description: Optional sequence group ID (only needs to be unique for this
450 * @return the value of field 'Id'.
452 public java.lang.String getId()
458 * Returns the value of field 'ignoreGapsinConsensus'.
460 * @return the value of field 'IgnoreGapsinConsensus'.
462 public boolean getIgnoreGapsinConsensus()
464 return this._ignoreGapsinConsensus;
468 * Returns the value of field 'name'.
470 * @return the value of field 'Name'.
472 public java.lang.String getName()
478 * Returns the value of field 'normaliseSequenceLogo'.
480 * @return the value of field 'NormaliseSequenceLogo'.
482 public boolean getNormaliseSequenceLogo()
484 return this._normaliseSequenceLogo;
488 * Returns the value of field 'outlineColour'.
490 * @return the value of field 'OutlineColour'.
492 public int getOutlineColour()
494 return this._outlineColour;
498 * Returns the value of field 'pidThreshold'.
500 * @return the value of field 'PidThreshold'.
502 public int getPidThreshold()
504 return this._pidThreshold;
511 * @throws java.lang.IndexOutOfBoundsException
512 * if the index given is outside the bounds of the collection
513 * @return the value of the java.lang.String at the given index
515 public java.lang.String getSeq(final int index)
516 throws java.lang.IndexOutOfBoundsException
518 // check bounds for index
519 if (index < 0 || index >= this._seqList.size())
521 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
522 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
525 return (java.lang.String) _seqList.get(index);
529 * Method getSeq.Returns the contents of the collection in an Array.
531 * Note: Just in case the collection contents are changing in another thread,
532 * we pass a 0-length Array of the correct type into the API call. This way we
533 * <i>know</i> that the Array returned is of exactly the correct length.
535 * @return this collection as an Array
537 public java.lang.String[] getSeq()
539 java.lang.String[] array = new java.lang.String[0];
540 return (java.lang.String[]) this._seqList.toArray(array);
544 * Method getSeqCount.
546 * @return the size of this collection
548 public int getSeqCount()
550 return this._seqList.size();
554 * Returns the value of field 'showConsensusHistogram'.
556 * @return the value of field 'ShowConsensusHistogram'.
558 public boolean getShowConsensusHistogram()
560 return this._showConsensusHistogram;
564 * Returns the value of field 'showSequenceLogo'.
566 * @return the value of field 'ShowSequenceLogo'.
568 public boolean getShowSequenceLogo()
570 return this._showSequenceLogo;
574 * Returns the value of field 'showUnconserved'.
576 * @return the value of field 'ShowUnconserved'.
578 public boolean getShowUnconserved()
580 return this._showUnconserved;
584 * Returns the value of field 'start'.
586 * @return the value of field 'Start'.
588 public int getStart()
594 * Returns the value of field 'textCol1'.
596 * @return the value of field 'TextCol1'.
598 public int getTextCol1()
600 return this._textCol1;
604 * Returns the value of field 'textCol2'.
606 * @return the value of field 'TextCol2'.
608 public int getTextCol2()
610 return this._textCol2;
614 * Returns the value of field 'textColThreshold'.
616 * @return the value of field 'TextColThreshold'.
618 public int getTextColThreshold()
620 return this._textColThreshold;
624 * Method hasColourText.
626 * @return true if at least one ColourText has been added
628 public boolean hasColourText()
630 return this._has_colourText;
634 * Method hasConsThreshold.
636 * @return true if at least one ConsThreshold has been added
638 public boolean hasConsThreshold()
640 return this._has_consThreshold;
644 * Method hasDisplayBoxes.
646 * @return true if at least one DisplayBoxes has been added
648 public boolean hasDisplayBoxes()
650 return this._has_displayBoxes;
654 * Method hasDisplayText.
656 * @return true if at least one DisplayText has been added
658 public boolean hasDisplayText()
660 return this._has_displayText;
666 * @return true if at least one End has been added
668 public boolean hasEnd()
670 return this._has_end;
674 * Method hasIgnoreGapsinConsensus.
676 * @return true if at least one IgnoreGapsinConsensus has been added
678 public boolean hasIgnoreGapsinConsensus()
680 return this._has_ignoreGapsinConsensus;
684 * Method hasNormaliseSequenceLogo.
686 * @return true if at least one NormaliseSequenceLogo has been added
688 public boolean hasNormaliseSequenceLogo()
690 return this._has_normaliseSequenceLogo;
694 * Method hasOutlineColour.
696 * @return true if at least one OutlineColour has been added
698 public boolean hasOutlineColour()
700 return this._has_outlineColour;
704 * Method hasPidThreshold.
706 * @return true if at least one PidThreshold has been added
708 public boolean hasPidThreshold()
710 return this._has_pidThreshold;
714 * Method hasShowConsensusHistogram.
716 * @return true if at least one ShowConsensusHistogram has been added
718 public boolean hasShowConsensusHistogram()
720 return this._has_showConsensusHistogram;
724 * Method hasShowSequenceLogo.
726 * @return true if at least one ShowSequenceLogo has been added
728 public boolean hasShowSequenceLogo()
730 return this._has_showSequenceLogo;
734 * Method hasShowUnconserved.
736 * @return true if at least one ShowUnconserved has been added
738 public boolean hasShowUnconserved()
740 return this._has_showUnconserved;
746 * @return true if at least one Start has been added
748 public boolean hasStart()
750 return this._has_start;
754 * Method hasTextCol1.
756 * @return true if at least one TextCol1 has been added
758 public boolean hasTextCol1()
760 return this._has_textCol1;
764 * Method hasTextCol2.
766 * @return true if at least one TextCol2 has been added
768 public boolean hasTextCol2()
770 return this._has_textCol2;
774 * Method hasTextColThreshold.
776 * @return true if at least one TextColThreshold has been added
778 public boolean hasTextColThreshold()
780 return this._has_textColThreshold;
784 * Returns the value of field 'colourText'.
786 * @return the value of field 'ColourText'.
788 public boolean isColourText()
790 return this._colourText;
794 * Returns the value of field 'displayBoxes'.
796 * @return the value of field 'DisplayBoxes'.
798 public boolean isDisplayBoxes()
800 return this._displayBoxes;
804 * Returns the value of field 'displayText'.
806 * @return the value of field 'DisplayText'.
808 public boolean isDisplayText()
810 return this._displayText;
814 * Returns the value of field 'ignoreGapsinConsensus'.
816 * @return the value of field 'IgnoreGapsinConsensus'.
818 public boolean isIgnoreGapsinConsensus()
820 return this._ignoreGapsinConsensus;
824 * Returns the value of field 'normaliseSequenceLogo'.
826 * @return the value of field 'NormaliseSequenceLogo'.
828 public boolean isNormaliseSequenceLogo()
830 return this._normaliseSequenceLogo;
834 * Returns the value of field 'showConsensusHistogram'.
836 * @return the value of field 'ShowConsensusHistogram'.
838 public boolean isShowConsensusHistogram()
840 return this._showConsensusHistogram;
844 * Returns the value of field 'showSequenceLogo'.
846 * @return the value of field 'ShowSequenceLogo'.
848 public boolean isShowSequenceLogo()
850 return this._showSequenceLogo;
854 * Returns the value of field 'showUnconserved'.
856 * @return the value of field 'ShowUnconserved'.
858 public boolean isShowUnconserved()
860 return this._showUnconserved;
866 * @return true if this object is valid according to the schema
868 public boolean isValid()
873 } catch (org.exolab.castor.xml.ValidationException vex)
884 * @throws org.exolab.castor.xml.MarshalException
885 * if object is null or if any SAXException is thrown during
887 * @throws org.exolab.castor.xml.ValidationException
888 * if this object is an invalid instance according to the schema
890 public void marshal(final java.io.Writer out)
891 throws org.exolab.castor.xml.MarshalException,
892 org.exolab.castor.xml.ValidationException
894 Marshaller.marshal(this, out);
901 * @throws java.io.IOException
902 * if an IOException occurs during marshaling
903 * @throws org.exolab.castor.xml.ValidationException
904 * if this object is an invalid instance according to the schema
905 * @throws org.exolab.castor.xml.MarshalException
906 * if object is null or if any SAXException is thrown during
909 public void marshal(final org.xml.sax.ContentHandler handler)
910 throws java.io.IOException,
911 org.exolab.castor.xml.MarshalException,
912 org.exolab.castor.xml.ValidationException
914 Marshaller.marshal(this, handler);
919 public void removeAllSeq()
921 this._seqList.clear();
928 * @return true if the object was removed from the collection.
930 public boolean removeSeq(final java.lang.String vSeq)
932 boolean removed = _seqList.remove(vSeq);
937 * Method removeSeqAt.
940 * @return the element removed from the collection
942 public java.lang.String removeSeqAt(final int index)
944 java.lang.Object obj = this._seqList.remove(index);
945 return (java.lang.String) obj;
949 * Sets the value of field 'colour'.
952 * the value of field 'colour'.
954 public void setColour(final java.lang.String colour)
956 this._colour = colour;
960 * Sets the value of field 'colourText'.
963 * the value of field 'colourText'.
965 public void setColourText(final boolean colourText)
967 this._colourText = colourText;
968 this._has_colourText = true;
972 * Sets the value of field 'consThreshold'.
974 * @param consThreshold
975 * the value of field 'consThreshold'.
977 public void setConsThreshold(final int consThreshold)
979 this._consThreshold = consThreshold;
980 this._has_consThreshold = true;
984 * Sets the value of field 'displayBoxes'.
986 * @param displayBoxes
987 * the value of field 'displayBoxes'.
989 public void setDisplayBoxes(final boolean displayBoxes)
991 this._displayBoxes = displayBoxes;
992 this._has_displayBoxes = true;
996 * Sets the value of field 'displayText'.
999 * the value of field 'displayText'.
1001 public void setDisplayText(final boolean displayText)
1003 this._displayText = displayText;
1004 this._has_displayText = true;
1008 * Sets the value of field 'end'.
1011 * the value of field 'end'.
1013 public void setEnd(final int end)
1016 this._has_end = true;
1020 * Sets the value of field 'id'. The field 'id' has the following description:
1021 * Optional sequence group ID (only needs to be unique for this alignment)
1025 * the value of field 'id'.
1027 public void setId(final java.lang.String id)
1033 * Sets the value of field 'ignoreGapsinConsensus'.
1035 * @param ignoreGapsinConsensus
1036 * the value of field 'ignoreGapsinConsensus'.
1038 public void setIgnoreGapsinConsensus(final boolean ignoreGapsinConsensus)
1040 this._ignoreGapsinConsensus = ignoreGapsinConsensus;
1041 this._has_ignoreGapsinConsensus = true;
1045 * Sets the value of field 'name'.
1048 * the value of field 'name'.
1050 public void setName(final java.lang.String name)
1056 * Sets the value of field 'normaliseSequenceLogo'.
1058 * @param normaliseSequenceLogo
1059 * the value of field 'normaliseSequenceLogo'.
1061 public void setNormaliseSequenceLogo(final boolean normaliseSequenceLogo)
1063 this._normaliseSequenceLogo = normaliseSequenceLogo;
1064 this._has_normaliseSequenceLogo = true;
1068 * Sets the value of field 'outlineColour'.
1070 * @param outlineColour
1071 * the value of field 'outlineColour'.
1073 public void setOutlineColour(final int outlineColour)
1075 this._outlineColour = outlineColour;
1076 this._has_outlineColour = true;
1080 * Sets the value of field 'pidThreshold'.
1082 * @param pidThreshold
1083 * the value of field 'pidThreshold'.
1085 public void setPidThreshold(final int pidThreshold)
1087 this._pidThreshold = pidThreshold;
1088 this._has_pidThreshold = true;
1096 * @throws java.lang.IndexOutOfBoundsException
1097 * if the index given is outside the bounds of the collection
1099 public void setSeq(final int index, final java.lang.String vSeq)
1100 throws java.lang.IndexOutOfBoundsException
1102 // check bounds for index
1103 if (index < 0 || index >= this._seqList.size())
1105 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
1106 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
1109 this._seqList.set(index, vSeq);
1117 public void setSeq(final java.lang.String[] vSeqArray)
1122 for (int i = 0; i < vSeqArray.length; i++)
1124 this._seqList.add(vSeqArray[i]);
1129 * Sets the value of field 'showConsensusHistogram'.
1131 * @param showConsensusHistogram
1132 * the value of field 'showConsensusHistogram'.
1134 public void setShowConsensusHistogram(final boolean showConsensusHistogram)
1136 this._showConsensusHistogram = showConsensusHistogram;
1137 this._has_showConsensusHistogram = true;
1141 * Sets the value of field 'showSequenceLogo'.
1143 * @param showSequenceLogo
1144 * the value of field 'showSequenceLogo'
1146 public void setShowSequenceLogo(final boolean showSequenceLogo)
1148 this._showSequenceLogo = showSequenceLogo;
1149 this._has_showSequenceLogo = true;
1153 * Sets the value of field 'showUnconserved'.
1155 * @param showUnconserved
1156 * the value of field 'showUnconserved'.
1158 public void setShowUnconserved(final boolean showUnconserved)
1160 this._showUnconserved = showUnconserved;
1161 this._has_showUnconserved = true;
1165 * Sets the value of field 'start'.
1168 * the value of field 'start'.
1170 public void setStart(final int start)
1172 this._start = start;
1173 this._has_start = true;
1177 * Sets the value of field 'textCol1'.
1180 * the value of field 'textCol1'.
1182 public void setTextCol1(final int textCol1)
1184 this._textCol1 = textCol1;
1185 this._has_textCol1 = true;
1189 * Sets the value of field 'textCol2'.
1192 * the value of field 'textCol2'.
1194 public void setTextCol2(final int textCol2)
1196 this._textCol2 = textCol2;
1197 this._has_textCol2 = true;
1201 * Sets the value of field 'textColThreshold'.
1203 * @param textColThreshold
1204 * the value of field 'textColThreshold'
1206 public void setTextColThreshold(final int textColThreshold)
1208 this._textColThreshold = textColThreshold;
1209 this._has_textColThreshold = true;
1216 * @throws org.exolab.castor.xml.MarshalException
1217 * if object is null or if any SAXException is thrown during
1219 * @throws org.exolab.castor.xml.ValidationException
1220 * if this object is an invalid instance according to the schema
1221 * @return the unmarshaled jalview.schemabinding.version2.JGroup
1223 public static jalview.schemabinding.version2.JGroup unmarshal(
1224 final java.io.Reader reader)
1225 throws org.exolab.castor.xml.MarshalException,
1226 org.exolab.castor.xml.ValidationException
1228 return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(
1229 jalview.schemabinding.version2.JGroup.class, reader);
1235 * @throws org.exolab.castor.xml.ValidationException
1236 * if this object is an invalid instance according to the schema
1238 public void validate() throws org.exolab.castor.xml.ValidationException
1240 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1241 validator.validate(this);