public class SmithWaterman extends Object implements StringMetric
Implementation uses the implementation as described by Smith and Waterman. This implementation uses quadratic space and cubic time.
This class is immutable and thread-safe if its substitution and gap functions are.
Constructor and Description |
---|
SmithWaterman()
Constructs a new Smith Waterman metric.
|
SmithWaterman(Gap gap,
Substitution substitution,
int windowSize)
Constructs a new Smith Waterman metric.
|
Modifier and Type | Method and Description |
---|---|
float |
compare(String a,
String b)
Measures the similarity between strings a and b.
|
String |
toString() |
public SmithWaterman()
-5.0 - gapLength
a -3.0
substitution penalty
for mismatches, 5.0
for matches.public SmithWaterman(Gap gap, Substitution substitution, int windowSize)
gap
- a gap function to score gaps bysubstitution
- a substitution function to score substitutions bywindowSize
- a non-negative window in whichpublic float compare(String a, String b)
StringMetric
compare
in interface Metric<String>
compare
in interface StringMetric
a
- string a to compareb
- string b to compareCopyright © 2014–2018. All rights reserved.