19 using Lucene.Net.Support;
20 using Lucene.Net.Util;
22 namespace Lucene.Net.Analysis
34 private int[] offsets;
44 protected internal override int Correct(
int currentOff)
46 if (offsets == null || currentOff < offsets[0])
52 if (currentOff >= offsets[hi])
53 return currentOff + diffs[hi];
61 if (currentOff < offsets[mid])
63 else if (currentOff > offsets[mid])
66 return currentOff + diffs[mid];
69 if (currentOff < offsets[mid])
70 return mid == 0 ? currentOff : currentOff + diffs[mid - 1];
71 return currentOff + diffs[mid];
74 protected int LastCumulativeDiff
78 return offsets == null ? 0 : diffs[size - 1];
82 [Obsolete(
"Use LastCumulativeDiff property instead")]
83 protected int GetLastCumulativeDiff()
85 return LastCumulativeDiff;
88 protected void AddOffCorrectMap(
int off,
int cumulativeDiff)
92 offsets =
new int[64];
95 else if (size == offsets.Length)
102 diffs[size++] = cumulativeDiff;