@Immutable public class LongestCommonSubsequence extends Object implements StringDistance
Constructor and Description |
---|
LongestCommonSubsequence() |
Modifier and Type | Method and Description |
---|---|
double |
distance(String s1,
String s2)
Return the LCS distance between strings s1 and s2, computed as |s1| +
|s2| - 2 * |LCS(s1, s2)|.
|
int |
length(String s1,
String s2)
Return the length of Longest Common Subsequence (LCS) between strings s1
and s2.
|
public final double distance(String s1, String s2)
distance
in interface StringDistance
s1
- The first string to compare.s2
- The second string to compare.NullPointerException
- if s1 or s2 is null.public final int length(String s1, String s2)
s1
- The first string to compare.s2
- The second string to compare.NullPointerException
- if s1 or s2 is null.Copyright © 2018. All rights reserved.