X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FRna.java;h=e752126af159fc80265ea8e2cc06eb2010da46a0;hb=8e45ad740239d950f7ceb8b322bf30ee307f4e98;hp=e4a0d766dd4305c5cc610939e59fb601b8e110ee;hpb=aced09c4feeaf3406269442c14e54abeeb4cad81;p=jalview.git diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java index e4a0d76..e752126 100644 --- a/src/jalview/analysis/Rna.java +++ b/src/jalview/analysis/Rna.java @@ -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-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -26,6 +26,10 @@ 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 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 openingParsSet = new HashSet( 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 GetSimpleBPs(CharSequence line) throws WUSSParseException { - System.out.println(line); Hashtable> stacks = new Hashtable>(); Vector pairs = new Vector(); 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 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 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;