You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/10/02 10:16:41 UTC
[10/49] lucenenet git commit: .NETify FST: Private/protected fields
should be camelCase.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
index 3e19974..dfdaf67 100644
--- a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
@@ -28,19 +28,19 @@ namespace Lucene.Net.Util.Fst
public abstract class FSTEnum<T>
{
- protected internal readonly FST<T> Fst;
+ protected internal readonly FST<T> fst;
- protected internal FST<T>.Arc<T>[] Arcs = new FST<T>.Arc<T>[10];
+ protected internal FST<T>.Arc<T>[] arcs = new FST<T>.Arc<T>[10];
// outputs are cumulative
- protected internal T[] Output = new T[10];
+ protected internal T[] output = new T[10];
protected internal readonly T NO_OUTPUT;
- protected internal readonly FST<T>.BytesReader FstReader;
- protected internal readonly FST<T>.Arc<T> ScratchArc = new FST<T>.Arc<T>();
+ protected internal readonly FST<T>.BytesReader fstReader;
+ protected internal readonly FST<T>.Arc<T> scratchArc = new FST<T>.Arc<T>();
- protected internal int Upto;
- protected internal int TargetLength;
+ protected internal int upto;
+ protected internal int targetLength;
/// <summary>
/// doFloor controls the behavior of advance: if it's true
@@ -49,11 +49,11 @@ namespace Lucene.Net.Util.Fst
/// </summary>
protected internal FSTEnum(FST<T> fst)
{
- this.Fst = fst;
- FstReader = fst.BytesReader;
+ this.fst = fst;
+ fstReader = fst.BytesReader;
NO_OUTPUT = fst.Outputs.NoOutput;
fst.GetFirstArc(GetArc(0));
- Output[0] = NO_OUTPUT;
+ output[0] = NO_OUTPUT;
}
protected internal abstract int TargetLabel { get; }
@@ -68,18 +68,18 @@ namespace Lucene.Net.Util.Fst
/// </summary>
protected internal void RewindPrefix()
{
- if (Upto == 0)
+ if (upto == 0)
{
//System.out.println(" init");
- Upto = 1;
- Fst.ReadFirstTargetArc(GetArc(0), GetArc(1), FstReader);
+ upto = 1;
+ fst.ReadFirstTargetArc(GetArc(0), GetArc(1), fstReader);
return;
}
//System.out.println(" rewind upto=" + upto + " vs targetLength=" + targetLength);
- int currentLimit = Upto;
- Upto = 1;
- while (Upto < currentLimit && Upto <= TargetLength + 1)
+ int currentLimit = upto;
+ upto = 1;
+ while (upto < currentLimit && upto <= targetLength + 1)
{
int cmp = CurrentLabel - TargetLabel;
if (cmp < 0)
@@ -91,12 +91,12 @@ namespace Lucene.Net.Util.Fst
else if (cmp > 0)
{
// seek backwards -- reset this arc to the first arc
- FST<T>.Arc<T> arc = GetArc(Upto);
- Fst.ReadFirstTargetArc(GetArc(Upto - 1), arc, FstReader);
+ FST<T>.Arc<T> arc = GetArc(upto);
+ fst.ReadFirstTargetArc(GetArc(upto - 1), arc, fstReader);
//System.out.println(" seek first arc");
break;
}
- Upto++;
+ upto++;
}
//System.out.println(" fall through upto=" + upto);
}
@@ -104,26 +104,26 @@ namespace Lucene.Net.Util.Fst
protected internal virtual void DoNext()
{
//System.out.println("FE: next upto=" + upto);
- if (Upto == 0)
+ if (upto == 0)
{
//System.out.println(" init");
- Upto = 1;
- Fst.ReadFirstTargetArc(GetArc(0), GetArc(1), FstReader);
+ upto = 1;
+ fst.ReadFirstTargetArc(GetArc(0), GetArc(1), fstReader);
}
else
{
// pop
//System.out.println(" check pop curArc target=" + arcs[upto].target + " label=" + arcs[upto].label + " isLast?=" + arcs[upto].isLast());
- while (Arcs[Upto].IsLast)
+ while (arcs[upto].IsLast)
{
- Upto--;
- if (Upto == 0)
+ upto--;
+ if (upto == 0)
{
//System.out.println(" eof");
return;
}
}
- Fst.ReadNextArc(Arcs[Upto], FstReader);
+ fst.ReadNextArc(arcs[upto], fstReader);
}
PushFirst();
@@ -150,7 +150,7 @@ namespace Lucene.Net.Util.Fst
RewindPrefix();
//System.out.println(" after rewind upto=" + upto);
- FST<T>.Arc<T> arc = GetArc(Upto);
+ FST<T>.Arc<T> arc = GetArc(upto);
int targetLabel = TargetLabel;
//System.out.println(" init targetLabel=" + targetLabel);
@@ -164,7 +164,7 @@ namespace Lucene.Net.Util.Fst
// Arcs are fixed array -- use binary search to find
// the target.
- FST<T>.BytesReader @in = Fst.BytesReader;
+ FST<T>.BytesReader @in = fst.BytesReader;
int low = arc.ArcIdx;
int high = arc.NumArcs - 1;
int mid = 0;
@@ -175,7 +175,7 @@ namespace Lucene.Net.Util.Fst
mid = (int)((uint)(low + high) >> 1);
@in.Position = arc.PosArcsStart;
@in.SkipBytes(arc.BytesPerArc * mid + 1);
- int midLabel = Fst.ReadLabel(@in);
+ int midLabel = fst.ReadLabel(@in);
int cmp = midLabel - targetLabel;
//System.out.println(" cycle low=" + low + " high=" + high + " mid=" + mid + " midLabel=" + midLabel + " cmp=" + cmp);
if (cmp < 0)
@@ -199,17 +199,17 @@ namespace Lucene.Net.Util.Fst
{
// Match
arc.ArcIdx = mid - 1;
- Fst.ReadNextRealArc(arc, @in);
+ fst.ReadNextRealArc(arc, @in);
Debug.Assert(arc.ArcIdx == mid);
Debug.Assert(arc.Label == targetLabel, "arc.label=" + arc.Label + " vs targetLabel=" + targetLabel + " mid=" + mid);
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], arc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
if (targetLabel == FST<T>.END_LABEL)
{
return;
}
CurrentLabel = arc.Label;
Incr();
- arc = Fst.ReadFirstTargetArc(arc, GetArc(Upto), FstReader);
+ arc = fst.ReadFirstTargetArc(arc, GetArc(upto), fstReader);
targetLabel = TargetLabel;
continue;
}
@@ -217,32 +217,32 @@ namespace Lucene.Net.Util.Fst
{
// Dead end
arc.ArcIdx = arc.NumArcs - 2;
- Fst.ReadNextRealArc(arc, @in);
+ fst.ReadNextRealArc(arc, @in);
Debug.Assert(arc.IsLast);
// Dead end (target is after the last arc);
// rollback to last fork then push
- Upto--;
+ upto--;
while (true)
{
- if (Upto == 0)
+ if (upto == 0)
{
return;
}
- FST<T>.Arc<T> prevArc = GetArc(Upto);
+ FST<T>.Arc<T> prevArc = GetArc(upto);
//System.out.println(" rollback upto=" + upto + " arc.label=" + prevArc.label + " isLast?=" + prevArc.isLast());
if (!prevArc.IsLast)
{
- Fst.ReadNextArc(prevArc, FstReader);
+ fst.ReadNextArc(prevArc, fstReader);
PushFirst();
return;
}
- Upto--;
+ upto--;
}
}
else
{
arc.ArcIdx = (low > high ? low : high) - 1;
- Fst.ReadNextRealArc(arc, @in);
+ fst.ReadNextRealArc(arc, @in);
Debug.Assert(arc.Label > targetLabel);
PushFirst();
return;
@@ -254,14 +254,14 @@ namespace Lucene.Net.Util.Fst
if (arc.Label == targetLabel)
{
// recurse
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], arc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
if (targetLabel == FST<T>.END_LABEL)
{
return;
}
CurrentLabel = arc.Label;
Incr();
- arc = Fst.ReadFirstTargetArc(arc, GetArc(Upto), FstReader);
+ arc = fst.ReadFirstTargetArc(arc, GetArc(upto), fstReader);
targetLabel = TargetLabel;
}
else if (arc.Label > targetLabel)
@@ -273,29 +273,29 @@ namespace Lucene.Net.Util.Fst
{
// Dead end (target is after the last arc);
// rollback to last fork then push
- Upto--;
+ upto--;
while (true)
{
- if (Upto == 0)
+ if (upto == 0)
{
return;
}
- FST<T>.Arc<T> prevArc = GetArc(Upto);
+ FST<T>.Arc<T> prevArc = GetArc(upto);
//System.out.println(" rollback upto=" + upto + " arc.label=" + prevArc.label + " isLast?=" + prevArc.isLast());
if (!prevArc.IsLast)
{
- Fst.ReadNextArc(prevArc, FstReader);
+ fst.ReadNextArc(prevArc, fstReader);
PushFirst();
return;
}
- Upto--;
+ upto--;
}
}
else
{
// keep scanning
//System.out.println(" next scan");
- Fst.ReadNextArc(arc, FstReader);
+ fst.ReadNextArc(arc, fstReader);
}
}
}
@@ -319,7 +319,7 @@ namespace Lucene.Net.Util.Fst
//System.out.println("FE: after rewind upto=" + upto);
- FST<T>.Arc<T> arc = GetArc(Upto);
+ FST<T>.Arc<T> arc = GetArc(upto);
int targetLabel = TargetLabel;
//System.out.println("FE: init targetLabel=" + targetLabel);
@@ -334,7 +334,7 @@ namespace Lucene.Net.Util.Fst
// Arcs are fixed array -- use binary search to find
// the target.
- FST<T>.BytesReader @in = Fst.BytesReader;
+ FST<T>.BytesReader @in = fst.BytesReader;
int low = arc.ArcIdx;
int high = arc.NumArcs - 1;
int mid = 0;
@@ -345,7 +345,7 @@ namespace Lucene.Net.Util.Fst
mid = (int)((uint)(low + high) >> 1);
@in.Position = arc.PosArcsStart;
@in.SkipBytes(arc.BytesPerArc * mid + 1);
- int midLabel = Fst.ReadLabel(@in);
+ int midLabel = fst.ReadLabel(@in);
int cmp = midLabel - targetLabel;
//System.out.println(" cycle low=" + low + " high=" + high + " mid=" + mid + " midLabel=" + midLabel + " cmp=" + cmp);
if (cmp < 0)
@@ -370,17 +370,17 @@ namespace Lucene.Net.Util.Fst
// Match -- recurse
//System.out.println(" match! arcIdx=" + mid);
arc.ArcIdx = mid - 1;
- Fst.ReadNextRealArc(arc, @in);
+ fst.ReadNextRealArc(arc, @in);
Debug.Assert(arc.ArcIdx == mid);
Debug.Assert(arc.Label == targetLabel, "arc.label=" + arc.Label + " vs targetLabel=" + targetLabel + " mid=" + mid);
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], arc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
if (targetLabel == FST<T>.END_LABEL)
{
return;
}
CurrentLabel = arc.Label;
Incr();
- arc = Fst.ReadFirstTargetArc(arc, GetArc(Upto), FstReader);
+ arc = fst.ReadFirstTargetArc(arc, GetArc(upto), fstReader);
targetLabel = TargetLabel;
continue;
}
@@ -396,25 +396,25 @@ namespace Lucene.Net.Util.Fst
{
// First, walk backwards until we find a first arc
// that's before our target label:
- Fst.ReadFirstTargetArc(GetArc(Upto - 1), arc, FstReader);
+ fst.ReadFirstTargetArc(GetArc(upto - 1), arc, fstReader);
if (arc.Label < targetLabel)
{
// Then, scan forwards to the arc just before
// the targetLabel:
- while (!arc.IsLast && Fst.ReadNextArcLabel(arc, @in) < targetLabel)
+ while (!arc.IsLast && fst.ReadNextArcLabel(arc, @in) < targetLabel)
{
- Fst.ReadNextArc(arc, FstReader);
+ fst.ReadNextArc(arc, fstReader);
}
PushLast();
return;
}
- Upto--;
- if (Upto == 0)
+ upto--;
+ if (upto == 0)
{
return;
}
targetLabel = TargetLabel;
- arc = GetArc(Upto);
+ arc = GetArc(upto);
}
}
else
@@ -422,8 +422,8 @@ namespace Lucene.Net.Util.Fst
// There is a floor arc:
arc.ArcIdx = (low > high ? high : low) - 1;
//System.out.println(" hasFloor arcIdx=" + (arc.arcIdx+1));
- Fst.ReadNextRealArc(arc, @in);
- Debug.Assert(arc.IsLast || Fst.ReadNextArcLabel(arc, @in) > targetLabel);
+ fst.ReadNextRealArc(arc, @in);
+ Debug.Assert(arc.IsLast || fst.ReadNextArcLabel(arc, @in) > targetLabel);
Debug.Assert(arc.Label < targetLabel, "arc.label=" + arc.Label + " vs targetLabel=" + targetLabel);
PushLast();
return;
@@ -434,14 +434,14 @@ namespace Lucene.Net.Util.Fst
if (arc.Label == targetLabel)
{
// Match -- recurse
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], arc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
if (targetLabel == FST<T>.END_LABEL)
{
return;
}
CurrentLabel = arc.Label;
Incr();
- arc = Fst.ReadFirstTargetArc(arc, GetArc(Upto), FstReader);
+ arc = fst.ReadFirstTargetArc(arc, GetArc(upto), fstReader);
targetLabel = TargetLabel;
}
else if (arc.Label > targetLabel)
@@ -454,31 +454,31 @@ namespace Lucene.Net.Util.Fst
{
// First, walk backwards until we find a first arc
// that's before our target label:
- Fst.ReadFirstTargetArc(GetArc(Upto - 1), arc, FstReader);
+ fst.ReadFirstTargetArc(GetArc(upto - 1), arc, fstReader);
if (arc.Label < targetLabel)
{
// Then, scan forwards to the arc just before
// the targetLabel:
- while (!arc.IsLast && Fst.ReadNextArcLabel(arc, FstReader) < targetLabel)
+ while (!arc.IsLast && fst.ReadNextArcLabel(arc, fstReader) < targetLabel)
{
- Fst.ReadNextArc(arc, FstReader);
+ fst.ReadNextArc(arc, fstReader);
}
PushLast();
return;
}
- Upto--;
- if (Upto == 0)
+ upto--;
+ if (upto == 0)
{
return;
}
targetLabel = TargetLabel;
- arc = GetArc(Upto);
+ arc = GetArc(upto);
}
}
else if (!arc.IsLast)
{
//System.out.println(" check next label=" + fst.readNextArcLabel(arc) + " (" + (char) fst.readNextArcLabel(arc) + ")");
- if (Fst.ReadNextArcLabel(arc, FstReader) > targetLabel)
+ if (fst.ReadNextArcLabel(arc, fstReader) > targetLabel)
{
PushLast();
return;
@@ -486,7 +486,7 @@ namespace Lucene.Net.Util.Fst
else
{
// keep scanning
- Fst.ReadNextArc(arc, FstReader);
+ fst.ReadNextArc(arc, fstReader);
}
}
else
@@ -514,26 +514,26 @@ namespace Lucene.Net.Util.Fst
RewindPrefix();
//System.out.println("FE: after rewind upto=" + upto);
- FST<T>.Arc<T> arc = GetArc(Upto - 1);
+ FST<T>.Arc<T> arc = GetArc(upto - 1);
int targetLabel = TargetLabel;
- FST<T>.BytesReader fstReader = Fst.BytesReader;
+ FST<T>.BytesReader fstReader = fst.BytesReader;
while (true)
{
//System.out.println(" cycle target=" + (targetLabel == -1 ? "-1" : (char) targetLabel));
- FST<T>.Arc<T> nextArc = Fst.FindTargetArc(targetLabel, arc, GetArc(Upto), fstReader);
+ FST<T>.Arc<T> nextArc = fst.FindTargetArc(targetLabel, arc, GetArc(upto), fstReader);
if (nextArc == null)
{
// short circuit
//upto--;
//upto = 0;
- Fst.ReadFirstTargetArc(arc, GetArc(Upto), fstReader);
+ fst.ReadFirstTargetArc(arc, GetArc(upto), fstReader);
//System.out.println(" no match upto=" + upto);
return false;
}
// Match -- recurse:
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], nextArc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], nextArc.Output);
if (targetLabel == FST<T>.END_LABEL)
{
//System.out.println(" return found; upto=" + upto + " output=" + output[upto] + " nextArc=" + nextArc.isLast());
@@ -548,19 +548,19 @@ namespace Lucene.Net.Util.Fst
private void Incr()
{
- Upto++;
+ upto++;
Grow();
- if (Arcs.Length <= Upto)
+ if (arcs.Length <= upto)
{
- FST<T>.Arc<T>[] newArcs = new FST<T>.Arc<T>[ArrayUtil.Oversize(1 + Upto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
- Array.Copy(Arcs, 0, newArcs, 0, Arcs.Length);
- Arcs = newArcs;
+ FST<T>.Arc<T>[] newArcs = new FST<T>.Arc<T>[ArrayUtil.Oversize(1 + upto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+ Array.Copy(arcs, 0, newArcs, 0, arcs.Length);
+ arcs = newArcs;
}
- if (Output.Length <= Upto)
+ if (output.Length <= upto)
{
- T[] newOutput = new T[ArrayUtil.Oversize(1 + Upto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
- Array.Copy(Output, 0, newOutput, 0, Output.Length);
- Output = newOutput;
+ T[] newOutput = new T[ArrayUtil.Oversize(1 + upto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+ Array.Copy(output, 0, newOutput, 0, output.Length);
+ output = newOutput;
}
}
@@ -568,12 +568,12 @@ namespace Lucene.Net.Util.Fst
// appending first arc all the way to the final node
private void PushFirst()
{
- FST<T>.Arc<T> arc = Arcs[Upto];
+ FST<T>.Arc<T> arc = arcs[upto];
Debug.Assert(arc != null);
while (true)
{
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], arc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
if (arc.Label == FST<T>.END_LABEL)
{
// Final node
@@ -583,8 +583,8 @@ namespace Lucene.Net.Util.Fst
CurrentLabel = arc.Label;
Incr();
- FST<T>.Arc<T> nextArc = GetArc(Upto);
- Fst.ReadFirstTargetArc(arc, nextArc, FstReader);
+ FST<T>.Arc<T> nextArc = GetArc(upto);
+ fst.ReadFirstTargetArc(arc, nextArc, fstReader);
arc = nextArc;
}
}
@@ -593,13 +593,13 @@ namespace Lucene.Net.Util.Fst
// way to the first final node
private void PushLast()
{
- FST<T>.Arc<T> arc = Arcs[Upto];
+ FST<T>.Arc<T> arc = arcs[upto];
Debug.Assert(arc != null);
while (true)
{
CurrentLabel = arc.Label;
- Output[Upto] = Fst.Outputs.Add(Output[Upto - 1], arc.Output);
+ output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
if (arc.Label == FST<T>.END_LABEL)
{
// Final node
@@ -607,17 +607,17 @@ namespace Lucene.Net.Util.Fst
}
Incr();
- arc = Fst.ReadLastTargetArc(arc, GetArc(Upto), FstReader);
+ arc = fst.ReadLastTargetArc(arc, GetArc(upto), fstReader);
}
}
private FST<T>.Arc<T> GetArc(int idx)
{
- if (Arcs[idx] == null)
+ if (arcs[idx] == null)
{
- Arcs[idx] = new FST<T>.Arc<T>();
+ arcs[idx] = new FST<T>.Arc<T>();
}
- return Arcs[idx];
+ return arcs[idx];
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
index 039e386..694f438 100644
--- a/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
@@ -26,39 +26,39 @@ namespace Lucene.Net.Util.Fst
/// Reads from a single byte[]. </summary>
internal sealed class ForwardBytesReader : FST.BytesReader
{
- private readonly byte[] Bytes;
- private int Pos;
+ private readonly byte[] bytes;
+ private int pos;
public ForwardBytesReader(byte[] bytes)
{
- this.Bytes = bytes;
+ this.bytes = bytes;
}
public override byte ReadByte()
{
- return Bytes[Pos++];
+ return bytes[pos++];
}
public override void ReadBytes(byte[] b, int offset, int len)
{
- Array.Copy(Bytes, Pos, b, offset, len);
- Pos += len;
+ Array.Copy(bytes, pos, b, offset, len);
+ pos += len;
}
public override void SkipBytes(int count)
{
- Pos += count;
+ pos += count;
}
public override long Position
{
get
{
- return Pos;
+ return pos;
}
set
{
- this.Pos = (int)value;
+ this.pos = (int)value;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs
index 8b8294c..6146420 100644
--- a/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Util.Fst
public sealed class IntSequenceOutputs : Outputs<IntsRef>
{
private static readonly IntsRef NO_OUTPUT = new IntsRef();
- private static readonly IntSequenceOutputs Singleton_Renamed = new IntSequenceOutputs();
+ private static readonly IntSequenceOutputs singleton = new IntSequenceOutputs();
private IntSequenceOutputs()
{
@@ -43,7 +43,7 @@ namespace Lucene.Net.Util.Fst
{
get
{
- return Singleton_Renamed;
+ return singleton;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
index 4c71caa..b70d8c4 100644
--- a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
@@ -28,9 +28,9 @@ namespace Lucene.Net.Util.Fst
public sealed class IntsRefFSTEnum<T> : FSTEnum<T>
{
- private readonly IntsRef Current_Renamed = new IntsRef(10);
- private readonly InputOutput<T> Result = new InputOutput<T>();
- private IntsRef Target;
+ private readonly IntsRef current = new IntsRef(10);
+ private readonly InputOutput<T> result = new InputOutput<T>();
+ private IntsRef target;
/// <summary>
/// Holds a single input (IntsRef) + output pair. </summary>
@@ -48,13 +48,13 @@ namespace Lucene.Net.Util.Fst
public IntsRefFSTEnum(FST<T> fst)
: base(fst)
{
- Result.Input = Current_Renamed;
- Current_Renamed.Offset = 1;
+ result.Input = current;
+ current.Offset = 1;
}
public InputOutput<T> Current()
{
- return Result;
+ return result;
}
public InputOutput<T> Next()
@@ -68,8 +68,8 @@ namespace Lucene.Net.Util.Fst
/// Seeks to smallest term that's >= target. </summary>
public InputOutput<T> SeekCeil(IntsRef target)
{
- this.Target = target;
- TargetLength = target.Length;
+ this.target = target;
+ targetLength = target.Length;
base.DoSeekCeil();
return SetResult();
}
@@ -78,8 +78,8 @@ namespace Lucene.Net.Util.Fst
/// Seeks to biggest term that's <= target. </summary>
public InputOutput<T> SeekFloor(IntsRef target)
{
- this.Target = target;
- TargetLength = target.Length;
+ this.target = target;
+ targetLength = target.Length;
base.DoSeekFloor();
return SetResult();
}
@@ -92,11 +92,11 @@ namespace Lucene.Net.Util.Fst
/// </summary>
public InputOutput<T> SeekExact(IntsRef target)
{
- this.Target = target;
- TargetLength = target.Length;
+ this.target = target;
+ targetLength = target.Length;
if (base.DoSeekExact())
{
- Debug.Assert(Upto == 1 + target.Length);
+ Debug.Assert(upto == 1 + target.Length);
return SetResult();
}
else
@@ -109,13 +109,13 @@ namespace Lucene.Net.Util.Fst
{
get
{
- if (Upto - 1 == Target.Length)
+ if (upto - 1 == target.Length)
{
return FST<T>.END_LABEL;
}
else
{
- return Target.Ints[Target.Offset + Upto - 1];
+ return target.Ints[target.Offset + upto - 1];
}
}
}
@@ -125,30 +125,30 @@ namespace Lucene.Net.Util.Fst
get
{
// current.offset fixed at 1
- return Current_Renamed.Ints[Upto];
+ return current.Ints[upto];
}
set
{
- Current_Renamed.Ints[Upto] = value;
+ current.Ints[upto] = value;
}
}
protected internal override void Grow()
{
- Current_Renamed.Ints = ArrayUtil.Grow(Current_Renamed.Ints, Upto + 1);
+ current.Ints = ArrayUtil.Grow(current.Ints, upto + 1);
}
private InputOutput<T> SetResult()
{
- if (Upto == 0)
+ if (upto == 0)
{
return null;
}
else
{
- Current_Renamed.Length = Upto - 1;
- Result.Output = Output[Upto];
- return Result;
+ current.Length = upto - 1;
+ result.Output = output[upto];
+ return result;
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs b/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
index 248dc84..77012fa 100644
--- a/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
@@ -52,7 +52,7 @@ namespace Lucene.Net.Util.Fst
}
}
- private static readonly NoOutputs Singleton_Renamed = new NoOutputs();
+ private static readonly NoOutputs singleton = new NoOutputs();
private NoOutputs()
{
@@ -62,7 +62,7 @@ namespace Lucene.Net.Util.Fst
{
get
{
- return Singleton_Renamed;
+ return singleton;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
index ca92deb..fcc9429 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -26,37 +26,37 @@ namespace Lucene.Net.Util.Fst
// Used to dedup states (lookup already-frozen states)
internal sealed class NodeHash<T>
{
- private PagedGrowableWriter Table;
- private long Count;
- private long Mask;
- private readonly FST<T> Fst;
- private readonly FST<T>.Arc<T> ScratchArc = new FST<T>.Arc<T>();
- private readonly FST.BytesReader @in;
-
- public NodeHash(FST<T> fst, FST.BytesReader @in)
+ private PagedGrowableWriter table;
+ private long count;
+ private long mask;
+ private readonly FST<T> fst;
+ private readonly FST<T>.Arc<T> scratchArc = new FST<T>.Arc<T>();
+ private readonly FST.BytesReader input;
+
+ public NodeHash(FST<T> fst, FST.BytesReader input)
{
- Table = new PagedGrowableWriter(16, 1 << 30, 8, PackedInts.COMPACT);
- Mask = 15;
- this.Fst = fst;
- this.@in = @in;
+ table = new PagedGrowableWriter(16, 1 << 30, 8, PackedInts.COMPACT);
+ mask = 15;
+ this.fst = fst;
+ this.input = input;
}
private bool NodesEqual(Builder<T>.UnCompiledNode<T> node, long address)
{
- Fst.ReadFirstRealTargetArc(address, ScratchArc, @in);
- if (ScratchArc.BytesPerArc != 0 && node.NumArcs != ScratchArc.NumArcs)
+ fst.ReadFirstRealTargetArc(address, scratchArc, input);
+ if (scratchArc.BytesPerArc != 0 && node.NumArcs != scratchArc.NumArcs)
{
return false;
}
for (int arcUpto = 0; arcUpto < node.NumArcs; arcUpto++)
{
Builder<T>.Arc<T> arc = node.Arcs[arcUpto];
- if (arc.Label != ScratchArc.Label || !arc.Output.Equals(ScratchArc.Output) || ((Builder<T>.CompiledNode)arc.Target).Node != ScratchArc.Target || !arc.NextFinalOutput.Equals(ScratchArc.NextFinalOutput) || arc.IsFinal != ScratchArc.IsFinal)
+ if (arc.Label != scratchArc.Label || !arc.Output.Equals(scratchArc.Output) || ((Builder<T>.CompiledNode)arc.Target).Node != scratchArc.Target || !arc.NextFinalOutput.Equals(scratchArc.NextFinalOutput) || arc.IsFinal != scratchArc.IsFinal)
{
return false;
}
- if (ScratchArc.IsLast)
+ if (scratchArc.IsLast)
{
if (arcUpto == node.NumArcs - 1)
{
@@ -67,7 +67,7 @@ namespace Lucene.Net.Util.Fst
return false;
}
}
- Fst.ReadNextRealArc(ScratchArc, @in);
+ fst.ReadNextRealArc(scratchArc, input);
}
return false;
@@ -126,21 +126,21 @@ namespace Lucene.Net.Util.Fst
const int PRIME = 31;
//System.out.println("hash frozen node=" + node);
long h = 0;
- Fst.ReadFirstRealTargetArc(node, ScratchArc, @in);
+ fst.ReadFirstRealTargetArc(node, scratchArc, input);
while (true)
{
//System.out.println(" label=" + scratchArc.label + " target=" + scratchArc.target + " h=" + h + " output=" + fst.outputs.outputToString(scratchArc.output) + " next?=" + scratchArc.flag(4) + " final?=" + scratchArc.isFinal() + " pos=" + in.getPosition());
- h = PRIME * h + ScratchArc.Label;
- h = PRIME * h + (int)(ScratchArc.Target ^ (ScratchArc.Target >> 32));
- h = PRIME * h + ScratchArc.Output.GetHashCode();
+ h = PRIME * h + scratchArc.Label;
+ h = PRIME * h + (int)(scratchArc.Target ^ (scratchArc.Target >> 32));
+ h = PRIME * h + scratchArc.Output.GetHashCode();
// LUCENENET: Since lists do not compare values by default in .NET,
// we need this workaround to get the hashcode of the type + all of the
// values.
- if (ScratchArc.NextFinalOutput is IEnumerable)
+ if (scratchArc.NextFinalOutput is IEnumerable)
{
- h = PRIME * h + ScratchArc.NextFinalOutput.GetType().GetHashCode();
- foreach (object value in ScratchArc.NextFinalOutput as IEnumerable)
+ h = PRIME * h + scratchArc.NextFinalOutput.GetType().GetHashCode();
+ foreach (object value in scratchArc.NextFinalOutput as IEnumerable)
{
if (value != null)
{
@@ -154,18 +154,18 @@ namespace Lucene.Net.Util.Fst
}
else
{
- h = PRIME * h + ScratchArc.NextFinalOutput.GetHashCode();
+ h = PRIME * h + scratchArc.NextFinalOutput.GetHashCode();
}
- if (ScratchArc.IsFinal)
+ if (scratchArc.IsFinal)
{
h += 17;
}
- if (ScratchArc.IsLast)
+ if (scratchArc.IsLast)
{
break;
}
- Fst.ReadNextRealArc(ScratchArc, @in);
+ fst.ReadNextRealArc(scratchArc, input);
}
//System.out.println(" ret " + (h&Integer.MAX_VALUE));
return h & long.MaxValue;
@@ -175,22 +175,22 @@ namespace Lucene.Net.Util.Fst
{
//System.out.println("hash: add count=" + count + " vs " + table.size() + " mask=" + mask);
long h = Hash(nodeIn);
- long pos = h & Mask;
+ long pos = h & mask;
int c = 0;
while (true)
{
- long v = Table.Get(pos);
+ long v = table.Get(pos);
if (v == 0)
{
// freeze & add
- long node = Fst.AddNode(nodeIn);
+ long node = fst.AddNode(nodeIn);
//System.out.println(" now freeze node=" + node);
long hashNode = Hash(node);
Debug.Assert(hashNode == h, "frozenHash=" + hashNode + " vs h=" + h);
- Count++;
- Table.Set(pos, node);
+ count++;
+ table.Set(pos, node);
// Rehash at 2/3 occupancy:
- if (Count > 2 * Table.Size() / 3)
+ if (count > 2 * table.Size() / 3)
{
Rehash();
}
@@ -203,34 +203,34 @@ namespace Lucene.Net.Util.Fst
}
// quadratic probe
- pos = (pos + (++c)) & Mask;
+ pos = (pos + (++c)) & mask;
}
}
// called only by rehash
private void AddNew(long address)
{
- long pos = Hash(address) & Mask;
+ long pos = Hash(address) & mask;
int c = 0;
while (true)
{
- if (Table.Get(pos) == 0)
+ if (table.Get(pos) == 0)
{
- Table.Set(pos, address);
+ table.Set(pos, address);
break;
}
// quadratic probe
- pos = (pos + (++c)) & Mask;
+ pos = (pos + (++c)) & mask;
}
}
private void Rehash()
{
- PagedGrowableWriter oldTable = Table;
+ PagedGrowableWriter oldTable = table;
- Table = new PagedGrowableWriter(2 * oldTable.Size(), 1 << 30, PackedInts.BitsRequired(Count), PackedInts.COMPACT);
- Mask = Table.Size() - 1;
+ table = new PagedGrowableWriter(2 * oldTable.Size(), 1 << 30, PackedInts.BitsRequired(count), PackedInts.COMPACT);
+ mask = table.Size() - 1;
for (long idx = 0; idx < oldTable.Size(); idx++)
{
long address = oldTable.Get(idx);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
index 2e584b5..b5d626f 100644
--- a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
@@ -31,8 +31,8 @@ namespace Lucene.Net.Util.Fst
public class PairOutputs<A, B> : Outputs<PairOutputs<A, B>.Pair>
{
private readonly Pair NO_OUTPUT;
- private readonly Outputs<A> Outputs1;
- private readonly Outputs<B> Outputs2;
+ private readonly Outputs<A> outputs1;
+ private readonly Outputs<B> outputs2;
/// <summary>
/// Holds a single pair of two outputs. </summary>
@@ -73,8 +73,8 @@ namespace Lucene.Net.Util.Fst
public PairOutputs(Outputs<A> outputs1, Outputs<B> outputs2)
{
- this.Outputs1 = outputs1;
- this.Outputs2 = outputs2;
+ this.outputs1 = outputs1;
+ this.outputs2 = outputs2;
NO_OUTPUT = new Pair(outputs1.NoOutput, outputs2.NoOutput);
}
@@ -82,16 +82,16 @@ namespace Lucene.Net.Util.Fst
/// Create a new Pair </summary>
public virtual Pair NewPair(A a, B b)
{
- if (a.Equals(Outputs1.NoOutput))
+ if (a.Equals(outputs1.NoOutput))
{
- a = Outputs1.NoOutput;
+ a = outputs1.NoOutput;
}
- if (b.Equals(Outputs2.NoOutput))
+ if (b.Equals(outputs2.NoOutput))
{
- b = Outputs2.NoOutput;
+ b = outputs2.NoOutput;
}
- if (a.Equals(Outputs1.NoOutput) && b.Equals(Outputs2.NoOutput))
+ if (a.Equals(outputs1.NoOutput) && b.Equals(outputs2.NoOutput))
{
return NO_OUTPUT;
}
@@ -106,15 +106,15 @@ namespace Lucene.Net.Util.Fst
// for assert
private bool Valid(Pair pair)
{
- bool noOutput1 = pair.Output1.Equals(Outputs1.NoOutput);
- bool noOutput2 = pair.Output2.Equals(Outputs2.NoOutput);
+ bool noOutput1 = pair.Output1.Equals(outputs1.NoOutput);
+ bool noOutput2 = pair.Output2.Equals(outputs2.NoOutput);
- if (noOutput1 && !pair.Output1.Equals(Outputs1.NoOutput))
+ if (noOutput1 && !pair.Output1.Equals(outputs1.NoOutput))
{
return false;
}
- if (noOutput2 && !pair.Output2.Equals(Outputs2.NoOutput))
+ if (noOutput2 && !pair.Output2.Equals(outputs2.NoOutput))
{
return false;
}
@@ -140,34 +140,34 @@ namespace Lucene.Net.Util.Fst
{
Debug.Assert(Valid(pair1));
Debug.Assert(Valid(pair2));
- return NewPair(Outputs1.Common(pair1.Output1, pair2.Output1), Outputs2.Common(pair1.Output2, pair2.Output2));
+ return NewPair(outputs1.Common(pair1.Output1, pair2.Output1), outputs2.Common(pair1.Output2, pair2.Output2));
}
public override Pair Subtract(Pair output, Pair inc)
{
Debug.Assert(Valid(output));
Debug.Assert(Valid(inc));
- return NewPair(Outputs1.Subtract(output.Output1, inc.Output1), Outputs2.Subtract(output.Output2, inc.Output2));
+ return NewPair(outputs1.Subtract(output.Output1, inc.Output1), outputs2.Subtract(output.Output2, inc.Output2));
}
public override Pair Add(Pair prefix, Pair output)
{
Debug.Assert(Valid(prefix));
Debug.Assert(Valid(output));
- return NewPair(Outputs1.Add(prefix.Output1, output.Output1), Outputs2.Add(prefix.Output2, output.Output2));
+ return NewPair(outputs1.Add(prefix.Output1, output.Output1), outputs2.Add(prefix.Output2, output.Output2));
}
public override void Write(Pair output, DataOutput writer)
{
Debug.Assert(Valid(output));
- Outputs1.Write(output.Output1, writer);
- Outputs2.Write(output.Output2, writer);
+ outputs1.Write(output.Output1, writer);
+ outputs2.Write(output.Output2, writer);
}
public override Pair Read(DataInput @in)
{
- A output1 = Outputs1.Read(@in);
- B output2 = Outputs2.Read(@in);
+ A output1 = outputs1.Read(@in);
+ B output2 = outputs2.Read(@in);
return NewPair(output1, output2);
}
@@ -182,12 +182,12 @@ namespace Lucene.Net.Util.Fst
public override string OutputToString(Pair output)
{
Debug.Assert(Valid(output));
- return "<pair:" + Outputs1.OutputToString(output.Output1) + "," + Outputs2.OutputToString(output.Output2) + ">";
+ return "<pair:" + outputs1.OutputToString(output.Output1) + "," + outputs2.OutputToString(output.Output2) + ">";
}
public override string ToString()
{
- return "PairOutputs<" + Outputs1 + "," + Outputs2 + ">";
+ return "PairOutputs<" + outputs1 + "," + outputs2 + ">";
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
index 3f68547..3266aad 100644
--- a/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
@@ -21,41 +21,41 @@ namespace Lucene.Net.Util.Fst
/// Reads in reverse from a single byte[]. </summary>
internal sealed class ReverseBytesReader : FST.BytesReader
{
- private readonly byte[] Bytes;
- private int Pos;
+ private readonly byte[] bytes;
+ private int pos;
public ReverseBytesReader(byte[] bytes)
{
- this.Bytes = bytes;
+ this.bytes = bytes;
}
public override byte ReadByte()
{
- return Bytes[Pos--];
+ return bytes[pos--];
}
public override void ReadBytes(byte[] b, int offset, int len)
{
for (int i = 0; i < len; i++)
{
- b[offset + i] = Bytes[Pos--];
+ b[offset + i] = bytes[pos--];
}
}
public override void SkipBytes(int count)
{
- Pos -= count;
+ pos -= count;
}
public override long Position
{
get
{
- return Pos;
+ return pos;
}
set
{
- this.Pos = (int)value;
+ this.pos = (int)value;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/Util.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/Util.cs b/src/Lucene.Net.Core/Util/Fst/Util.cs
index 749f209..451ee51 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -356,12 +356,12 @@ namespace Lucene.Net.Util.Fst
/// </summary>
public class TopNSearcher<T>
{
- internal readonly FST<T> Fst;
- internal readonly FST<T>.BytesReader BytesReader;
- internal readonly int TopN;
- internal readonly int MaxQueueDepth;
+ private readonly FST<T> fst;
+ private readonly FST<T>.BytesReader bytesReader;
+ private readonly int topN;
+ private readonly int maxQueueDepth;
- internal readonly FST<T>.Arc<T> ScratchArc = new FST<T>.Arc<T>();
+ private readonly FST<T>.Arc<T> scratchArc = new FST<T>.Arc<T>();
internal readonly IComparer<T> Comparator;
@@ -375,10 +375,10 @@ namespace Lucene.Net.Util.Fst
/// <param name="comparator"> the comparator to select the top N </param>
public TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, IComparer<T> comparator)
{
- this.Fst = fst;
- this.BytesReader = fst.BytesReader;
- this.TopN = topN;
- this.MaxQueueDepth = maxQueueDepth;
+ this.fst = fst;
+ this.bytesReader = fst.BytesReader;
+ this.topN = topN;
+ this.maxQueueDepth = maxQueueDepth;
this.Comparator = comparator;
Queue = new SortedSet<FSTPath<T>>(new TieBreakByInputComparator<T>(comparator));
@@ -389,10 +389,10 @@ namespace Lucene.Net.Util.Fst
{
Debug.Assert(Queue != null);
- T cost = Fst.Outputs.Add(path.Cost, path.Arc.Output);
+ T cost = fst.Outputs.Add(path.Cost, path.Arc.Output);
//System.out.println(" addIfCompetitive queue.size()=" + queue.size() + " path=" + path + " + label=" + path.arc.label);
- if (Queue.Count == MaxQueueDepth)
+ if (Queue.Count == maxQueueDepth)
{
FSTPath<T> bottom = Queue.Max;
int comp = Comparator.Compare(cost, bottom.Cost);
@@ -435,7 +435,7 @@ namespace Lucene.Net.Util.Fst
Queue.Add(newPath);
- if (Queue.Count == MaxQueueDepth + 1)
+ if (Queue.Count == maxQueueDepth + 1)
{
Queue.Last();
}
@@ -448,13 +448,13 @@ namespace Lucene.Net.Util.Fst
public virtual void AddStartPaths(FST<T>.Arc<T> node, T startOutput, bool allowEmptyString, IntsRef input)
{
// De-dup NO_OUTPUT since it must be a singleton:
- if (startOutput.Equals(Fst.Outputs.NoOutput))
+ if (startOutput.Equals(fst.Outputs.NoOutput))
{
- startOutput = Fst.Outputs.NoOutput;
+ startOutput = fst.Outputs.NoOutput;
}
FSTPath<T> path = new FSTPath<T>(startOutput, node, input);
- Fst.ReadFirstTargetArc(node, path.Arc, BytesReader);
+ fst.ReadFirstTargetArc(node, path.Arc, bytesReader);
//System.out.println("add start paths");
@@ -469,7 +469,7 @@ namespace Lucene.Net.Util.Fst
{
break;
}
- Fst.ReadNextArc(path.Arc, BytesReader);
+ fst.ReadNextArc(path.Arc, bytesReader);
}
}
@@ -479,8 +479,8 @@ namespace Lucene.Net.Util.Fst
//System.out.println("search topN=" + topN);
- var fstReader = Fst.BytesReader;
- T NO_OUTPUT = Fst.Outputs.NoOutput;
+ var fstReader = fst.BytesReader;
+ T NO_OUTPUT = fst.Outputs.NoOutput;
// TODO: we could enable FST to sorting arcs by weight
// as it freezes... can easily do this on first pass
@@ -491,7 +491,7 @@ namespace Lucene.Net.Util.Fst
int rejectCount = 0;
// For each top N path:
- while (results.Count < TopN)
+ while (results.Count < topN)
{
//System.out.println("\nfind next path: queue.size=" + queue.size());
@@ -524,7 +524,7 @@ namespace Lucene.Net.Util.Fst
continue;
}
- if (results.Count == TopN - 1 && MaxQueueDepth == TopN)
+ if (results.Count == topN - 1 && maxQueueDepth == topN)
{
// Last path -- don't bother w/ queue anymore:
Queue = null;
@@ -542,7 +542,7 @@ namespace Lucene.Net.Util.Fst
while (true)
{
//System.out.println("\n cycle path: " + path);
- Fst.ReadFirstTargetArc(path.Arc, path.Arc, fstReader);
+ fst.ReadFirstTargetArc(path.Arc, path.Arc, fstReader);
// For each arc leaving this node:
bool foundZero = false;
@@ -560,7 +560,7 @@ namespace Lucene.Net.Util.Fst
}
else if (!foundZero)
{
- ScratchArc.CopyFrom(path.Arc);
+ scratchArc.CopyFrom(path.Arc);
foundZero = true;
}
else
@@ -576,7 +576,7 @@ namespace Lucene.Net.Util.Fst
{
break;
}
- Fst.ReadNextArc(path.Arc, fstReader);
+ fst.ReadNextArc(path.Arc, fstReader);
}
Debug.Assert(foundZero);
@@ -587,14 +587,14 @@ namespace Lucene.Net.Util.Fst
// are more clever above... eg on finding the
// first NO_OUTPUT arc we'd switch to using
// scratchArc
- path.Arc.CopyFrom(ScratchArc);
+ path.Arc.CopyFrom(scratchArc);
}
if (path.Arc.Label == FST<T>.END_LABEL)
{
// Add final output:
//System.out.println(" done!: " + path);
- T finalOutput = Fst.Outputs.Add(path.Cost, path.Arc.Output);
+ T finalOutput = fst.Outputs.Add(path.Cost, path.Arc.Output);
if (AcceptResult(path.Input, finalOutput))
{
//System.out.println(" add result: " + path);
@@ -611,11 +611,11 @@ namespace Lucene.Net.Util.Fst
path.Input.Grow(1 + path.Input.Length);
path.Input.Ints[path.Input.Length] = path.Arc.Label;
path.Input.Length++;
- path.Cost = Fst.Outputs.Add(path.Cost, path.Arc.Output);
+ path.Cost = fst.Outputs.Add(path.Cost, path.Arc.Output);
}
}
}
- return new TopResults<T>(rejectCount + TopN <= MaxQueueDepth, results);
+ return new TopResults<T>(rejectCount + topN <= maxQueueDepth, results);
}
protected virtual bool AcceptResult(IntsRef input, T output)