Formatted source
[jalview.git] / src / jalview / binding / SequenceSet.java
index 7ef5fe7..4300c39 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class SequenceSet.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class SequenceSet implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -79,34 +78,22 @@ public class SequenceSet implements java.io.Serializable {
      */\r
     private java.util.Vector _annotationList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public SequenceSet() {\r
         super();\r
         _sequenceList = new Vector();\r
         _annotationList = new Vector();\r
-    } //-- jalview.binding.SequenceSet()\r
+    }\r
+     //-- jalview.binding.SequenceSet()\r
+ //-----------/\r
 \r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addAnnotation\r
-     *\r
-     *\r
-     *\r
-     * @param vAnnotation\r
-     */\r
     public void addAnnotation(jalview.binding.Annotation vAnnotation)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _annotationList.addElement(vAnnotation);\r
-    } //-- void addAnnotation(jalview.binding.Annotation)\r
+    }\r
+     //-- void addAnnotation(jalview.binding.Annotation)\r
 \r
     /**\r
      * Method addAnnotation\r
@@ -117,10 +104,10 @@ public class SequenceSet implements java.io.Serializable {
      * @param vAnnotation\r
      */\r
     public void addAnnotation(int index, jalview.binding.Annotation vAnnotation)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _annotationList.insertElementAt(vAnnotation, index);\r
-    } //-- void addAnnotation(int, jalview.binding.Annotation)\r
+    }\r
+     //-- void addAnnotation(int, jalview.binding.Annotation)\r
 \r
     /**\r
      * Method addSequence\r
@@ -130,10 +117,10 @@ public class SequenceSet implements java.io.Serializable {
      * @param vSequence\r
      */\r
     public void addSequence(jalview.binding.Sequence vSequence)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _sequenceList.addElement(vSequence);\r
-    } //-- void addSequence(jalview.binding.Sequence)\r
+    }\r
+     //-- void addSequence(jalview.binding.Sequence)\r
 \r
     /**\r
      * Method addSequence\r
@@ -144,19 +131,19 @@ public class SequenceSet implements java.io.Serializable {
      * @param vSequence\r
      */\r
     public void addSequence(int index, jalview.binding.Sequence vSequence)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _sequenceList.insertElementAt(vSequence, index);\r
-    } //-- void addSequence(int, jalview.binding.Sequence)\r
+    }\r
+     //-- void addSequence(int, jalview.binding.Sequence)\r
 \r
     /**\r
      * Method deleteAligned\r
      *\r
      */\r
-    public void deleteAligned()\r
-    {\r
-        this._has_aligned= false;\r
-    } //-- void deleteAligned()\r
+    public void deleteAligned() {\r
+        this._has_aligned = false;\r
+    }\r
+     //-- void deleteAligned()\r
 \r
     /**\r
      * Method enumerateAnnotation\r
@@ -165,10 +152,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateAnnotation()\r
-    {\r
+    public java.util.Enumeration enumerateAnnotation() {\r
         return _annotationList.elements();\r
-    } //-- java.util.Enumeration enumerateAnnotation()\r
+    }\r
+     //-- java.util.Enumeration enumerateAnnotation()\r
 \r
     /**\r
      * Method enumerateSequence\r
@@ -177,10 +164,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateSequence()\r
-    {\r
+    public java.util.Enumeration enumerateSequence() {\r
         return _sequenceList.elements();\r
-    } //-- java.util.Enumeration enumerateSequence()\r
+    }\r
+     //-- java.util.Enumeration enumerateSequence()\r
 \r
     /**\r
      * Returns the value of field 'aligned'.\r
@@ -188,10 +175,10 @@ public class SequenceSet implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'aligned'.\r
      */\r
-    public boolean getAligned()\r
-    {\r
+    public boolean getAligned() {\r
         return this._aligned;\r
-    } //-- boolean getAligned()\r
+    }\r
+     //-- boolean getAligned()\r
 \r
     /**\r
      * Method getAnnotation\r
@@ -202,15 +189,15 @@ public class SequenceSet implements java.io.Serializable {
      * @return Annotation\r
      */\r
     public jalview.binding.Annotation getAnnotation(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _annotationList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Annotation) _annotationList.elementAt(index);\r
-    } //-- jalview.binding.Annotation getAnnotation(int)\r
+    }\r
+     //-- jalview.binding.Annotation getAnnotation(int)\r
 \r
     /**\r
      * Method getAnnotation\r
@@ -219,15 +206,17 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Annotation\r
      */\r
-    public jalview.binding.Annotation[] getAnnotation()\r
-    {\r
+    public jalview.binding.Annotation[] getAnnotation() {\r
         int size = _annotationList.size();\r
         jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Annotation[] getAnnotation()\r
+    }\r
+     //-- jalview.binding.Annotation[] getAnnotation()\r
 \r
     /**\r
      * Method getAnnotationCount\r
@@ -236,10 +225,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getAnnotationCount()\r
-    {\r
+    public int getAnnotationCount() {\r
         return _annotationList.size();\r
-    } //-- int getAnnotationCount()\r
+    }\r
+     //-- int getAnnotationCount()\r
 \r
     /**\r
      * Returns the value of field 'gapChar'.\r
@@ -247,10 +236,10 @@ public class SequenceSet implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'gapChar'.\r
      */\r
-    public java.lang.String getGapChar()\r
-    {\r
+    public java.lang.String getGapChar() {\r
         return this._gapChar;\r
-    } //-- java.lang.String getGapChar()\r
+    }\r
+     //-- java.lang.String getGapChar()\r
 \r
     /**\r
      * Method getSequence\r
@@ -261,15 +250,15 @@ public class SequenceSet implements java.io.Serializable {
      * @return Sequence\r
      */\r
     public jalview.binding.Sequence getSequence(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _sequenceList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
-    } //-- jalview.binding.Sequence getSequence(int)\r
+    }\r
+     //-- jalview.binding.Sequence getSequence(int)\r
 \r
     /**\r
      * Method getSequence\r
@@ -278,15 +267,17 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Sequence\r
      */\r
-    public jalview.binding.Sequence[] getSequence()\r
-    {\r
+    public jalview.binding.Sequence[] getSequence() {\r
         int size = _sequenceList.size();\r
         jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Sequence[] getSequence()\r
+    }\r
+     //-- jalview.binding.Sequence[] getSequence()\r
 \r
     /**\r
      * Method getSequenceCount\r
@@ -295,10 +286,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getSequenceCount()\r
-    {\r
+    public int getSequenceCount() {\r
         return _sequenceList.size();\r
-    } //-- int getSequenceCount()\r
+    }\r
+     //-- int getSequenceCount()\r
 \r
     /**\r
      * Method hasAligned\r
@@ -307,10 +298,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasAligned()\r
-    {\r
+    public boolean hasAligned() {\r
         return this._has_aligned;\r
-    } //-- boolean hasAligned()\r
+    }\r
+     //-- boolean hasAligned()\r
 \r
     /**\r
      * Method isValid\r
@@ -319,16 +310,16 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -338,11 +329,11 @@ public class SequenceSet implements java.io.Serializable {
      * @param out\r
      */\r
     public void marshal(java.io.Writer out)\r
-        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
-    {\r
-\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -352,29 +343,29 @@ public class SequenceSet implements java.io.Serializable {
      * @param handler\r
      */\r
     public void marshal(org.xml.sax.ContentHandler handler)\r
-        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
-    {\r
-\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllAnnotation\r
      *\r
      */\r
-    public void removeAllAnnotation()\r
-    {\r
+    public void removeAllAnnotation() {\r
         _annotationList.removeAllElements();\r
-    } //-- void removeAllAnnotation()\r
+    }\r
+     //-- void removeAllAnnotation()\r
 \r
     /**\r
      * Method removeAllSequence\r
      *\r
      */\r
-    public void removeAllSequence()\r
-    {\r
+    public void removeAllSequence() {\r
         _sequenceList.removeAllElements();\r
-    } //-- void removeAllSequence()\r
+    }\r
+     //-- void removeAllSequence()\r
 \r
     /**\r
      * Method removeAnnotation\r
@@ -384,12 +375,13 @@ public class SequenceSet implements java.io.Serializable {
      * @param index\r
      * @return Annotation\r
      */\r
-    public jalview.binding.Annotation removeAnnotation(int index)\r
-    {\r
+    public jalview.binding.Annotation removeAnnotation(int index) {\r
         java.lang.Object obj = _annotationList.elementAt(index);\r
         _annotationList.removeElementAt(index);\r
+\r
         return (jalview.binding.Annotation) obj;\r
-    } //-- jalview.binding.Annotation removeAnnotation(int)\r
+    }\r
+     //-- jalview.binding.Annotation removeAnnotation(int)\r
 \r
     /**\r
      * Method removeSequence\r
@@ -399,23 +391,24 @@ public class SequenceSet implements java.io.Serializable {
      * @param index\r
      * @return Sequence\r
      */\r
-    public jalview.binding.Sequence removeSequence(int index)\r
-    {\r
+    public jalview.binding.Sequence removeSequence(int index) {\r
         java.lang.Object obj = _sequenceList.elementAt(index);\r
         _sequenceList.removeElementAt(index);\r
+\r
         return (jalview.binding.Sequence) obj;\r
-    } //-- jalview.binding.Sequence removeSequence(int)\r
+    }\r
+     //-- jalview.binding.Sequence removeSequence(int)\r
 \r
     /**\r
      * Sets the value of field 'aligned'.\r
      *\r
      * @param aligned the value of field 'aligned'.\r
      */\r
-    public void setAligned(boolean aligned)\r
-    {\r
+    public void setAligned(boolean aligned) {\r
         this._aligned = aligned;\r
         this._has_aligned = true;\r
-    } //-- void setAligned(boolean)\r
+    }\r
+     //-- void setAligned(boolean)\r
 \r
     /**\r
      * Method setAnnotation\r
@@ -426,14 +419,15 @@ public class SequenceSet implements java.io.Serializable {
      * @param vAnnotation\r
      */\r
     public void setAnnotation(int index, jalview.binding.Annotation vAnnotation)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _annotationList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _annotationList.setElementAt(vAnnotation, index);\r
-    } //-- void setAnnotation(int, jalview.binding.Annotation)\r
+    }\r
+     //-- void setAnnotation(int, jalview.binding.Annotation)\r
 \r
     /**\r
      * Method setAnnotation\r
@@ -442,24 +436,25 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @param annotationArray\r
      */\r
-    public void setAnnotation(jalview.binding.Annotation[] annotationArray)\r
-    {\r
+    public void setAnnotation(jalview.binding.Annotation[] annotationArray) {\r
         //-- copy array\r
         _annotationList.removeAllElements();\r
+\r
         for (int i = 0; i < annotationArray.length; i++) {\r
             _annotationList.addElement(annotationArray[i]);\r
         }\r
-    } //-- void setAnnotation(jalview.binding.Annotation)\r
+    }\r
+     //-- void setAnnotation(jalview.binding.Annotation)\r
 \r
     /**\r
      * Sets the value of field 'gapChar'.\r
      *\r
      * @param gapChar the value of field 'gapChar'.\r
      */\r
-    public void setGapChar(java.lang.String gapChar)\r
-    {\r
+    public void setGapChar(java.lang.String gapChar) {\r
         this._gapChar = gapChar;\r
-    } //-- void setGapChar(java.lang.String)\r
+    }\r
+     //-- void setGapChar(java.lang.String)\r
 \r
     /**\r
      * Method setSequence\r
@@ -470,14 +465,15 @@ public class SequenceSet implements java.io.Serializable {
      * @param vSequence\r
      */\r
     public void setSequence(int index, jalview.binding.Sequence vSequence)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _sequenceList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _sequenceList.setElementAt(vSequence, index);\r
-    } //-- void setSequence(int, jalview.binding.Sequence)\r
+    }\r
+     //-- void setSequence(int, jalview.binding.Sequence)\r
 \r
     /**\r
      * Method setSequence\r
@@ -486,14 +482,15 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @param sequenceArray\r
      */\r
-    public void setSequence(jalview.binding.Sequence[] sequenceArray)\r
-    {\r
+    public void setSequence(jalview.binding.Sequence[] sequenceArray) {\r
         //-- copy array\r
         _sequenceList.removeAllElements();\r
+\r
         for (int i = 0; i < sequenceArray.length; i++) {\r
             _sequenceList.addElement(sequenceArray[i]);\r
         }\r
-    } //-- void setSequence(jalview.binding.Sequence)\r
+    }\r
+     //-- void setSequence(jalview.binding.Sequence)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -504,20 +501,20 @@ public class SequenceSet implements java.io.Serializable {
      * @return Object\r
      */\r
     public static java.lang.Object unmarshal(java.io.Reader reader)\r
-        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
-    {\r
-        return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class,\r
+            reader);\r
+    }\r
+     //-- java.lang.Object unmarshal(java.io.Reader)\r
 \r
     /**\r
      * Method validate\r
      *\r
      */\r
-    public void validate()\r
-        throws org.exolab.castor.xml.ValidationException\r
-    {\r
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r