- Small distance matrix initialization change.

Submitted by: Christoph Goller
Reviewed by: Otis


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150018 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2003-09-11 10:02:26 +00:00
parent 2af2d85877
commit 6ecbab80ed
1 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ public final class FuzzyTermEnum extends FilteredTermEnum {
* This static array saves us from the time required to create a new array * This static array saves us from the time required to create a new array
* everytime editDistance is called. * everytime editDistance is called.
*/ */
private int e[][] = new int[0][0]; private int e[][] = new int[1][1];
/** /**
Levenshtein distance also known as edit distance is a measure of similiarity Levenshtein distance also known as edit distance is a measure of similiarity
@ -137,7 +137,7 @@ public final class FuzzyTermEnum extends FilteredTermEnum {
*/ */
private final int editDistance(String s, String t, int n, int m) { private final int editDistance(String s, String t, int n, int m) {
if (e.length <= n || e[0].length <= m) { if (e.length <= n || e[0].length <= m) {
e = new int[Math.max(e.length, n+1)][Math.max(e.length, m+1)]; e = new int[Math.max(e.length, n+1)][Math.max(e[0].length, m+1)];
} }
int d[][] = e; // matrix int d[][] = e; // matrix
int i; // iterates through s int i; // iterates through s