2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
18 package jalview.schemabinding.version2;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
30 * @version $Revision$ $Date$
32 public class JGroup implements java.io.Serializable
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
45 * keeps track of state for field: _start
47 private boolean _has_start;
55 * keeps track of state for field: _end
57 private boolean _has_end;
62 private java.lang.String _name;
67 private java.lang.String _colour;
70 * Field _consThreshold.
72 private int _consThreshold;
75 * keeps track of state for field: _consThreshold
77 private boolean _has_consThreshold;
80 * Field _pidThreshold.
82 private int _pidThreshold;
85 * keeps track of state for field: _pidThreshold
87 private boolean _has_pidThreshold;
90 * Field _outlineColour.
92 private int _outlineColour;
95 * keeps track of state for field: _outlineColour
97 private boolean _has_outlineColour;
100 * Field _displayBoxes.
102 private boolean _displayBoxes;
105 * keeps track of state for field: _displayBoxes
107 private boolean _has_displayBoxes;
110 * Field _displayText.
112 private boolean _displayText;
115 * keeps track of state for field: _displayText
117 private boolean _has_displayText;
122 private boolean _colourText;
125 * keeps track of state for field: _colourText
127 private boolean _has_colourText;
132 private int _textCol1;
135 * keeps track of state for field: _textCol1
137 private boolean _has_textCol1;
142 private int _textCol2;
145 * keeps track of state for field: _textCol2
147 private boolean _has_textCol2;
150 * Field _textColThreshold.
152 private int _textColThreshold;
155 * keeps track of state for field: _textColThreshold
157 private boolean _has_textColThreshold;
160 * Field _showUnconserved.
162 private boolean _showUnconserved;
165 * keeps track of state for field: _showUnconserved
167 private boolean _has_showUnconserved;
170 * Field _ignoreGapsinConsensus.
172 private boolean _ignoreGapsinConsensus = true;
175 * keeps track of state for field: _ignoreGapsinConsensus
177 private boolean _has_ignoreGapsinConsensus;
180 * Field _showConsensusHistogram.
182 private boolean _showConsensusHistogram = true;
185 * keeps track of state for field: _showConsensusHistogram
187 private boolean _has_showConsensusHistogram;
190 * Field _showSequenceLogo.
192 private boolean _showSequenceLogo = false;
195 * keeps track of state for field: _showSequenceLogo
197 private boolean _has_showSequenceLogo;
200 * Field _normaliseSequenceLogo.
202 private boolean _normaliseSequenceLogo = false;
205 * keeps track of state for field: _normaliseSequenceLogo
207 private boolean _has_normaliseSequenceLogo;
210 * Optional sequence group ID (only needs to be unique for this alignment)
213 private java.lang.String _id;
218 private java.util.Vector _seqList;
227 this._seqList = new java.util.Vector();
238 * @throws java.lang.IndexOutOfBoundsException
239 * if the index given is outside the bounds of the collection
241 public void addSeq(final java.lang.String vSeq)
242 throws java.lang.IndexOutOfBoundsException
244 this._seqList.addElement(vSeq);
252 * @throws java.lang.IndexOutOfBoundsException
253 * if the index given is outside the bounds of the collection
255 public void addSeq(final int index, final java.lang.String vSeq)
256 throws java.lang.IndexOutOfBoundsException
258 this._seqList.add(index, vSeq);
263 public void deleteColourText()
265 this._has_colourText = false;
270 public void deleteConsThreshold()
272 this._has_consThreshold = false;
277 public void deleteDisplayBoxes()
279 this._has_displayBoxes = false;
284 public void deleteDisplayText()
286 this._has_displayText = false;
291 public void deleteEnd()
293 this._has_end = false;
298 public void deleteIgnoreGapsinConsensus()
300 this._has_ignoreGapsinConsensus = false;
305 public void deleteNormaliseSequenceLogo()
307 this._has_normaliseSequenceLogo = false;
312 public void deleteOutlineColour()
314 this._has_outlineColour = false;
319 public void deletePidThreshold()
321 this._has_pidThreshold = false;
326 public void deleteShowConsensusHistogram()
328 this._has_showConsensusHistogram = false;
333 public void deleteShowSequenceLogo()
335 this._has_showSequenceLogo = false;
340 public void deleteShowUnconserved()
342 this._has_showUnconserved = false;
347 public void deleteStart()
349 this._has_start = false;
354 public void deleteTextCol1()
356 this._has_textCol1 = false;
361 public void deleteTextCol2()
363 this._has_textCol2 = false;
368 public void deleteTextColThreshold()
370 this._has_textColThreshold = false;
374 * Method enumerateSeq.
376 * @return an Enumeration over all java.lang.String elements
378 public java.util.Enumeration enumerateSeq()
380 return this._seqList.elements();
384 * Returns the value of field 'colour'.
386 * @return the value of field 'Colour'.
388 public java.lang.String getColour()
394 * Returns the value of field 'colourText'.
396 * @return the value of field 'ColourText'.
398 public boolean getColourText()
400 return this._colourText;
404 * Returns the value of field 'consThreshold'.
406 * @return the value of field 'ConsThreshold'.
408 public int getConsThreshold()
410 return this._consThreshold;
414 * Returns the value of field 'displayBoxes'.
416 * @return the value of field 'DisplayBoxes'.
418 public boolean getDisplayBoxes()
420 return this._displayBoxes;
424 * Returns the value of field 'displayText'.
426 * @return the value of field 'DisplayText'.
428 public boolean getDisplayText()
430 return this._displayText;
434 * Returns the value of field 'end'.
436 * @return the value of field 'End'.
444 * Returns the value of field 'id'. The field 'id' has the following
445 * description: Optional sequence group ID (only needs to be unique for this
449 * @return the value of field 'Id'.
451 public java.lang.String getId()
457 * Returns the value of field 'ignoreGapsinConsensus'.
459 * @return the value of field 'IgnoreGapsinConsensus'.
461 public boolean getIgnoreGapsinConsensus()
463 return this._ignoreGapsinConsensus;
467 * Returns the value of field 'name'.
469 * @return the value of field 'Name'.
471 public java.lang.String getName()
477 * Returns the value of field 'normaliseSequenceLogo'.
479 * @return the value of field 'NormaliseSequenceLogo'.
481 public boolean getNormaliseSequenceLogo()
483 return this._normaliseSequenceLogo;
487 * Returns the value of field 'outlineColour'.
489 * @return the value of field 'OutlineColour'.
491 public int getOutlineColour()
493 return this._outlineColour;
497 * Returns the value of field 'pidThreshold'.
499 * @return the value of field 'PidThreshold'.
501 public int getPidThreshold()
503 return this._pidThreshold;
510 * @throws java.lang.IndexOutOfBoundsException
511 * if the index given is outside the bounds of the collection
512 * @return the value of the java.lang.String at the given index
514 public java.lang.String getSeq(final int index)
515 throws java.lang.IndexOutOfBoundsException
517 // check bounds for index
518 if (index < 0 || index >= this._seqList.size())
520 throw new IndexOutOfBoundsException("getSeq: Index value '" + index
521 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
524 return (java.lang.String) _seqList.get(index);
528 * Method getSeq.Returns the contents of the collection in an Array.
530 * Note: Just in case the collection contents are changing in another thread,
531 * we pass a 0-length Array of the correct type into the API call. This way we
532 * <i>know</i> that the Array returned is of exactly the correct length.
534 * @return this collection as an Array
536 public java.lang.String[] getSeq()
538 java.lang.String[] array = new java.lang.String[0];
539 return (java.lang.String[]) this._seqList.toArray(array);
543 * Method getSeqCount.
545 * @return the size of this collection
547 public int getSeqCount()
549 return this._seqList.size();
553 * Returns the value of field 'showConsensusHistogram'.
555 * @return the value of field 'ShowConsensusHistogram'.
557 public boolean getShowConsensusHistogram()
559 return this._showConsensusHistogram;
563 * Returns the value of field 'showSequenceLogo'.
565 * @return the value of field 'ShowSequenceLogo'.
567 public boolean getShowSequenceLogo()
569 return this._showSequenceLogo;
573 * Returns the value of field 'showUnconserved'.
575 * @return the value of field 'ShowUnconserved'.
577 public boolean getShowUnconserved()
579 return this._showUnconserved;
583 * Returns the value of field 'start'.
585 * @return the value of field 'Start'.
587 public int getStart()
593 * Returns the value of field 'textCol1'.
595 * @return the value of field 'TextCol1'.
597 public int getTextCol1()
599 return this._textCol1;
603 * Returns the value of field 'textCol2'.
605 * @return the value of field 'TextCol2'.
607 public int getTextCol2()
609 return this._textCol2;
613 * Returns the value of field 'textColThreshold'.
615 * @return the value of field 'TextColThreshold'.
617 public int getTextColThreshold()
619 return this._textColThreshold;
623 * Method hasColourText.
625 * @return true if at least one ColourText has been added
627 public boolean hasColourText()
629 return this._has_colourText;
633 * Method hasConsThreshold.
635 * @return true if at least one ConsThreshold has been added
637 public boolean hasConsThreshold()
639 return this._has_consThreshold;
643 * Method hasDisplayBoxes.
645 * @return true if at least one DisplayBoxes has been added
647 public boolean hasDisplayBoxes()
649 return this._has_displayBoxes;
653 * Method hasDisplayText.
655 * @return true if at least one DisplayText has been added
657 public boolean hasDisplayText()
659 return this._has_displayText;
665 * @return true if at least one End has been added
667 public boolean hasEnd()
669 return this._has_end;
673 * Method hasIgnoreGapsinConsensus.
675 * @return true if at least one IgnoreGapsinConsensus has been added
677 public boolean hasIgnoreGapsinConsensus()
679 return this._has_ignoreGapsinConsensus;
683 * Method hasNormaliseSequenceLogo.
685 * @return true if at least one NormaliseSequenceLogo has been added
687 public boolean hasNormaliseSequenceLogo()
689 return this._has_normaliseSequenceLogo;
693 * Method hasOutlineColour.
695 * @return true if at least one OutlineColour has been added
697 public boolean hasOutlineColour()
699 return this._has_outlineColour;
703 * Method hasPidThreshold.
705 * @return true if at least one PidThreshold has been added
707 public boolean hasPidThreshold()
709 return this._has_pidThreshold;
713 * Method hasShowConsensusHistogram.
715 * @return true if at least one ShowConsensusHistogram has been added
717 public boolean hasShowConsensusHistogram()
719 return this._has_showConsensusHistogram;
723 * Method hasShowSequenceLogo.
725 * @return true if at least one ShowSequenceLogo has been added
727 public boolean hasShowSequenceLogo()
729 return this._has_showSequenceLogo;
733 * Method hasShowUnconserved.
735 * @return true if at least one ShowUnconserved has been added
737 public boolean hasShowUnconserved()
739 return this._has_showUnconserved;
745 * @return true if at least one Start has been added
747 public boolean hasStart()
749 return this._has_start;
753 * Method hasTextCol1.
755 * @return true if at least one TextCol1 has been added
757 public boolean hasTextCol1()
759 return this._has_textCol1;
763 * Method hasTextCol2.
765 * @return true if at least one TextCol2 has been added
767 public boolean hasTextCol2()
769 return this._has_textCol2;
773 * Method hasTextColThreshold.
775 * @return true if at least one TextColThreshold has been added
777 public boolean hasTextColThreshold()
779 return this._has_textColThreshold;
783 * Returns the value of field 'colourText'.
785 * @return the value of field 'ColourText'.
787 public boolean isColourText()
789 return this._colourText;
793 * Returns the value of field 'displayBoxes'.
795 * @return the value of field 'DisplayBoxes'.
797 public boolean isDisplayBoxes()
799 return this._displayBoxes;
803 * Returns the value of field 'displayText'.
805 * @return the value of field 'DisplayText'.
807 public boolean isDisplayText()
809 return this._displayText;
813 * Returns the value of field 'ignoreGapsinConsensus'.
815 * @return the value of field 'IgnoreGapsinConsensus'.
817 public boolean isIgnoreGapsinConsensus()
819 return this._ignoreGapsinConsensus;
823 * Returns the value of field 'normaliseSequenceLogo'.
825 * @return the value of field 'NormaliseSequenceLogo'.
827 public boolean isNormaliseSequenceLogo()
829 return this._normaliseSequenceLogo;
833 * Returns the value of field 'showConsensusHistogram'.
835 * @return the value of field 'ShowConsensusHistogram'.
837 public boolean isShowConsensusHistogram()
839 return this._showConsensusHistogram;
843 * Returns the value of field 'showSequenceLogo'.
845 * @return the value of field 'ShowSequenceLogo'.
847 public boolean isShowSequenceLogo()
849 return this._showSequenceLogo;
853 * Returns the value of field 'showUnconserved'.
855 * @return the value of field 'ShowUnconserved'.
857 public boolean isShowUnconserved()
859 return this._showUnconserved;
865 * @return true if this object is valid according to the schema
867 public boolean isValid()
872 } catch (org.exolab.castor.xml.ValidationException vex)
883 * @throws org.exolab.castor.xml.MarshalException
884 * if object is null or if any SAXException is thrown during
886 * @throws org.exolab.castor.xml.ValidationException
887 * if this object is an invalid instance according to the schema
889 public void marshal(final java.io.Writer out)
890 throws org.exolab.castor.xml.MarshalException,
891 org.exolab.castor.xml.ValidationException
893 Marshaller.marshal(this, out);
900 * @throws java.io.IOException
901 * if an IOException occurs during marshaling
902 * @throws org.exolab.castor.xml.ValidationException
903 * if this object is an invalid instance according to the schema
904 * @throws org.exolab.castor.xml.MarshalException
905 * if object is null or if any SAXException is thrown during
908 public void marshal(final org.xml.sax.ContentHandler handler)
909 throws java.io.IOException,
910 org.exolab.castor.xml.MarshalException,
911 org.exolab.castor.xml.ValidationException
913 Marshaller.marshal(this, handler);
918 public void removeAllSeq()
920 this._seqList.clear();
927 * @return true if the object was removed from the collection.
929 public boolean removeSeq(final java.lang.String vSeq)
931 boolean removed = _seqList.remove(vSeq);
936 * Method removeSeqAt.
939 * @return the element removed from the collection
941 public java.lang.String removeSeqAt(final int index)
943 java.lang.Object obj = this._seqList.remove(index);
944 return (java.lang.String) obj;
948 * Sets the value of field 'colour'.
951 * the value of field 'colour'.
953 public void setColour(final java.lang.String colour)
955 this._colour = colour;
959 * Sets the value of field 'colourText'.
962 * the value of field 'colourText'.
964 public void setColourText(final boolean colourText)
966 this._colourText = colourText;
967 this._has_colourText = true;
971 * Sets the value of field 'consThreshold'.
973 * @param consThreshold
974 * the value of field 'consThreshold'.
976 public void setConsThreshold(final int consThreshold)
978 this._consThreshold = consThreshold;
979 this._has_consThreshold = true;
983 * Sets the value of field 'displayBoxes'.
985 * @param displayBoxes
986 * the value of field 'displayBoxes'.
988 public void setDisplayBoxes(final boolean displayBoxes)
990 this._displayBoxes = displayBoxes;
991 this._has_displayBoxes = true;
995 * Sets the value of field 'displayText'.
998 * the value of field 'displayText'.
1000 public void setDisplayText(final boolean displayText)
1002 this._displayText = displayText;
1003 this._has_displayText = true;
1007 * Sets the value of field 'end'.
1010 * the value of field 'end'.
1012 public void setEnd(final int end)
1015 this._has_end = true;
1019 * Sets the value of field 'id'. The field 'id' has the following description:
1020 * Optional sequence group ID (only needs to be unique for this alignment)
1024 * the value of field 'id'.
1026 public void setId(final java.lang.String id)
1032 * Sets the value of field 'ignoreGapsinConsensus'.
1034 * @param ignoreGapsinConsensus
1035 * the value of field 'ignoreGapsinConsensus'.
1037 public void setIgnoreGapsinConsensus(final boolean ignoreGapsinConsensus)
1039 this._ignoreGapsinConsensus = ignoreGapsinConsensus;
1040 this._has_ignoreGapsinConsensus = true;
1044 * Sets the value of field 'name'.
1047 * the value of field 'name'.
1049 public void setName(final java.lang.String name)
1055 * Sets the value of field 'normaliseSequenceLogo'.
1057 * @param normaliseSequenceLogo
1058 * the value of field 'normaliseSequenceLogo'.
1060 public void setNormaliseSequenceLogo(final boolean normaliseSequenceLogo)
1062 this._normaliseSequenceLogo = normaliseSequenceLogo;
1063 this._has_normaliseSequenceLogo = true;
1067 * Sets the value of field 'outlineColour'.
1069 * @param outlineColour
1070 * the value of field 'outlineColour'.
1072 public void setOutlineColour(final int outlineColour)
1074 this._outlineColour = outlineColour;
1075 this._has_outlineColour = true;
1079 * Sets the value of field 'pidThreshold'.
1081 * @param pidThreshold
1082 * the value of field 'pidThreshold'.
1084 public void setPidThreshold(final int pidThreshold)
1086 this._pidThreshold = pidThreshold;
1087 this._has_pidThreshold = true;
1095 * @throws java.lang.IndexOutOfBoundsException
1096 * if the index given is outside the bounds of the collection
1098 public void setSeq(final int index, final java.lang.String vSeq)
1099 throws java.lang.IndexOutOfBoundsException
1101 // check bounds for index
1102 if (index < 0 || index >= this._seqList.size())
1104 throw new IndexOutOfBoundsException("setSeq: Index value '" + index
1105 + "' not in range [0.." + (this._seqList.size() - 1) + "]");
1108 this._seqList.set(index, vSeq);
1116 public void setSeq(final java.lang.String[] vSeqArray)
1121 for (int i = 0; i < vSeqArray.length; i++)
1123 this._seqList.add(vSeqArray[i]);
1128 * Sets the value of field 'showConsensusHistogram'.
1130 * @param showConsensusHistogram
1131 * the value of field 'showConsensusHistogram'.
1133 public void setShowConsensusHistogram(final boolean showConsensusHistogram)
1135 this._showConsensusHistogram = showConsensusHistogram;
1136 this._has_showConsensusHistogram = true;
1140 * Sets the value of field 'showSequenceLogo'.
1142 * @param showSequenceLogo
1143 * the value of field 'showSequenceLogo'
1145 public void setShowSequenceLogo(final boolean showSequenceLogo)
1147 this._showSequenceLogo = showSequenceLogo;
1148 this._has_showSequenceLogo = true;
1152 * Sets the value of field 'showUnconserved'.
1154 * @param showUnconserved
1155 * the value of field 'showUnconserved'.
1157 public void setShowUnconserved(final boolean showUnconserved)
1159 this._showUnconserved = showUnconserved;
1160 this._has_showUnconserved = true;
1164 * Sets the value of field 'start'.
1167 * the value of field 'start'.
1169 public void setStart(final int start)
1171 this._start = start;
1172 this._has_start = true;
1176 * Sets the value of field 'textCol1'.
1179 * the value of field 'textCol1'.
1181 public void setTextCol1(final int textCol1)
1183 this._textCol1 = textCol1;
1184 this._has_textCol1 = true;
1188 * Sets the value of field 'textCol2'.
1191 * the value of field 'textCol2'.
1193 public void setTextCol2(final int textCol2)
1195 this._textCol2 = textCol2;
1196 this._has_textCol2 = true;
1200 * Sets the value of field 'textColThreshold'.
1202 * @param textColThreshold
1203 * the value of field 'textColThreshold'
1205 public void setTextColThreshold(final int textColThreshold)
1207 this._textColThreshold = textColThreshold;
1208 this._has_textColThreshold = true;
1215 * @throws org.exolab.castor.xml.MarshalException
1216 * if object is null or if any SAXException is thrown during
1218 * @throws org.exolab.castor.xml.ValidationException
1219 * if this object is an invalid instance according to the schema
1220 * @return the unmarshaled jalview.schemabinding.version2.JGroup
1222 public static jalview.schemabinding.version2.JGroup unmarshal(
1223 final java.io.Reader reader)
1224 throws org.exolab.castor.xml.MarshalException,
1225 org.exolab.castor.xml.ValidationException
1227 return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(
1228 jalview.schemabinding.version2.JGroup.class, reader);
1234 * @throws org.exolab.castor.xml.ValidationException
1235 * if this object is an invalid instance according to the schema
1237 public void validate() throws org.exolab.castor.xml.ValidationException
1239 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1240 validator.validate(this);