JAL-1620 version bump and release notes
[jalview.git] / src / jalview / binding / JSeq.java
old mode 100755 (executable)
new mode 100644 (file)
index 19ef2ae..ecf1eb0
@@ -1,26 +1,30 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
- * 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 file is part of Jalview.
  * 
- * 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.
+ * Jalview 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 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview 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
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.binding;
 
-// ---------------------------------/
-// - Imported classes and packages -/
-// ---------------------------------/
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.util.MessageManager;
 
 import org.exolab.castor.xml.Marshaller;
 import org.exolab.castor.xml.Unmarshaller;
@@ -107,7 +111,7 @@ public class JSeq implements java.io.Serializable
    * 
    * @param vFeatures
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    */
   public void addFeatures(final jalview.binding.Features vFeatures)
           throws java.lang.IndexOutOfBoundsException
@@ -121,7 +125,7 @@ public class JSeq implements java.io.Serializable
    * @param index
    * @param vFeatures
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    */
   public void addFeatures(final int index,
           final jalview.binding.Features vFeatures)
@@ -135,7 +139,7 @@ public class JSeq implements java.io.Serializable
    * 
    * @param vPdbids
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    */
   public void addPdbids(final jalview.binding.Pdbids vPdbids)
           throws java.lang.IndexOutOfBoundsException
@@ -149,7 +153,7 @@ public class JSeq implements java.io.Serializable
    * @param index
    * @param vPdbids
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    */
   public void addPdbids(final int index,
           final jalview.binding.Pdbids vPdbids)
@@ -159,28 +163,28 @@ public class JSeq implements java.io.Serializable
   }
 
   /**
-   */
+     */
   public void deleteColour()
   {
     this._has_colour = false;
   }
 
   /**
-   */
+     */
   public void deleteEnd()
   {
     this._has_end = false;
   }
 
   /**
-   */
+     */
   public void deleteId()
   {
     this._has_id = false;
   }
 
   /**
-   */
+     */
   public void deleteStart()
   {
     this._has_start = false;
@@ -231,7 +235,7 @@ public class JSeq implements java.io.Serializable
    * 
    * @param index
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    * @return the value of the jalview.binding.Features at the given index
    */
   public jalview.binding.Features getFeatures(final int index)
@@ -240,9 +244,11 @@ public class JSeq implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._featuresList.size())
     {
-      throw new IndexOutOfBoundsException("getFeatures: Index value '"
-              + index + "' not in range [0.."
-              + (this._featuresList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                 "getFeatures",
+                 Integer.valueOf(index).toString(),
+                 Integer.valueOf((this._featuresList.size() - 1)).toString()
+        })); 
     }
 
     return (jalview.binding.Features) _featuresList.get(index);
@@ -288,7 +294,7 @@ public class JSeq implements java.io.Serializable
    * 
    * @param index
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    * @return the value of the jalview.binding.Pdbids at the given index
    */
   public jalview.binding.Pdbids getPdbids(final int index)
@@ -297,9 +303,11 @@ public class JSeq implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._pdbidsList.size())
     {
-      throw new IndexOutOfBoundsException("getPdbids: Index value '"
-              + index + "' not in range [0.."
-              + (this._pdbidsList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                         "getPdbids",
+                         Integer.valueOf(index).toString(),
+                         Integer.valueOf((this._pdbidsList.size() - 1)).toString()
+          })); 
     }
 
     return (jalview.binding.Pdbids) _pdbidsList.get(index);
@@ -402,11 +410,10 @@ public class JSeq implements java.io.Serializable
    * 
    * @param out
    * @throws org.exolab.castor.xml.MarshalException
-   *                 if object is null or if any SAXException is thrown during
-   *                 marshaling
+   *           if object is null or if any SAXException is thrown during
+   *           marshaling
    * @throws org.exolab.castor.xml.ValidationException
-   *                 if this object is an invalid instance according to the
-   *                 schema
+   *           if this object is an invalid instance according to the schema
    */
   public void marshal(final java.io.Writer out)
           throws org.exolab.castor.xml.MarshalException,
@@ -420,13 +427,12 @@ public class JSeq implements java.io.Serializable
    * 
    * @param handler
    * @throws java.io.IOException
-   *                 if an IOException occurs during marshaling
+   *           if an IOException occurs during marshaling
    * @throws org.exolab.castor.xml.ValidationException
-   *                 if this object is an invalid instance according to the
-   *                 schema
+   *           if this object is an invalid instance according to the schema
    * @throws org.exolab.castor.xml.MarshalException
-   *                 if object is null or if any SAXException is thrown during
-   *                 marshaling
+   *           if object is null or if any SAXException is thrown during
+   *           marshaling
    */
   public void marshal(final org.xml.sax.ContentHandler handler)
           throws java.io.IOException,
@@ -437,14 +443,14 @@ public class JSeq implements java.io.Serializable
   }
 
   /**
-   */
+     */
   public void removeAllFeatures()
   {
     this._featuresList.clear();
   }
 
   /**
-   */
+     */
   public void removeAllPdbids()
   {
     this._pdbidsList.clear();
@@ -502,7 +508,7 @@ public class JSeq implements java.io.Serializable
    * Sets the value of field 'colour'.
    * 
    * @param colour
-   *                the value of field 'colour'.
+   *          the value of field 'colour'.
    */
   public void setColour(final int colour)
   {
@@ -514,7 +520,7 @@ public class JSeq implements java.io.Serializable
    * Sets the value of field 'end'.
    * 
    * @param end
-   *                the value of field 'end'.
+   *          the value of field 'end'.
    */
   public void setEnd(final int end)
   {
@@ -528,7 +534,7 @@ public class JSeq implements java.io.Serializable
    * @param index
    * @param vFeatures
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    */
   public void setFeatures(final int index,
           final jalview.binding.Features vFeatures)
@@ -537,9 +543,11 @@ public class JSeq implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._featuresList.size())
     {
-      throw new IndexOutOfBoundsException("setFeatures: Index value '"
-              + index + "' not in range [0.."
-              + (this._featuresList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                 "setFeatures",
+                 Integer.valueOf(index).toString(),
+                 Integer.valueOf((this._featuresList.size() - 1)).toString()
+        })); 
     }
 
     this._featuresList.set(index, vFeatures);
@@ -565,7 +573,7 @@ public class JSeq implements java.io.Serializable
    * Sets the value of field 'id'.
    * 
    * @param id
-   *                the value of field 'id'.
+   *          the value of field 'id'.
    */
   public void setId(final int id)
   {
@@ -579,7 +587,7 @@ public class JSeq implements java.io.Serializable
    * @param index
    * @param vPdbids
    * @throws java.lang.IndexOutOfBoundsException
-   *                 if the index given is outside the bounds of the collection
+   *           if the index given is outside the bounds of the collection
    */
   public void setPdbids(final int index,
           final jalview.binding.Pdbids vPdbids)
@@ -588,9 +596,11 @@ public class JSeq implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._pdbidsList.size())
     {
-      throw new IndexOutOfBoundsException("setPdbids: Index value '"
-              + index + "' not in range [0.."
-              + (this._pdbidsList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                         "setPdbids",
+                         Integer.valueOf(index).toString(),
+                         Integer.valueOf((this._pdbidsList.size() - 1)).toString()
+          })); 
     }
 
     this._pdbidsList.set(index, vPdbids);
@@ -616,7 +626,7 @@ public class JSeq implements java.io.Serializable
    * Sets the value of field 'start'.
    * 
    * @param start
-   *                the value of field 'start'.
+   *          the value of field 'start'.
    */
   public void setStart(final int start)
   {
@@ -629,11 +639,10 @@ public class JSeq implements java.io.Serializable
    * 
    * @param reader
    * @throws org.exolab.castor.xml.MarshalException
-   *                 if object is null or if any SAXException is thrown during
-   *                 marshaling
+   *           if object is null or if any SAXException is thrown during
+   *           marshaling
    * @throws org.exolab.castor.xml.ValidationException
-   *                 if this object is an invalid instance according to the
-   *                 schema
+   *           if this object is an invalid instance according to the schema
    * @return the unmarshaled jalview.binding.JSeq
    */
   public static jalview.binding.JSeq unmarshal(final java.io.Reader reader)
@@ -648,8 +657,7 @@ public class JSeq implements java.io.Serializable
    * 
    * 
    * @throws org.exolab.castor.xml.ValidationException
-   *                 if this object is an invalid instance according to the
-   *                 schema
+   *           if this object is an invalid instance according to the schema
    */
   public void validate() throws org.exolab.castor.xml.ValidationException
   {