*/
public static boolean isOpeningParenthesis(char c)
{
- return ('A' <= c && c <= 'Z' || c == '(' || c == '[' || c == '{' || c == '<');
+ return ('A' <= c && c <= 'Z' || c == '(' || c == '[' || c == '{'
+ || c == '<');
}
/**
*/
public static boolean isClosingParenthesis(char c)
{
- return ('a' <= c && c <= 'z' || c == ')' || c == ']' || c == '}' || c == '>');
+ return ('a' <= c && c <= 'z' || c == ')' || c == ']' || c == '}'
+ || c == '>');
}
/**
if (!stacks.containsKey(opening))
{
throw new WUSSParseException(MessageManager.formatMessage(
- "exception.mismatched_unseen_closing_char",
- new String[] { String.valueOf(base) }), i);
+ "exception.mismatched_unseen_closing_char", new String[]
+ { String.valueOf(base) }), i);
}
Stack<Integer> stack = stacks.get(opening);
{
// error whilst parsing i'th position. pass back
throw new WUSSParseException(MessageManager.formatMessage(
- "exception.mismatched_closing_char",
- new String[] { String.valueOf(base) }), i);
+ "exception.mismatched_closing_char", new String[]
+ { String.valueOf(base) }), i);
}
int temp = stack.pop();
* i (length of input string)
*/
throw new WUSSParseException(MessageManager.formatMessage(
- "exception.mismatched_opening_char",
- new String[] { String.valueOf(opening),
- String.valueOf(stack.pop()) }), i);
+ "exception.mismatched_opening_char", new String[]
+ { String.valueOf(opening), String.valueOf(stack.pop()) }),
+ i);
}
}
return pairs;
}
/**
- * Answers true if the base-pair is either a canonical (A-T/U, C-G) or a
- * wobble (G-T/U) pair (either way round), else false
+ * Answers true if the base-pair is either a Watson-Crick (A:T/U, C:G) or a
+ * wobble (G:T/U) pair (either way round), else false
*
* @param first
* @param second
{
second -= 32;
}
-
+
switch (first)
{
case 'A':
}
/**
+ * Answers true if the base-pair is Watson-Crick - (A:T/U or C:G, either way
+ * round), else false
+ *
+ * @param first
+ * @param second
+ * @return
+ */
+ public static boolean isCanonicalPair(char first, char second)
+ {
+
+ if (first > 'Z')
+ {
+ first -= 32;
+ }
+ if (second > 'Z')
+ {
+ second -= 32;
+ }
+
+ switch (first)
+ {
+ case 'A':
+ switch (second)
+ {
+ case 'T':
+ case 'U':
+ return true;
+ }
+ break;
+ case 'G':
+ switch (second)
+ {
+ case 'C':
+ return true;
+ }
+ break;
+ case 'C':
+ switch (second)
+ {
+ case 'G':
+ return true;
+ }
+ break;
+ case 'T':
+ case 'U':
+ switch (second)
+ {
+ case 'A':
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
* Returns the matching close pair symbol for the given opening symbol.
* Currently returns a-z for A-Z, or )]}> for ([{<, or the input symbol if it
* is not a valid opening symbol.