X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbinding%2FJGroup.java;h=3b5c0b862161a01f8d47c221ac47c2542fcfe1d4;hb=588042b69abf8e60bcc950b24c283933c7dd422f;hp=eef4a28a18f3b4c91f67ed2593cc5de69adfb53a;hpb=5cd8e373c75fb348ecda4d94d8a46468fb92756d;p=jalview.git diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java index eef4a28..3b5c0b8 100755 --- a/src/jalview/binding/JGroup.java +++ b/src/jalview/binding/JGroup.java @@ -4,7 +4,6 @@ * Schema. * $Id$ */ - /* * Jalview - A Sequence Alignment Editor and Viewer * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle @@ -23,24 +22,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ +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; +//---------------------------------/ +//- 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. @@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler; * @version $Revision$ $Date$ */ public class JGroup implements java.io.Serializable { - - - //--------------------------/ - //- Class/Member Variables -/ + //--------------------------/ + //- Class/Member Variables -/ //--------------------------/ /** @@ -149,33 +148,20 @@ public class JGroup implements java.io.Serializable { */ private java.util.Vector _seqList; - - //----------------/ - //- Constructors -/ //----------------/ - + //- Constructors -/ + //----------------/ public JGroup() { super(); _seqList = new Vector(); - } //-- jalview.binding.JGroup() - + } + //-- jalview.binding.JGroup() + //-----------/ - //-----------/ - //- Methods -/ - //-----------/ - - /** - * Method addSeq - * - * - * - * @param vSeq - */ - 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 @@ -186,82 +172,82 @@ public class JGroup implements java.io.Serializable { * @param vSeq */ public void addSeq(int index, int vSeq) - throws java.lang.IndexOutOfBoundsException - { + throws java.lang.IndexOutOfBoundsException { _seqList.insertElementAt(new java.lang.Integer(vSeq), index); - } //-- void addSeq(int, int) + } + //-- void addSeq(int, int) /** * Method deleteColourText * */ - public void deleteColourText() - { - this._has_colourText= false; - } //-- void deleteColourText() + public void deleteColourText() { + this._has_colourText = false; + } + //-- void deleteColourText() /** * Method deleteConsThreshold * */ - public void deleteConsThreshold() - { - this._has_consThreshold= false; - } //-- void deleteConsThreshold() + public void deleteConsThreshold() { + this._has_consThreshold = false; + } + //-- void deleteConsThreshold() /** * Method deleteDisplayBoxes * */ - public void deleteDisplayBoxes() - { - this._has_displayBoxes= false; - } //-- void deleteDisplayBoxes() + public void deleteDisplayBoxes() { + this._has_displayBoxes = false; + } + //-- void deleteDisplayBoxes() /** * Method deleteDisplayText * */ - public void deleteDisplayText() - { - this._has_displayText= false; - } //-- void deleteDisplayText() + public void deleteDisplayText() { + this._has_displayText = false; + } + //-- void deleteDisplayText() /** * Method deleteEnd * */ - public void deleteEnd() - { - this._has_end= false; - } //-- void deleteEnd() + public void deleteEnd() { + this._has_end = false; + } + //-- void deleteEnd() /** * Method deleteOutlineColour * */ - public void deleteOutlineColour() - { - this._has_outlineColour= false; - } //-- void deleteOutlineColour() + public void deleteOutlineColour() { + this._has_outlineColour = false; + } + //-- void deleteOutlineColour() /** * Method deletePidThreshold * */ - public void deletePidThreshold() - { - this._has_pidThreshold= false; - } //-- void deletePidThreshold() + public void deletePidThreshold() { + this._has_pidThreshold = false; + } + //-- void deletePidThreshold() /** * Method deleteStart * */ - public void deleteStart() - { - this._has_start= false; - } //-- void deleteStart() + public void deleteStart() { + this._has_start = false; + } + //-- void deleteStart() /** * Method enumerateSeq @@ -270,10 +256,10 @@ public class JGroup implements java.io.Serializable { * * @return Enumeration */ - public java.util.Enumeration enumerateSeq() - { + public java.util.Enumeration enumerateSeq() { return _seqList.elements(); - } //-- java.util.Enumeration enumerateSeq() + } + //-- java.util.Enumeration enumerateSeq() /** * Returns the value of field 'colour'. @@ -281,10 +267,10 @@ public class JGroup implements java.io.Serializable { * @return String * @return the value of field 'colour'. */ - public java.lang.String getColour() - { + public java.lang.String getColour() { return this._colour; - } //-- java.lang.String getColour() + } + //-- java.lang.String getColour() /** * Returns the value of field 'colourText'. @@ -292,10 +278,10 @@ public class JGroup implements java.io.Serializable { * @return boolean * @return the value of field 'colourText'. */ - public boolean getColourText() - { + public boolean getColourText() { return this._colourText; - } //-- boolean getColourText() + } + //-- boolean getColourText() /** * Returns the value of field 'consThreshold'. @@ -303,10 +289,10 @@ public class JGroup implements java.io.Serializable { * @return int * @return the value of field 'consThreshold'. */ - public int getConsThreshold() - { + public int getConsThreshold() { return this._consThreshold; - } //-- int getConsThreshold() + } + //-- int getConsThreshold() /** * Returns the value of field 'displayBoxes'. @@ -314,10 +300,10 @@ public class JGroup implements java.io.Serializable { * @return boolean * @return the value of field 'displayBoxes'. */ - public boolean getDisplayBoxes() - { + public boolean getDisplayBoxes() { return this._displayBoxes; - } //-- boolean getDisplayBoxes() + } + //-- boolean getDisplayBoxes() /** * Returns the value of field 'displayText'. @@ -325,10 +311,10 @@ public class JGroup implements java.io.Serializable { * @return boolean * @return the value of field 'displayText'. */ - public boolean getDisplayText() - { + public boolean getDisplayText() { return this._displayText; - } //-- boolean getDisplayText() + } + //-- boolean getDisplayText() /** * Returns the value of field 'end'. @@ -336,10 +322,10 @@ public class JGroup implements java.io.Serializable { * @return int * @return the value of field 'end'. */ - public int getEnd() - { + public int getEnd() { return this._end; - } //-- int getEnd() + } + //-- int getEnd() /** * Returns the value of field 'name'. @@ -347,10 +333,10 @@ public class JGroup implements java.io.Serializable { * @return String * @return the value of field 'name'. */ - public java.lang.String getName() - { + public java.lang.String getName() { return this._name; - } //-- java.lang.String getName() + } + //-- java.lang.String getName() /** * Returns the value of field 'outlineColour'. @@ -358,10 +344,10 @@ public class JGroup implements java.io.Serializable { * @return int * @return the value of field 'outlineColour'. */ - public int getOutlineColour() - { + public int getOutlineColour() { return this._outlineColour; - } //-- int getOutlineColour() + } + //-- int getOutlineColour() /** * Returns the value of field 'pidThreshold'. @@ -369,10 +355,10 @@ public class JGroup implements java.io.Serializable { * @return int * @return the value of field 'pidThreshold'. */ - public int getPidThreshold() - { + public int getPidThreshold() { return this._pidThreshold; - } //-- int getPidThreshold() + } + //-- int getPidThreshold() /** * Method getSeq @@ -382,16 +368,15 @@ 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())) { 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 @@ -400,15 +385,17 @@ public class JGroup implements java.io.Serializable { * * @return int */ - public int[] getSeq() - { + public int[] getSeq() { 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(); + mArray[index] = ((java.lang.Integer) _seqList.elementAt(index)).intValue(); } + return mArray; - } //-- int[] getSeq() + } + //-- int[] getSeq() /** * Method getSeqCount @@ -417,10 +404,10 @@ public class JGroup implements java.io.Serializable { * * @return int */ - public int getSeqCount() - { + public int getSeqCount() { return _seqList.size(); - } //-- int getSeqCount() + } + //-- int getSeqCount() /** * Returns the value of field 'start'. @@ -428,10 +415,10 @@ public class JGroup implements java.io.Serializable { * @return int * @return the value of field 'start'. */ - public int getStart() - { + public int getStart() { return this._start; - } //-- int getStart() + } + //-- int getStart() /** * Method hasColourText @@ -440,10 +427,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasColourText() - { + public boolean hasColourText() { return this._has_colourText; - } //-- boolean hasColourText() + } + //-- boolean hasColourText() /** * Method hasConsThreshold @@ -452,10 +439,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasConsThreshold() - { + public boolean hasConsThreshold() { return this._has_consThreshold; - } //-- boolean hasConsThreshold() + } + //-- boolean hasConsThreshold() /** * Method hasDisplayBoxes @@ -464,10 +451,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasDisplayBoxes() - { + public boolean hasDisplayBoxes() { return this._has_displayBoxes; - } //-- boolean hasDisplayBoxes() + } + //-- boolean hasDisplayBoxes() /** * Method hasDisplayText @@ -476,10 +463,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasDisplayText() - { + public boolean hasDisplayText() { return this._has_displayText; - } //-- boolean hasDisplayText() + } + //-- boolean hasDisplayText() /** * Method hasEnd @@ -488,10 +475,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasEnd() - { + public boolean hasEnd() { return this._has_end; - } //-- boolean hasEnd() + } + //-- boolean hasEnd() /** * Method hasOutlineColour @@ -500,10 +487,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasOutlineColour() - { + public boolean hasOutlineColour() { return this._has_outlineColour; - } //-- boolean hasOutlineColour() + } + //-- boolean hasOutlineColour() /** * Method hasPidThreshold @@ -512,10 +499,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasPidThreshold() - { + public boolean hasPidThreshold() { return this._has_pidThreshold; - } //-- boolean hasPidThreshold() + } + //-- boolean hasPidThreshold() /** * Method hasStart @@ -524,10 +511,10 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean hasStart() - { + public boolean hasStart() { return this._has_start; - } //-- boolean hasStart() + } + //-- boolean hasStart() /** * Method isValid @@ -536,16 +523,16 @@ public class JGroup implements java.io.Serializable { * * @return boolean */ - public boolean isValid() - { + public boolean isValid() { 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 +542,11 @@ 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,20 +556,20 @@ 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 * */ - public void removeAllSeq() - { + public void removeAllSeq() { _seqList.removeAllElements(); - } //-- void removeAllSeq() + } + //-- void removeAllSeq() /** * Method removeSeq @@ -592,109 +579,110 @@ public class JGroup implements java.io.Serializable { * @param index * @return int */ - public int removeSeq(int index) - { + public int removeSeq(int index) { 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'. * * @param colour the value of field 'colour'. */ - public void setColour(java.lang.String colour) - { + 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'. * * @param colourText the value of field 'colourText'. */ - public void setColourText(boolean colourText) - { + public void setColourText(boolean colourText) { this._colourText = colourText; this._has_colourText = true; - } //-- void setColourText(boolean) + } + //-- void setColourText(boolean) /** * Sets the value of field 'consThreshold'. * * @param consThreshold the value of field 'consThreshold'. */ - public void setConsThreshold(int consThreshold) - { + public void setConsThreshold(int consThreshold) { this._consThreshold = consThreshold; this._has_consThreshold = true; - } //-- void setConsThreshold(int) + } + //-- void setConsThreshold(int) /** * Sets the value of field 'displayBoxes'. * * @param displayBoxes the value of field 'displayBoxes'. */ - public void setDisplayBoxes(boolean displayBoxes) - { + public void setDisplayBoxes(boolean displayBoxes) { this._displayBoxes = displayBoxes; this._has_displayBoxes = true; - } //-- void setDisplayBoxes(boolean) + } + //-- void setDisplayBoxes(boolean) /** * Sets the value of field 'displayText'. * * @param displayText the value of field 'displayText'. */ - public void setDisplayText(boolean displayText) - { + public void setDisplayText(boolean displayText) { this._displayText = displayText; this._has_displayText = true; - } //-- void setDisplayText(boolean) + } + //-- void setDisplayText(boolean) /** * Sets the value of field 'end'. * * @param end the value of field 'end'. */ - public void setEnd(int end) - { + public void setEnd(int end) { this._end = end; this._has_end = true; - } //-- void setEnd(int) + } + //-- void setEnd(int) /** * Sets the value of field 'name'. * * @param name the value of field 'name'. */ - public void setName(java.lang.String name) - { + 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'. * * @param outlineColour the value of field 'outlineColour'. */ - public void setOutlineColour(int outlineColour) - { + public void setOutlineColour(int outlineColour) { this._outlineColour = outlineColour; this._has_outlineColour = true; - } //-- void setOutlineColour(int) + } + //-- void setOutlineColour(int) /** * Sets the value of field 'pidThreshold'. * * @param pidThreshold the value of field 'pidThreshold'. */ - public void setPidThreshold(int pidThreshold) - { + public void setPidThreshold(int pidThreshold) { this._pidThreshold = pidThreshold; this._has_pidThreshold = true; - } //-- void setPidThreshold(int) + } + //-- void setPidThreshold(int) /** * Method setSeq @@ -705,14 +693,15 @@ public class JGroup implements java.io.Serializable { * @param vSeq */ public void setSeq(int index, int vSeq) - throws java.lang.IndexOutOfBoundsException - { + throws java.lang.IndexOutOfBoundsException { //-- check bounds for index 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 @@ -721,25 +710,26 @@ public class JGroup implements java.io.Serializable { * * @param seqArray */ - public void setSeq(int[] seqArray) - { + public void setSeq(int[] seqArray) { //-- copy array _seqList.removeAllElements(); + 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'. * * @param start the value of field 'start'. */ - public void setStart(int start) - { + public void setStart(int start) { this._start = start; this._has_start = true; - } //-- void setStart(int) + } + //-- void setStart(int) /** * Method unmarshal @@ -750,20 +740,20 @@ 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 - { - return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader); - } //-- java.lang.Object unmarshal(java.io.Reader) + 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) /** * 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() }