@@ -6,9 +6,9 @@ import 'dart:math' as math;
66
77/// The value returned by [levenshtein] if the distance is determined
88/// to be over the specified threshold.
9- const int LEVENSHTEIN_MAX = 1 << 20 ;
9+ const int levenshteinMax = 1 << 20 ;
1010
11- const int _MAX_VALUE = 1 << 10 ;
11+ const int _maxValue = 1 << 10 ;
1212
1313/// Find the Levenshtein distance between two [String] s if it's less than or
1414/// equal to a given threshold.
@@ -41,14 +41,14 @@ int levenshtein(
4141 // if one string is empty,
4242 // the edit distance is necessarily the length of the other
4343 if (sLength == 0 ) {
44- return tLength <= threshold ? tLength : LEVENSHTEIN_MAX ;
44+ return tLength <= threshold ? tLength : levenshteinMax ;
4545 }
4646 if (tLength == 0 ) {
47- return sLength <= threshold ? sLength : LEVENSHTEIN_MAX ;
47+ return sLength <= threshold ? sLength : levenshteinMax ;
4848 }
4949 // the distance can never be less than abs(s_len - t_len)
5050 if ((sLength - tLength).abs () > threshold) {
51- return LEVENSHTEIN_MAX ;
51+ return levenshteinMax ;
5252 }
5353
5454 // swap the two strings to consume less memory
@@ -75,8 +75,8 @@ int levenshtein(
7575
7676 // these fills ensure that the value above the rightmost entry of our
7777 // stripe will be ignored in following loop iterations
78- _setRange (p, boundary, p.length, _MAX_VALUE );
79- _setRange (d, 0 , d.length, _MAX_VALUE );
78+ _setRange (p, boundary, p.length, _maxValue );
79+ _setRange (d, 0 , d.length, _maxValue );
8080
8181 // iterates through t
8282 for (var j = 1 ; j <= tLength; j++ ) {
@@ -90,12 +90,12 @@ int levenshtein(
9090
9191 // the stripe may lead off of the table if s and t are of different sizes
9292 if (min > max) {
93- return LEVENSHTEIN_MAX ;
93+ return levenshteinMax ;
9494 }
9595
9696 // ignore entry left of leftmost
9797 if (min > 1 ) {
98- d[min - 1 ] = _MAX_VALUE ;
98+ d[min - 1 ] = _maxValue ;
9999 }
100100
101101 // iterates through [min, max] in s
@@ -121,7 +121,7 @@ int levenshtein(
121121 return p[sLength];
122122 }
123123
124- return LEVENSHTEIN_MAX ;
124+ return levenshteinMax ;
125125}
126126
127127void _setRange (List <int > a, int start, int end, int value) {
0 commit comments