@Test public void testGetLCSMatchSentence() { String s1 = "Dan bought two books."; String s2 = "Dan bought two books ."; List<IntPair> match = LongestCommonSubsequence.getCharacterLCS(s1, s2); for (IntPair obj : match) { assertEquals(s1.charAt(obj.getFirst() - 1), s2.charAt(obj.getSecond() - 1)); } }
public static List<IntPair> getCharacterLCS(String s1, String s2) { LongestCommonSubsequence<String> lcs = new LongestCommonSubsequence<>(); List<String> sequence1 = Arrays.asList(s1.split("(?!^)")); List<String> sequence2 = Arrays.asList(s2.split("(?!^)")); return lcs.getLCSMatch(sequence1, sequence2); }
LongestCommonSubsequence { public static List<IntPair> getCharacterLCS(String s1, String s2) { LongestCommonSubsequence<String> lcs = new LongestCommonSubsequence<>(); List<String> sequence1 = Arrays.asList(s1.split("(?!^)")); List<String> sequence2 = Arrays.asList(s2.split("(?!^)")); return lcs.getLCSMatch(sequence1, sequence2); } }
LongestCommonSubsequence { public static List<IntPair> getCharacterLCS(String s1, String s2) { LongestCommonSubsequence<String> lcs = new LongestCommonSubsequence<>(); List<String> sequence1 = Arrays.asList(s1.split("(?!^)")); List<String> sequence2 = Arrays.asList(s2.split("(?!^)")); return lcs.getLCSMatch(sequence1, sequence2); }  }
LongestCommonSubsequence { public static List<IntPair> getCharacterLCS(String s1, String s2) { LongestCommonSubsequence<String> lcs = new LongestCommonSubsequence<>(); List<String> sequence1 = Arrays.asList(s1.split("(?!^)")); List<String> sequence2 = Arrays.asList(s2.split("(?!^)")); return lcs.getLCSMatch(sequence1, sequence2); }  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 static List<IntPair> getCharacterLCS(String s1, String s2) { LongestCommonSubsequence<String> lcs = new LongestCommonSubsequence<>(); List<String> sequence1 = Arrays.asList(s1.split("(?!^)")); List<String> sequence2 = Arrays.asList(s2.split("(?!^)")); return lcs.getLCSMatch(sequence1, sequence2); }  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);  }