JAL-1925 update source version in license
[jalview.git] / src / jalview / analysis / Rna.java
index e4a0d76..466e6c6 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
 
 package jalview.analysis;
 
+import jalview.analysis.SecStrConsensus.SimpleBP;
+import jalview.datamodel.SequenceFeature;
+import jalview.util.MessageManager;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -33,24 +37,18 @@ import java.util.Hashtable;
 import java.util.Stack;
 import java.util.Vector;
 
-import jalview.analysis.SecStrConsensus.SimpleBP;
-import jalview.datamodel.SequenceFeature;
-import jalview.util.MessageManager;
-
 public class Rna
 {
 
   static Hashtable<Integer, Integer> pairHash = new Hashtable();
 
-  private static final Character[] openingPars =
-  { '(', '[', '{', '<', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
-      'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
-      'Y', 'Z' };
+  private static final Character[] openingPars = { '(', '[', '{', '<', 'A',
+      'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+      'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
 
-  private static final Character[] closingPars =
-  { ')', ']', '}', '>', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
-      'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
-      'y', 'z' };
+  private static final Character[] closingPars = { ')', ']', '}', '>', 'a',
+      'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+      'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
 
   private static HashSet<Character> openingParsSet = new HashSet<Character>(
           Arrays.asList(openingPars));
@@ -65,7 +63,7 @@ public class Rna
     {
       for (int i = 0; i < openingPars.length; i++)
       {
-        System.out.println(closingPars[i] + "->" + openingPars[i]);
+        // System.out.println(closingPars[i] + "->" + openingPars[i]);
         put(closingPars[i], openingPars[i]);
       }
     }
@@ -86,7 +84,11 @@ public class Rna
   {
     if (!isClosingParenthesis(closingParenthesis))
     {
-      throw new WUSSParseException(MessageManager.formatMessage("exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis", new String[]{new StringBuffer(closingParenthesis).toString()}), -1);
+      throw new WUSSParseException(
+              MessageManager.formatMessage(
+                      "exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis",
+                      new String[] { new StringBuffer(closingParenthesis)
+                              .toString() }), -1);
     }
 
     return closingToOpening.get(closingParenthesis);
@@ -107,7 +109,6 @@ public class Rna
   public static Vector<SimpleBP> GetSimpleBPs(CharSequence line)
           throws WUSSParseException
   {
-    System.out.println(line);
     Hashtable<Character, Stack<Integer>> stacks = new Hashtable<Character, Stack<Integer>>();
     Vector<SimpleBP> pairs = new Vector<SimpleBP>();
     int i = 0;
@@ -131,14 +132,18 @@ public class Rna
 
         if (!stacks.containsKey(opening))
         {
-          throw new WUSSParseException(MessageManager.formatMessage("exception.mismatched_unseen_closing_char", new String[]{new StringBuffer(base).toString()}), i);
+          throw new WUSSParseException(MessageManager.formatMessage(
+                  "exception.mismatched_unseen_closing_char",
+                  new String[] { new StringBuffer(base).toString() }), i);
         }
 
         Stack<Integer> stack = stacks.get(opening);
         if (stack.isEmpty())
         {
           // error whilst parsing i'th position. pass back
-          throw new WUSSParseException(MessageManager.formatMessage("exception.mismatched_closing_char", new String[]{new StringBuffer(base).toString()}), i);
+          throw new WUSSParseException(MessageManager.formatMessage(
+                  "exception.mismatched_closing_char",
+                  new String[] { new StringBuffer(base).toString() }), i);
         }
         int temp = stack.pop();
 
@@ -151,7 +156,10 @@ public class Rna
       Stack<Integer> stack = stacks.get(opening);
       if (!stack.empty())
       {
-        throw new WUSSParseException(MessageManager.formatMessage("exception.mismatched_opening_char", new String[]{new StringBuffer(opening).toString(),Integer.valueOf(stack.pop()).toString()}), i);
+        throw new WUSSParseException(MessageManager.formatMessage(
+                "exception.mismatched_opening_char",
+                new String[] { new StringBuffer(opening).toString(),
+                    Integer.valueOf(stack.pop()).toString() }), i);
       }
     }
     return pairs;