X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbinding%2FJGroup.java;h=5b6d74e2ff832c170a25323abc9b78925d391694;hb=b8d09897dacc7b0ad203982b4578e2c1d8929142;hp=eef4a28a18f3b4c91f67ed2593cc5de69adfb53a;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java index eef4a28..5b6d74e 100755 --- a/src/jalview/binding/JGroup.java +++ b/src/jalview/binding/JGroup.java @@ -4,54 +4,36 @@ * Schema. * $Id$ */ +package jalview.binding; -/* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/ +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; -package jalview.binding; +import org.xml.sax.ContentHandler; - //---------------------------------/ - //- Imported classes and packages -/ //---------------------------------/ - +//- Imported classes and packages -/ +//---------------------------------/ import java.io.IOException; import java.io.Reader; import java.io.Serializable; import java.io.Writer; + import java.util.Enumeration; import java.util.Vector; -import org.exolab.castor.xml.MarshalException; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; + /** * Class JGroup. * * @version $Revision$ $Date$ */ -public class JGroup implements java.io.Serializable { - - - //--------------------------/ - //- Class/Member Variables -/ +public class JGroup implements java.io.Serializable +{ + //--------------------------/ + //- Class/Member Variables -/ //--------------------------/ /** @@ -149,33 +131,31 @@ public class JGroup implements java.io.Serializable { */ private java.util.Vector _seqList; - - //----------------/ - //- Constructors -/ //----------------/ - - public JGroup() { + //- Constructors -/ + //----------------/ + public JGroup() + { super(); _seqList = new Vector(); - } //-- jalview.binding.JGroup() - + } - //-----------/ - //- Methods -/ + //-- jalview.binding.JGroup() //-----------/ /** - * Method addSeq - * + * DOCUMENT ME! * + * @param vSeq DOCUMENT ME! * - * @param vSeq + * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME! */ - public void addSeq(int vSeq) - throws java.lang.IndexOutOfBoundsException + public void addSeq(int vSeq) throws java.lang.IndexOutOfBoundsException { _seqList.addElement(new java.lang.Integer(vSeq)); - } //-- void addSeq(int) + } + + //-- void addSeq(int) /** * Method addSeq @@ -189,7 +169,9 @@ public class JGroup implements java.io.Serializable { throws java.lang.IndexOutOfBoundsException { _seqList.insertElementAt(new java.lang.Integer(vSeq), index); - } //-- void addSeq(int, int) + } + + //-- void addSeq(int, int) /** * Method deleteColourText @@ -197,8 +179,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteColourText() { - this._has_colourText= false; - } //-- void deleteColourText() + this._has_colourText = false; + } + + //-- void deleteColourText() /** * Method deleteConsThreshold @@ -206,8 +190,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteConsThreshold() { - this._has_consThreshold= false; - } //-- void deleteConsThreshold() + this._has_consThreshold = false; + } + + //-- void deleteConsThreshold() /** * Method deleteDisplayBoxes @@ -215,8 +201,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteDisplayBoxes() { - this._has_displayBoxes= false; - } //-- void deleteDisplayBoxes() + this._has_displayBoxes = false; + } + + //-- void deleteDisplayBoxes() /** * Method deleteDisplayText @@ -224,8 +212,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteDisplayText() { - this._has_displayText= false; - } //-- void deleteDisplayText() + this._has_displayText = false; + } + + //-- void deleteDisplayText() /** * Method deleteEnd @@ -233,8 +223,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteEnd() { - this._has_end= false; - } //-- void deleteEnd() + this._has_end = false; + } + + //-- void deleteEnd() /** * Method deleteOutlineColour @@ -242,8 +234,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteOutlineColour() { - this._has_outlineColour= false; - } //-- void deleteOutlineColour() + this._has_outlineColour = false; + } + + //-- void deleteOutlineColour() /** * Method deletePidThreshold @@ -251,8 +245,10 @@ public class JGroup implements java.io.Serializable { */ public void deletePidThreshold() { - this._has_pidThreshold= false; - } //-- void deletePidThreshold() + this._has_pidThreshold = false; + } + + //-- void deletePidThreshold() /** * Method deleteStart @@ -260,8 +256,10 @@ public class JGroup implements java.io.Serializable { */ public void deleteStart() { - this._has_start= false; - } //-- void deleteStart() + this._has_start = false; + } + + //-- void deleteStart() /** * Method enumerateSeq @@ -273,7 +271,9 @@ public class JGroup implements java.io.Serializable { public java.util.Enumeration enumerateSeq() { return _seqList.elements(); - } //-- java.util.Enumeration enumerateSeq() + } + + //-- java.util.Enumeration enumerateSeq() /** * Returns the value of field 'colour'. @@ -284,7 +284,9 @@ public class JGroup implements java.io.Serializable { public java.lang.String getColour() { return this._colour; - } //-- java.lang.String getColour() + } + + //-- java.lang.String getColour() /** * Returns the value of field 'colourText'. @@ -295,7 +297,9 @@ public class JGroup implements java.io.Serializable { public boolean getColourText() { return this._colourText; - } //-- boolean getColourText() + } + + //-- boolean getColourText() /** * Returns the value of field 'consThreshold'. @@ -306,7 +310,9 @@ public class JGroup implements java.io.Serializable { public int getConsThreshold() { return this._consThreshold; - } //-- int getConsThreshold() + } + + //-- int getConsThreshold() /** * Returns the value of field 'displayBoxes'. @@ -317,7 +323,9 @@ public class JGroup implements java.io.Serializable { public boolean getDisplayBoxes() { return this._displayBoxes; - } //-- boolean getDisplayBoxes() + } + + //-- boolean getDisplayBoxes() /** * Returns the value of field 'displayText'. @@ -328,7 +336,9 @@ public class JGroup implements java.io.Serializable { public boolean getDisplayText() { return this._displayText; - } //-- boolean getDisplayText() + } + + //-- boolean getDisplayText() /** * Returns the value of field 'end'. @@ -339,7 +349,9 @@ public class JGroup implements java.io.Serializable { public int getEnd() { return this._end; - } //-- int getEnd() + } + + //-- int getEnd() /** * Returns the value of field 'name'. @@ -350,7 +362,9 @@ public class JGroup implements java.io.Serializable { public java.lang.String getName() { return this._name; - } //-- java.lang.String getName() + } + + //-- java.lang.String getName() /** * Returns the value of field 'outlineColour'. @@ -361,7 +375,9 @@ public class JGroup implements java.io.Serializable { public int getOutlineColour() { return this._outlineColour; - } //-- int getOutlineColour() + } + + //-- int getOutlineColour() /** * Returns the value of field 'pidThreshold'. @@ -372,7 +388,9 @@ public class JGroup implements java.io.Serializable { public int getPidThreshold() { return this._pidThreshold; - } //-- int getPidThreshold() + } + + //-- int getPidThreshold() /** * Method getSeq @@ -382,16 +400,18 @@ public class JGroup implements java.io.Serializable { * @param index * @return int */ - public int getSeq(int index) - throws java.lang.IndexOutOfBoundsException + public int getSeq(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _seqList.size())) { + if ((index < 0) || (index > _seqList.size())) + { throw new IndexOutOfBoundsException(); } - return ((java.lang.Integer)_seqList.elementAt(index)).intValue(); - } //-- int getSeq(int) + return ((java.lang.Integer) _seqList.elementAt(index)).intValue(); + } + + //-- int getSeq(int) /** * Method getSeq @@ -404,11 +424,16 @@ public class JGroup implements java.io.Serializable { { int size = _seqList.size(); int[] mArray = new int[size]; - for (int index = 0; index < size; index++) { - mArray[index] = ((java.lang.Integer)_seqList.elementAt(index)).intValue(); + + for (int index = 0; index < size; index++) + { + mArray[index] = ((java.lang.Integer) _seqList.elementAt(index)).intValue(); } + return mArray; - } //-- int[] getSeq() + } + + //-- int[] getSeq() /** * Method getSeqCount @@ -420,7 +445,9 @@ public class JGroup implements java.io.Serializable { public int getSeqCount() { return _seqList.size(); - } //-- int getSeqCount() + } + + //-- int getSeqCount() /** * Returns the value of field 'start'. @@ -431,7 +458,9 @@ public class JGroup implements java.io.Serializable { public int getStart() { return this._start; - } //-- int getStart() + } + + //-- int getStart() /** * Method hasColourText @@ -443,7 +472,9 @@ public class JGroup implements java.io.Serializable { public boolean hasColourText() { return this._has_colourText; - } //-- boolean hasColourText() + } + + //-- boolean hasColourText() /** * Method hasConsThreshold @@ -455,7 +486,9 @@ public class JGroup implements java.io.Serializable { public boolean hasConsThreshold() { return this._has_consThreshold; - } //-- boolean hasConsThreshold() + } + + //-- boolean hasConsThreshold() /** * Method hasDisplayBoxes @@ -467,7 +500,9 @@ public class JGroup implements java.io.Serializable { public boolean hasDisplayBoxes() { return this._has_displayBoxes; - } //-- boolean hasDisplayBoxes() + } + + //-- boolean hasDisplayBoxes() /** * Method hasDisplayText @@ -479,7 +514,9 @@ public class JGroup implements java.io.Serializable { public boolean hasDisplayText() { return this._has_displayText; - } //-- boolean hasDisplayText() + } + + //-- boolean hasDisplayText() /** * Method hasEnd @@ -491,7 +528,9 @@ public class JGroup implements java.io.Serializable { public boolean hasEnd() { return this._has_end; - } //-- boolean hasEnd() + } + + //-- boolean hasEnd() /** * Method hasOutlineColour @@ -503,7 +542,9 @@ public class JGroup implements java.io.Serializable { public boolean hasOutlineColour() { return this._has_outlineColour; - } //-- boolean hasOutlineColour() + } + + //-- boolean hasOutlineColour() /** * Method hasPidThreshold @@ -515,7 +556,9 @@ public class JGroup implements java.io.Serializable { public boolean hasPidThreshold() { return this._has_pidThreshold; - } //-- boolean hasPidThreshold() + } + + //-- boolean hasPidThreshold() /** * Method hasStart @@ -527,7 +570,9 @@ public class JGroup implements java.io.Serializable { public boolean hasStart() { return this._has_start; - } //-- boolean hasStart() + } + + //-- boolean hasStart() /** * Method isValid @@ -538,14 +583,19 @@ public class JGroup implements java.io.Serializable { */ public boolean isValid() { - try { + try + { validate(); } - catch (org.exolab.castor.xml.ValidationException vex) { + catch (org.exolab.castor.xml.ValidationException vex) + { return false; } + return true; - } //-- boolean isValid() + } + + //-- boolean isValid() /** * Method marshal @@ -555,11 +605,13 @@ public class JGroup implements java.io.Serializable { * @param out */ public void marshal(java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException { - Marshaller.marshal(this, out); - } //-- void marshal(java.io.Writer) + } + + //-- void marshal(java.io.Writer) /** * Method marshal @@ -569,11 +621,13 @@ public class JGroup implements java.io.Serializable { * @param handler */ public void marshal(org.xml.sax.ContentHandler handler) - throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + throws java.io.IOException, org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException { - Marshaller.marshal(this, handler); - } //-- void marshal(org.xml.sax.ContentHandler) + } + + //-- void marshal(org.xml.sax.ContentHandler) /** * Method removeAllSeq @@ -582,7 +636,9 @@ public class JGroup implements java.io.Serializable { public void removeAllSeq() { _seqList.removeAllElements(); - } //-- void removeAllSeq() + } + + //-- void removeAllSeq() /** * Method removeSeq @@ -596,8 +652,11 @@ public class JGroup implements java.io.Serializable { { java.lang.Object obj = _seqList.elementAt(index); _seqList.removeElementAt(index); - return ((java.lang.Integer)obj).intValue(); - } //-- int removeSeq(int) + + return ((java.lang.Integer) obj).intValue(); + } + + //-- int removeSeq(int) /** * Sets the value of field 'colour'. @@ -607,7 +666,9 @@ public class JGroup implements java.io.Serializable { public void setColour(java.lang.String colour) { this._colour = colour; - } //-- void setColour(java.lang.String) + } + + //-- void setColour(java.lang.String) /** * Sets the value of field 'colourText'. @@ -618,7 +679,9 @@ public class JGroup implements java.io.Serializable { { this._colourText = colourText; this._has_colourText = true; - } //-- void setColourText(boolean) + } + + //-- void setColourText(boolean) /** * Sets the value of field 'consThreshold'. @@ -629,7 +692,9 @@ public class JGroup implements java.io.Serializable { { this._consThreshold = consThreshold; this._has_consThreshold = true; - } //-- void setConsThreshold(int) + } + + //-- void setConsThreshold(int) /** * Sets the value of field 'displayBoxes'. @@ -640,7 +705,9 @@ public class JGroup implements java.io.Serializable { { this._displayBoxes = displayBoxes; this._has_displayBoxes = true; - } //-- void setDisplayBoxes(boolean) + } + + //-- void setDisplayBoxes(boolean) /** * Sets the value of field 'displayText'. @@ -651,7 +718,9 @@ public class JGroup implements java.io.Serializable { { this._displayText = displayText; this._has_displayText = true; - } //-- void setDisplayText(boolean) + } + + //-- void setDisplayText(boolean) /** * Sets the value of field 'end'. @@ -662,7 +731,9 @@ public class JGroup implements java.io.Serializable { { this._end = end; this._has_end = true; - } //-- void setEnd(int) + } + + //-- void setEnd(int) /** * Sets the value of field 'name'. @@ -672,7 +743,9 @@ public class JGroup implements java.io.Serializable { public void setName(java.lang.String name) { this._name = name; - } //-- void setName(java.lang.String) + } + + //-- void setName(java.lang.String) /** * Sets the value of field 'outlineColour'. @@ -683,7 +756,9 @@ public class JGroup implements java.io.Serializable { { this._outlineColour = outlineColour; this._has_outlineColour = true; - } //-- void setOutlineColour(int) + } + + //-- void setOutlineColour(int) /** * Sets the value of field 'pidThreshold'. @@ -694,7 +769,9 @@ public class JGroup implements java.io.Serializable { { this._pidThreshold = pidThreshold; this._has_pidThreshold = true; - } //-- void setPidThreshold(int) + } + + //-- void setPidThreshold(int) /** * Method setSeq @@ -708,11 +785,15 @@ public class JGroup implements java.io.Serializable { throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _seqList.size())) { + if ((index < 0) || (index > _seqList.size())) + { throw new IndexOutOfBoundsException(); } + _seqList.setElementAt(new java.lang.Integer(vSeq), index); - } //-- void setSeq(int, int) + } + + //-- void setSeq(int, int) /** * Method setSeq @@ -725,10 +806,14 @@ public class JGroup implements java.io.Serializable { { //-- copy array _seqList.removeAllElements(); - for (int i = 0; i < seqArray.length; i++) { + + for (int i = 0; i < seqArray.length; i++) + { _seqList.addElement(new java.lang.Integer(seqArray[i])); } - } //-- void setSeq(int) + } + + //-- void setSeq(int) /** * Sets the value of field 'start'. @@ -739,7 +824,9 @@ public class JGroup implements java.io.Serializable { { this._start = start; this._has_start = true; - } //-- void setStart(int) + } + + //-- void setStart(int) /** * Method unmarshal @@ -750,20 +837,24 @@ public class JGroup implements java.io.Serializable { * @return Object */ public static java.lang.Object unmarshal(java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException { - return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader); - } //-- java.lang.Object unmarshal(java.io.Reader) + return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, + reader); + } + + //-- java.lang.Object unmarshal(java.io.Reader) /** * Method validate * */ - public void validate() - throws org.exolab.castor.xml.ValidationException + public void validate() throws org.exolab.castor.xml.ValidationException { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); - } //-- void validate() + } + //-- void validate() }