@Test public void testGetLCSMatch() { String strA = "ABABAB"; String strB = "BABA"; List<String> sequence1 = splitStringToChars(strA); List<String> sequence2 = splitStringToChars(strB); String[] results; results = new String[] {"B", "A", "B", "A"}; LongestCommonSubsequence<String> lcsMatcher = new LongestCommonSubsequence<>(); List<IntPair> lcsMatch = lcsMatcher.getLCSMatch(sequence1, sequence2); assertEquals(results.length, lcsMatch.size()); }
public List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2) { List<T> mySeq1 = addDummyStart(seq1, null); List<T> mySeq2 = addDummyStart(seq2, null); double[][] table = getTable(mySeq1, mySeq2); return getBackTrace(table, mySeq1, mySeq2, mySeq1.size() - 1, mySeq2.size() - 1); }
LongestCommonSubsequence { public List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2) { List<T> mySeq1 = addDummyStart(seq1, null); List<T> mySeq2 = addDummyStart(seq2, null); double[][] table = getTable(mySeq1, mySeq2); return getBackTrace(table, mySeq1, mySeq2, mySeq1.size() - 1, mySeq2.size() - 1); } }
LongestCommonSubsequence { public List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2) { List<T> mySeq1 = addDummyStart(seq1, null); List<T> mySeq2 = addDummyStart(seq2, null); double[][] table = getTable(mySeq1, mySeq2); return getBackTrace(table, mySeq1, mySeq2, mySeq1.size() - 1, mySeq2.size() - 1); }  }
LongestCommonSubsequence { public List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2) { List<T> mySeq1 = addDummyStart(seq1, null); List<T> mySeq2 = addDummyStart(seq2, null); double[][] table = getTable(mySeq1, mySeq2); return getBackTrace(table, mySeq1, mySeq2, mySeq1.size() - 1, mySeq2.size() - 1); }  List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2); List<IntPair> getLCSMatch(T[] seq1, T[] seq2); Map<Integer, Integer> getLCSMatchMap(List<T> seq1, List<T> seq2); Map<Integer, Integer> getLCSMatchMap(T[] seq1, T[] seq2); static Map<Integer, Integer> getCharacterLCSMap(String s1, String s2); static List<IntPair> getCharacterLCS(String s1, String s2); }
LongestCommonSubsequence { public List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2) { List<T> mySeq1 = addDummyStart(seq1, null); List<T> mySeq2 = addDummyStart(seq2, null); double[][] table = getTable(mySeq1, mySeq2); return getBackTrace(table, mySeq1, mySeq2, mySeq1.size() - 1, mySeq2.size() - 1); }  List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2); List<IntPair> getLCSMatch(T[] seq1, T[] seq2); Map<Integer, Integer> getLCSMatchMap(List<T> seq1, List<T> seq2); Map<Integer, Integer> getLCSMatchMap(T[] seq1, T[] seq2); static Map<Integer, Integer> getCharacterLCSMap(String s1, String s2); static List<IntPair> getCharacterLCS(String s1, String s2);  }