X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FComparison.java;h=1326647f26e737edb5d63f7f635486e38c51b998;hb=ca0a70b02a67f842a195319414d241ffa336656b;hp=0beb45bcefca1ad9319236dac9d93bd18af68636;hpb=65675b2d016736f8ca4dfb2493863c4d53cec591;p=jalview.git diff --git a/src/jalview/util/Comparison.java b/src/jalview/util/Comparison.java index 0beb45b..1326647 100644 --- a/src/jalview/util/Comparison.java +++ b/src/jalview/util/Comparison.java @@ -415,4 +415,29 @@ public class Comparison .size()]); return isNucleotide(oneDArray); } + + /** + * Compares two residues either case sensitively or case insensitively + * depending on the caseSensitive flag + * + * @param c1 + * first char + * @param c2 + * second char to compare with + * @param caseSensitive + * if true comparison will be case sensitive otherwise its not + * @return + */ + public static boolean isSameResidue(char c1, char c2, + boolean caseSensitive) + { + if (caseSensitive) + { + return (c1 == c2); + } + else + { + return Character.toUpperCase(c1) == Character.toUpperCase(c2); + } + } }