JAL-1683 replace year/version strings with tokens in source
[jalview.git] / src / jalview / binding / SequenceSet.java
old mode 100755 (executable)
new mode 100644 (file)
index e348f9a..05da739
@@ -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-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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;
@@ -82,7 +86,7 @@ public class SequenceSet implements java.io.Serializable
    * 
    * @param vAnnotation
    * @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 addAnnotation(final jalview.binding.Annotation vAnnotation)
           throws java.lang.IndexOutOfBoundsException
@@ -96,7 +100,7 @@ public class SequenceSet implements java.io.Serializable
    * @param index
    * @param vAnnotation
    * @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 addAnnotation(final int index,
           final jalview.binding.Annotation vAnnotation)
@@ -110,7 +114,7 @@ public class SequenceSet implements java.io.Serializable
    * 
    * @param vSequence
    * @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 addSequence(final jalview.binding.Sequence vSequence)
           throws java.lang.IndexOutOfBoundsException
@@ -124,7 +128,7 @@ public class SequenceSet implements java.io.Serializable
    * @param index
    * @param vSequence
    * @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 addSequence(final int index,
           final jalview.binding.Sequence vSequence)
@@ -134,7 +138,7 @@ public class SequenceSet implements java.io.Serializable
   }
 
   /**
-   */
+     */
   public void deleteAligned()
   {
     this._has_aligned = false;
@@ -175,7 +179,7 @@ public class SequenceSet 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.Annotation at the given index
    */
   public jalview.binding.Annotation getAnnotation(final int index)
@@ -184,9 +188,11 @@ public class SequenceSet implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._annotationList.size())
     {
-      throw new IndexOutOfBoundsException("getAnnotation: Index value '"
-              + index + "' not in range [0.."
-              + (this._annotationList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                 "getAnnotation",
+                 Integer.valueOf(index).toString(),
+                 Integer.valueOf((this._annotationList.size() - 1)).toString()
+        })); 
     }
 
     return (jalview.binding.Annotation) _annotationList.get(index);
@@ -233,7 +239,7 @@ public class SequenceSet 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.Sequence at the given index
    */
   public jalview.binding.Sequence getSequence(final int index)
@@ -242,9 +248,11 @@ public class SequenceSet implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._sequenceList.size())
     {
-      throw new IndexOutOfBoundsException("getSequence: Index value '"
-              + index + "' not in range [0.."
-              + (this._sequenceList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                         "getSequence",
+                         Integer.valueOf(index).toString(),
+                         Integer.valueOf((this._sequenceList.size() - 1)).toString()
+          })); 
     }
 
     return (jalview.binding.Sequence) _sequenceList.get(index);
@@ -317,11 +325,10 @@ public class SequenceSet 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,
@@ -335,13 +342,12 @@ public class SequenceSet 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,
@@ -352,14 +358,14 @@ public class SequenceSet implements java.io.Serializable
   }
 
   /**
-   */
+     */
   public void removeAllAnnotation()
   {
     this._annotationList.clear();
   }
 
   /**
-   */
+     */
   public void removeAllSequence()
   {
     this._sequenceList.clear();
@@ -418,7 +424,7 @@ public class SequenceSet implements java.io.Serializable
    * Sets the value of field 'aligned'.
    * 
    * @param aligned
-   *                the value of field 'aligned'.
+   *          the value of field 'aligned'.
    */
   public void setAligned(final boolean aligned)
   {
@@ -432,7 +438,7 @@ public class SequenceSet implements java.io.Serializable
    * @param index
    * @param vAnnotation
    * @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 setAnnotation(final int index,
           final jalview.binding.Annotation vAnnotation)
@@ -441,9 +447,11 @@ public class SequenceSet implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._annotationList.size())
     {
-      throw new IndexOutOfBoundsException("setAnnotation: Index value '"
-              + index + "' not in range [0.."
-              + (this._annotationList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                 "setAnnotation",
+                 Integer.valueOf(index).toString(),
+                 Integer.valueOf((this._annotationList.size() - 1)).toString()
+        })); 
     }
 
     this._annotationList.set(index, vAnnotation);
@@ -470,7 +478,7 @@ public class SequenceSet implements java.io.Serializable
    * Sets the value of field 'gapChar'.
    * 
    * @param gapChar
-   *                the value of field 'gapChar'.
+   *          the value of field 'gapChar'.
    */
   public void setGapChar(final java.lang.String gapChar)
   {
@@ -483,7 +491,7 @@ public class SequenceSet implements java.io.Serializable
    * @param index
    * @param vSequence
    * @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 setSequence(final int index,
           final jalview.binding.Sequence vSequence)
@@ -492,9 +500,11 @@ public class SequenceSet implements java.io.Serializable
     // check bounds for index
     if (index < 0 || index >= this._sequenceList.size())
     {
-      throw new IndexOutOfBoundsException("setSequence: Index value '"
-              + index + "' not in range [0.."
-              + (this._sequenceList.size() - 1) + "]");
+        throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
+                         "setSequence",
+                         Integer.valueOf(index).toString(),
+                         Integer.valueOf((this._sequenceList.size() - 1)).toString()
+          })); 
     }
 
     this._sequenceList.set(index, vSequence);
@@ -521,11 +531,10 @@ public class SequenceSet 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.SequenceSet
    */
   public static jalview.binding.SequenceSet unmarshal(
@@ -541,8 +550,7 @@ public class SequenceSet 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
   {