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:46 UTC

[15/49] lucenenet git commit: Refactored FST class to disallow the verbose and confusing FST.Arc syntax, favoring FST.Arc.

Refactored FST class to disallow the verbose and confusing FST<T>.Arc<T> syntax, favoring FST.Arc<T>.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/01e903b1
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/01e903b1
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/01e903b1

Branch: refs/heads/master
Commit: 01e903b1022cf13d708d8c1b5502047ebf704459
Parents: 0ccb5b6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 8 03:11:08 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:57 2016 +0700

----------------------------------------------------------------------
 .../Analysis/CharFilter/NormalizeCharMap.cs     |   2 +-
 .../Analysis/Hunspell/Dictionary.cs             |   2 +-
 .../Codecs/BlockTreeTermsReader.cs              |  52 ++--
 .../Codecs/BlockTreeTermsWriter.cs              |   4 +-
 .../Lucene42/Lucene42DocValuesProducer.cs       |  30 +-
 src/Lucene.Net.Core/Util/Fst/Builder.cs         |   7 +-
 src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs |   2 +-
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 305 ++++++++++---------
 src/Lucene.Net.Core/Util/Fst/FSTEnum.cs         |  54 ++--
 src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs  |   2 +-
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        |   2 +-
 src/Lucene.Net.Core/Util/Fst/Util.cs            |  60 ++--
 .../Util/fst/FSTTester.cs                       |   6 +-
 13 files changed, 270 insertions(+), 258 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
index 9571a31..3712911 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Analysis.CharFilters
                         map.ReadFirstRealTargetArc(scratchArc.Target, scratchArc, fstReader);
                         while (true)
                         {
-                            Debug.Assert(scratchArc.Label != FST<CharsRef>.END_LABEL); // LUCENENET TODO END_LABEL shouldn't be under generic?
+                            Debug.Assert(scratchArc.Label != FST.END_LABEL);
                             cachedRootArcs[Convert.ToChar((char)scratchArc.Label)] = (new FST.Arc<CharsRef>()).CopyFrom(scratchArc);
                             if (scratchArc.IsLast)
                             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
index e27b433..3ce2191 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
@@ -233,7 +233,7 @@ namespace Lucene.Net.Analysis.Hunspell
                         output = fst.Outputs.Add(output, arc.Output);
                     }
                 }
-                if (fst.FindTargetArc(FST<IntsRef>.END_LABEL, arc, arc, bytesReader) == null)
+                if (fst.FindTargetArc(FST.END_LABEL, arc, arc, bytesReader) == null)
                 {
                     return null;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
index 8ae85d3..a691816 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
@@ -705,7 +705,7 @@ namespace Lucene.Net.Codecs
 
                 private Frame[] Stack;
 
-                internal FST<BytesRef>.Arc<BytesRef>[] Arcs = new FST<BytesRef>.Arc<BytesRef>[5];
+                internal FST.Arc<BytesRef>[] Arcs = new FST.Arc<BytesRef>[5];
 
                 internal readonly RunAutomaton runAutomaton;
                 internal readonly CompiledAutomaton CompiledAutomaton;
@@ -714,7 +714,7 @@ namespace Lucene.Net.Codecs
 
                 internal readonly BytesRef Term_Renamed = new BytesRef();
 
-                internal readonly FST<BytesRef>.BytesReader FstReader;
+                internal readonly FST.BytesReader FstReader;
 
                 // TODO: can we share this with the frame in STE?
                 private sealed class Frame
@@ -764,7 +764,7 @@ namespace Lucene.Net.Codecs
                     internal int CurTransitionMax;
                     internal int TransitionIndex;
 
-                    internal FST<BytesRef>.Arc<BytesRef> Arc;
+                    internal FST.Arc<BytesRef> Arc;
 
                     internal readonly BlockTermState TermState;
 
@@ -1052,7 +1052,7 @@ namespace Lucene.Net.Codecs
                     }
                     for (int arcIdx = 0; arcIdx < Arcs.Length; arcIdx++)
                     {
-                        Arcs[arcIdx] = new FST<BytesRef>.Arc<BytesRef>();
+                        Arcs[arcIdx] = new FST.Arc<BytesRef>();
                     }
 
                     if (outerInstance.Index == null)
@@ -1071,7 +1071,7 @@ namespace Lucene.Net.Codecs
                     // Else the seek cost of loading the frames will be
                     // too costly.
 
-                    FST<BytesRef>.Arc<BytesRef> arc = outerInstance.Index.GetFirstArc(Arcs[0]);
+                    FST.Arc<BytesRef> arc = outerInstance.Index.GetFirstArc(Arcs[0]);
                     // Empty string prefix must have an output in the index!
                     Debug.Assert(arc.IsFinal);
 
@@ -1123,15 +1123,15 @@ namespace Lucene.Net.Codecs
                     return Stack[ord];
                 }
 
-                internal FST<BytesRef>.Arc<BytesRef> GetArc(int ord)
+                internal FST.Arc<BytesRef> GetArc(int ord)
                 {
                     if (ord >= Arcs.Length)
                     {
-                        FST<BytesRef>.Arc<BytesRef>[] next = new FST<BytesRef>.Arc<BytesRef>[ArrayUtil.Oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+                        FST.Arc<BytesRef>[] next = new FST.Arc<BytesRef>[ArrayUtil.Oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
                         Array.Copy(Arcs, 0, next, 0, Arcs.Length);
                         for (int arcOrd = Arcs.Length; arcOrd < next.Length; arcOrd++)
                         {
-                            next[arcOrd] = new FST<BytesRef>.Arc<BytesRef>();
+                            next[arcOrd] = new FST.Arc<BytesRef>();
                         }
                         Arcs = next;
                     }
@@ -1151,7 +1151,7 @@ namespace Lucene.Net.Codecs
                     // "bother" with this so we can get the floor data
                     // from the index and skip floor blocks when
                     // possible:
-                    FST<BytesRef>.Arc<BytesRef> arc = CurrentFrame.Arc;
+                    FST.Arc<BytesRef> arc = CurrentFrame.Arc;
                     int idx = CurrentFrame.Prefix;
                     Debug.Assert(CurrentFrame.Suffix > 0);
                     BytesRef output = CurrentFrame.OutputPrefix;
@@ -1223,7 +1223,7 @@ namespace Lucene.Net.Codecs
                     {
                         Term_Renamed.Bytes = ArrayUtil.Grow(Term_Renamed.Bytes, target.Length);
                     }
-                    FST<BytesRef>.Arc<BytesRef> arc = Arcs[0];
+                    FST.Arc<BytesRef> arc = Arcs[0];
                     Debug.Assert(arc == CurrentFrame.Arc);
 
                     for (int idx = 0; idx <= target.Length; idx++)
@@ -1543,9 +1543,9 @@ namespace Lucene.Net.Codecs
                 internal bool Eof;
 
                 internal readonly BytesRef Term_Renamed = new BytesRef();
-                internal readonly FST<BytesRef>.BytesReader FstReader;
+                internal readonly FST.BytesReader FstReader;
 
-                internal FST<BytesRef>.Arc<BytesRef>[] Arcs = new FST<BytesRef>.Arc<BytesRef>[1];
+                internal FST.Arc<BytesRef>[] Arcs = new FST.Arc<BytesRef>[1];
 
                 public SegmentTermsEnum(BlockTreeTermsReader.FieldReader outerInstance)
                 {
@@ -1569,11 +1569,11 @@ namespace Lucene.Net.Codecs
                     // not (and need not) have been loaded
                     for (int arcIdx = 0; arcIdx < Arcs.Length; arcIdx++)
                     {
-                        Arcs[arcIdx] = new FST<BytesRef>.Arc<BytesRef>();
+                        Arcs[arcIdx] = new FST.Arc<BytesRef>();
                     }
 
                     CurrentFrame = StaticFrame;
-                    FST<BytesRef>.Arc<BytesRef> arc;
+                    FST.Arc<BytesRef> arc;
                     if (outerInstance.Index != null)
                     {
                         arc = outerInstance.Index.GetFirstArc(Arcs[0]);
@@ -1621,7 +1621,7 @@ namespace Lucene.Net.Codecs
                     }
 
                     CurrentFrame = StaticFrame;
-                    FST<BytesRef>.Arc<BytesRef> arc;
+                    FST.Arc<BytesRef> arc;
                     if (OuterInstance.Index != null)
                     {
                         arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
@@ -1732,15 +1732,15 @@ namespace Lucene.Net.Codecs
                     return Stack[ord];
                 }
 
-                internal FST<BytesRef>.Arc<BytesRef> GetArc(int ord)
+                internal FST.Arc<BytesRef> GetArc(int ord)
                 {
                     if (ord >= Arcs.Length)
                     {
-                        FST<BytesRef>.Arc<BytesRef>[] next = new FST<BytesRef>.Arc<BytesRef>[ArrayUtil.Oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+                        FST.Arc<BytesRef>[] next = new FST.Arc<BytesRef>[ArrayUtil.Oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
                         Array.Copy(Arcs, 0, next, 0, Arcs.Length);
                         for (int arcOrd = Arcs.Length; arcOrd < next.Length; arcOrd++)
                         {
-                            next[arcOrd] = new FST<BytesRef>.Arc<BytesRef>();
+                            next[arcOrd] = new FST.Arc<BytesRef>();
                         }
                         Arcs = next;
                     }
@@ -1756,7 +1756,7 @@ namespace Lucene.Net.Codecs
                 }
 
                 // Pushes a frame we seek'd to
-                internal Frame PushFrame(FST<BytesRef>.Arc<BytesRef> arc, BytesRef frameData, int length)
+                internal Frame PushFrame(FST.Arc<BytesRef> arc, BytesRef frameData, int length)
                 {
                     ScratchReader.Reset((byte[])(Array)frameData.Bytes, frameData.Offset, frameData.Length);
                     long code = ScratchReader.ReadVLong();
@@ -1776,7 +1776,7 @@ namespace Lucene.Net.Codecs
 
                 // Pushes next'd frame or seek'd frame; we later
                 // lazy-load the frame only when needed
-                internal Frame PushFrame(FST<BytesRef>.Arc<BytesRef> arc, long fp, int length)
+                internal Frame PushFrame(FST.Arc<BytesRef> arc, long fp, int length)
                 {
                     Frame f = GetFrame(1 + CurrentFrame.Ord);
                     f.Arc = arc;
@@ -1841,7 +1841,7 @@ namespace Lucene.Net.Codecs
 
                     Debug.Assert(ClearEOF());
 
-                    FST<BytesRef>.Arc<BytesRef> arc;
+                    FST.Arc<BytesRef> arc;
                     int targetUpto;
                     BytesRef output;
 
@@ -2006,7 +2006,7 @@ namespace Lucene.Net.Codecs
                     {
                         int targetLabel = target.Bytes[target.Offset + targetUpto] & 0xFF;
 
-                        FST<BytesRef>.Arc<BytesRef> nextArc = OuterInstance.Index.FindTargetArc(targetLabel, arc, GetArc(1 + targetUpto), FstReader);
+                        FST.Arc<BytesRef> nextArc = OuterInstance.Index.FindTargetArc(targetLabel, arc, GetArc(1 + targetUpto), FstReader);
 
                         if (nextArc == null)
                         {
@@ -2130,7 +2130,7 @@ namespace Lucene.Net.Codecs
                     //printSeekState();
                     //}
 
-                    FST<BytesRef>.Arc<BytesRef> arc;
+                    FST.Arc<BytesRef> arc;
                     int targetUpto;
                     BytesRef output;
 
@@ -2291,7 +2291,7 @@ namespace Lucene.Net.Codecs
                     {
                         int targetLabel = target.Bytes[target.Offset + targetUpto] & 0xFF;
 
-                        FST<BytesRef>.Arc<BytesRef> nextArc = OuterInstance.Index.FindTargetArc(targetLabel, arc, GetArc(1 + targetUpto), FstReader);
+                        FST.Arc<BytesRef> nextArc = OuterInstance.Index.FindTargetArc(targetLabel, arc, GetArc(1 + targetUpto), FstReader);
 
                         if (nextArc == null)
                         {
@@ -2469,7 +2469,7 @@ namespace Lucene.Net.Codecs
                     if (@in == null)
                     {
                         // Fresh TermsEnum; seek to first term:
-                        FST<BytesRef>.Arc<BytesRef> arc;
+                        FST.Arc<BytesRef> arc;
                         if (OuterInstance.Index != null)
                         {
                             arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
@@ -2672,7 +2672,7 @@ namespace Lucene.Net.Codecs
                     internal bool HasTermsOrig;
                     internal bool IsFloor;
 
-                    internal FST<BytesRef>.Arc<BytesRef> Arc;
+                    internal FST.Arc<BytesRef> Arc;
 
                     // File pointer where this block was loaded from
                     internal long Fp;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs b/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
index 0c32f3b..6aa9555 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
@@ -452,7 +452,7 @@ namespace Lucene.Net.Codecs
                 }
 
                 ByteSequenceOutputs outputs = ByteSequenceOutputs.Singleton;
-                Builder<BytesRef> indexBuilder = new Builder<BytesRef>(FST<BytesRef>.INPUT_TYPE.BYTE1, 0, 0, true, false, int.MaxValue, outputs, null, false, PackedInts.COMPACT, true, 15);
+                Builder<BytesRef> indexBuilder = new Builder<BytesRef>(FST.INPUT_TYPE.BYTE1, 0, 0, true, false, int.MaxValue, outputs, null, false, PackedInts.COMPACT, true, 15);
                 var bytes = new byte[(int)scratchBytes.FilePointer];
                 Debug.Assert(bytes.Length > 0);
                 scratchBytes.WriteTo(bytes, 0);
@@ -1100,7 +1100,7 @@ namespace Lucene.Net.Codecs
                 // this Builder is just used transiently to fragment
                 // terms into "good" blocks; we don't save the
                 // resulting FST:
-                BlockBuilder = new Builder<object>(FST<BytesRef>.INPUT_TYPE.BYTE1, 0, 0, true, true, int.MaxValue, NoOutputs, new FindBlocks(this), false, PackedInts.COMPACT, true, 15);
+                BlockBuilder = new Builder<object>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, int.MaxValue, NoOutputs, new FindBlocks(this), false, PackedInts.COMPACT, true, 15);
 
                 this.LongsSize = outerInstance.PostingsWriter.SetField(fieldInfo);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
index 5977d18..b158143 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
@@ -431,8 +431,8 @@ namespace Lucene.Net.Codecs.Lucene42
 
             // per-thread resources
             var @in = fst.BytesReader;
-            var firstArc = new FST<long?>.Arc<long?>();
-            var scratchArc = new FST<long?>.Arc<long?>();
+            var firstArc = new FST.Arc<long?>();
+            var scratchArc = new FST.Arc<long?>();
             var scratchInts = new IntsRef();
             var fstEnum = new BytesRefFSTEnum<long?>(fst);
 
@@ -444,13 +444,13 @@ namespace Lucene.Net.Codecs.Lucene42
             private readonly FSTEntry Entry;
             private readonly NumericDocValues DocToOrd;
             private readonly FST<long?> Fst;
-            private readonly FST<long?>.BytesReader @in;
-            private readonly FST<long?>.Arc<long?> FirstArc;
-            private readonly FST<long?>.Arc<long?> ScratchArc;
+            private readonly FST.BytesReader @in;
+            private readonly FST.Arc<long?> FirstArc;
+            private readonly FST.Arc<long?> ScratchArc;
             private readonly IntsRef ScratchInts;
             private readonly BytesRefFSTEnum<long?> FstEnum;
 
-            public SortedDocValuesAnonymousInnerClassHelper(FSTEntry entry, NumericDocValues docToOrd, FST<long?> fst, FST<long?>.BytesReader @in, FST<long?>.Arc<long?> firstArc, FST<long?>.Arc<long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long?> fstEnum)
+            public SortedDocValuesAnonymousInnerClassHelper(FSTEntry entry, NumericDocValues docToOrd, FST<long?> fst, FST.BytesReader @in, FST.Arc<long?> firstArc, FST.Arc<long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long?> fstEnum)
             {
                 this.Entry = entry;
                 this.DocToOrd = docToOrd;
@@ -546,8 +546,8 @@ namespace Lucene.Net.Codecs.Lucene42
 
             // per-thread resources
             var @in = fst.BytesReader;
-            var firstArc = new FST<long?>.Arc<long?>();
-            var scratchArc = new FST<long?>.Arc<long?>();
+            var firstArc = new FST.Arc<long?>();
+            var scratchArc = new FST.Arc<long?>();
             var scratchInts = new IntsRef();
             var fstEnum = new BytesRefFSTEnum<long?>(fst);
             var @ref = new BytesRef();
@@ -560,15 +560,15 @@ namespace Lucene.Net.Codecs.Lucene42
             private readonly FSTEntry Entry;
             private readonly BinaryDocValues DocToOrds;
             private readonly FST<long?> Fst;
-            private readonly FST<long?>.BytesReader @in;
-            private readonly FST<long?>.Arc<long?> FirstArc;
-            private readonly FST<long?>.Arc<long?> ScratchArc;
+            private readonly FST.BytesReader @in;
+            private readonly FST.Arc<long?> FirstArc;
+            private readonly FST.Arc<long?> ScratchArc;
             private readonly IntsRef ScratchInts;
             private readonly BytesRefFSTEnum<long?> FstEnum;
             private readonly BytesRef @ref;
             private readonly ByteArrayDataInput Input;
 
-            public SortedSetDocValuesAnonymousInnerClassHelper(FSTEntry entry, BinaryDocValues docToOrds, FST<long?> fst, FST<long?>.BytesReader @in, FST<long?>.Arc<long?> firstArc, FST<long?>.Arc<long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long?> fstEnum, BytesRef @ref, ByteArrayDataInput input)
+            public SortedSetDocValuesAnonymousInnerClassHelper(FSTEntry entry, BinaryDocValues docToOrds, FST<long?> fst, FST.BytesReader @in, FST.Arc<long?> firstArc, FST.Arc<long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long?> fstEnum, BytesRef @ref, ByteArrayDataInput input)
             {
                 this.Entry = entry;
                 this.DocToOrds = docToOrds;
@@ -715,9 +715,9 @@ namespace Lucene.Net.Codecs.Lucene42
             // maybe we should add a FSTEnum that supports this operation?
             internal readonly FST<long?> Fst;
 
-            internal readonly FST<long?>.BytesReader BytesReader;
-            internal readonly FST<long?>.Arc<long?> FirstArc = new FST<long?>.Arc<long?>();
-            internal readonly FST<long?>.Arc<long?> ScratchArc = new FST<long?>.Arc<long?>();
+            internal readonly FST.BytesReader BytesReader;
+            internal readonly FST.Arc<long?> FirstArc = new FST.Arc<long?>();
+            internal readonly FST.Arc<long?> ScratchArc = new FST.Arc<long?>();
             internal readonly IntsRef ScratchInts = new IntsRef();
             internal readonly BytesRef ScratchBytes = new BytesRef();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Core/Util/Fst/Builder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/Builder.cs b/src/Lucene.Net.Core/Util/Fst/Builder.cs
index 93dfbf6..11cce9f 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -97,7 +97,7 @@ namespace Lucene.Net.Util.Fst
         /// boolean, int, Outputs, FreezeTail, boolean, float,
         /// boolean, int)} with pruning options turned off.
         /// </summary>
-        public Builder(FST<T>.INPUT_TYPE inputType, Outputs<T> outputs)
+        public Builder(FST.INPUT_TYPE inputType, Outputs<T> outputs)
             : this(inputType, 0, 0, true, true, int.MaxValue, outputs, null, false, PackedInts.COMPACT, true, 15)
         {
         }
@@ -152,7 +152,10 @@ namespace Lucene.Net.Util.Fst
         ///    byte[] block in the BytesStore; if you know the FST
         ///    will be large then make this larger.  For example 15
         ///    bits = 32768 byte pages. </param>
-        public Builder(FST<T>.INPUT_TYPE inputType, int minSuffixCount1, int minSuffixCount2, bool doShareSuffix, bool doShareNonSingletonNodes, int shareMaxTailLength, Outputs<T> outputs, FreezeTail<T> freezeTail, bool doPackFST, float acceptableOverheadRatio, bool allowArrayArcs, int bytesPageBits)
+        public Builder(FST.INPUT_TYPE inputType, int minSuffixCount1, int minSuffixCount2, bool doShareSuffix, 
+            bool doShareNonSingletonNodes, int shareMaxTailLength, Outputs<T> outputs, 
+            FreezeTail<T> freezeTail, bool doPackFST, float acceptableOverheadRatio, bool allowArrayArcs, 
+            int bytesPageBits)
         {
             this.minSuffixCount1 = minSuffixCount1;
             this.minSuffixCount2 = minSuffixCount2;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
index 8bd5028..1617f26 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
@@ -105,7 +105,7 @@ namespace Lucene.Net.Util.Fst
             {
                 if (upto - 1 == target.Length)
                 {
-                    return FST<T>.END_LABEL;
+                    return FST.END_LABEL;
                 }
                 else
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.Core/Util/Fst/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FST.cs b/src/Lucene.Net.Core/Util/Fst/FST.cs
index 6b4a3e2..99be83d 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -58,7 +58,7 @@ namespace Lucene.Net.Util.Fst
     ///
     /// @lucene.experimental
     /// </summary>
-    public sealed class FST<T> : FST
+    public sealed class FST<T>
     {
         /*/// <summary>
         /// Specifies allowed range of each int input label for
@@ -70,7 +70,7 @@ namespace Lucene.Net.Util.Fst
             BYTE2,
             BYTE4
         }*/
-        public readonly INPUT_TYPE inputType;
+        private readonly FST.INPUT_TYPE inputType;
 
         /*internal static readonly int BIT_FINAL_ARC = 1 << 0;
         internal static readonly int BIT_LAST_ARC = 1 << 1;
@@ -154,21 +154,21 @@ namespace Lucene.Net.Util.Fst
 
         private readonly T NO_OUTPUT;
 
-        public long nodeCount;
-        public long arcCount;
-        public long arcWithOutputCount;
+        internal long nodeCount;
+        private long arcCount;
+        private long arcWithOutputCount;
 
         private readonly bool packed;
         private PackedInts.Reader nodeRefToAddress;
 
-        /// <summary>
-        /// If arc has this label then that arc is final/accepted </summary>
-        public static readonly int END_LABEL = -1;
+        ///// <summary>
+        ///// If arc has this label then that arc is final/accepted </summary>
+        //public static readonly int END_LABEL = -1;
 
         private readonly bool allowArrayArcs;
 
-        private Arc<T>[] cachedRootArcs;
-        private Arc<T>[] assertingCachedRootArcs; // only set wit assert
+        private FST.Arc<T>[] cachedRootArcs;
+        private FST.Arc<T>[] assertingCachedRootArcs; // only set wit assert
 
         // LUCENENET NOTE: Arc<T> moved into FST class
 
@@ -188,12 +188,12 @@ namespace Lucene.Net.Util.Fst
 
         // make a new empty FST, for building; Builder invokes
         // this ctor
-        internal FST(INPUT_TYPE inputType, Outputs<T> outputs, bool willPackFST, float acceptableOverheadRatio, bool allowArrayArcs, int bytesPageBits)
+        internal FST(FST.INPUT_TYPE inputType, Outputs<T> outputs, bool willPackFST, float acceptableOverheadRatio, bool allowArrayArcs, int bytesPageBits)
         {
             this.inputType = inputType;
             this.Outputs = outputs;
             this.allowArrayArcs = allowArrayArcs;
-            version = VERSION_CURRENT;
+            version = FST.VERSION_CURRENT;
             Bytes = new BytesStore(bytesPageBits);
             // pad: ensure no node gets address 0 which is reserved to mean
             // the stop state w/ no arcs
@@ -239,7 +239,7 @@ namespace Lucene.Net.Util.Fst
 
             // NOTE: only reads most recent format; we don't have
             // back-compat promise for FSTs (they are experimental):
-            version = CodecUtil.CheckHeader(@in, FILE_FORMAT_NAME, VERSION_PACKED, VERSION_VINT_TARGET);
+            version = CodecUtil.CheckHeader(@in, FST.FILE_FORMAT_NAME, FST.VERSION_PACKED, FST.VERSION_VINT_TARGET);
             packed = @in.ReadByte() == 1;
             if (@in.ReadByte() == 1)
             {
@@ -250,7 +250,7 @@ namespace Lucene.Net.Util.Fst
                 emptyBytes.CopyBytes(@in, numBytes);
 
                 // De-serialize empty-string output:
-                BytesReader reader;
+                FST.BytesReader reader;
                 if (packed)
                 {
                     reader = emptyBytes.ForwardReader;
@@ -276,15 +276,15 @@ namespace Lucene.Net.Util.Fst
             switch (t)
             {
                 case 0:
-                    inputType = INPUT_TYPE.BYTE1;
+                    inputType = FST.INPUT_TYPE.BYTE1;
                     break;
 
                 case 1:
-                    inputType = INPUT_TYPE.BYTE2;
+                    inputType = FST.INPUT_TYPE.BYTE2;
                     break;
 
                 case 2:
-                    inputType = INPUT_TYPE.BYTE4;
+                    inputType = FST.INPUT_TYPE.BYTE4;
                     break;
 
                 default:
@@ -325,7 +325,7 @@ namespace Lucene.Net.Util.Fst
             */
         }
 
-        public INPUT_TYPE InputType
+        public FST.INPUT_TYPE InputType
         {
             get
             {
@@ -356,7 +356,7 @@ namespace Lucene.Net.Util.Fst
             {
                 throw new InvalidOperationException("already finished");
             }
-            if (newStartNode == FINAL_END_NODE && emptyOutput != null)
+            if (newStartNode == FST.FINAL_END_NODE && emptyOutput != null)
             {
                 newStartNode = 0;
             }
@@ -383,27 +383,27 @@ namespace Lucene.Net.Util.Fst
         // Caches first 128 labels
         private void CacheRootArcs()
         {
-            cachedRootArcs = (Arc<T>[])new Arc<T>[0x80];
+            cachedRootArcs = (FST.Arc<T>[])new FST.Arc<T>[0x80];
             ReadRootArcs(cachedRootArcs);
 
             Debug.Assert(SetAssertingRootArcs(cachedRootArcs));
             Debug.Assert(AssertRootArcs());
         }
 
-        public void ReadRootArcs(Arc<T>[] arcs)
+        public void ReadRootArcs(FST.Arc<T>[] arcs)
         {
-            Arc<T> arc = new Arc<T>();
+            FST.Arc<T> arc = new FST.Arc<T>();
             GetFirstArc(arc);
-            BytesReader @in = BytesReader;
+            FST.BytesReader @in = BytesReader;
             if (TargetHasArcs(arc))
             {
                 ReadFirstRealTargetArc(arc.Target, arc, @in);
                 while (true)
                 {
-                    Debug.Assert(arc.Label != END_LABEL);
+                    Debug.Assert(arc.Label != FST.END_LABEL);
                     if (arc.Label < cachedRootArcs.Length)
                     {
-                        arcs[arc.Label] = (new Arc<T>()).CopyFrom(arc);
+                        arcs[arc.Label] = (new FST.Arc<T>()).CopyFrom(arc);
                     }
                     else
                     {
@@ -418,9 +418,9 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        private bool SetAssertingRootArcs(Arc<T>[] arcs)
+        private bool SetAssertingRootArcs(FST.Arc<T>[] arcs)
         {
-            assertingCachedRootArcs = (Arc<T>[])new Arc<T>[arcs.Length];
+            assertingCachedRootArcs = (FST.Arc<T>[])new FST.Arc<T>[arcs.Length];
             ReadRootArcs(assertingCachedRootArcs);
             return true;
         }
@@ -431,8 +431,8 @@ namespace Lucene.Net.Util.Fst
             Debug.Assert(assertingCachedRootArcs != null);
             for (int i = 0; i < cachedRootArcs.Length; i++)
             {
-                Arc<T> root = cachedRootArcs[i];
-                Arc<T> asserting = assertingCachedRootArcs[i];
+                FST.Arc<T> root = cachedRootArcs[i];
+                FST.Arc<T> asserting = assertingCachedRootArcs[i];
                 if (root != null)
                 {
                     Debug.Assert(root.ArcIdx == asserting.ArcIdx);
@@ -503,7 +503,7 @@ namespace Lucene.Net.Util.Fst
             {
                 throw new InvalidOperationException("cannot save a FST which has been loaded from disk ");
             }
-            CodecUtil.WriteHeader(@out, FILE_FORMAT_NAME, VERSION_CURRENT);
+            CodecUtil.WriteHeader(@out, FST.FILE_FORMAT_NAME, FST.VERSION_CURRENT);
             if (packed)
             {
                 @out.WriteByte(1);
@@ -547,11 +547,11 @@ namespace Lucene.Net.Util.Fst
                 @out.WriteByte(0);
             }
             sbyte t;
-            if (inputType == INPUT_TYPE.BYTE1)
+            if (inputType == FST.INPUT_TYPE.BYTE1)
             {
                 t = 0;
             }
-            else if (inputType == INPUT_TYPE.BYTE2)
+            else if (inputType == FST.INPUT_TYPE.BYTE2)
             {
                 t = 1;
             }
@@ -598,41 +598,17 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        /// <summary>
-        /// Reads an automaton from a file.
-        /// </summary>
-        public static FST<T> Read<T>(FileInfo file, Outputs<T> outputs)
-        {
-            var bs = new BufferedStream(file.OpenRead());
-            bool success = false;
-            try
-            {
-                FST<T> fst = new FST<T>(new InputStreamDataInput(bs), outputs);
-                success = true;
-                return fst;
-            }
-            finally
-            {
-                if (success)
-                {
-                    IOUtils.Close(bs);
-                }
-                else
-                {
-                    IOUtils.CloseWhileHandlingException(bs);
-                }
-            }
-        }
+        // LUCENENET NOTE: static Read<T>() was moved into the FST class
 
         private void WriteLabel(DataOutput @out, int v)
         {
             Debug.Assert(v >= 0, "v=" + v);
-            if (inputType == INPUT_TYPE.BYTE1)
+            if (inputType == FST.INPUT_TYPE.BYTE1)
             {
                 Debug.Assert(v <= 255, "v=" + v);
                 @out.WriteByte((byte)(sbyte)v);
             }
-            else if (inputType == INPUT_TYPE.BYTE2)
+            else if (inputType == FST.INPUT_TYPE.BYTE2)
             {
                 Debug.Assert(v <= 65535, "v=" + v);
                 @out.WriteShort((short)v);
@@ -646,12 +622,12 @@ namespace Lucene.Net.Util.Fst
         internal int ReadLabel(DataInput @in)
         {
             int v;
-            if (inputType == INPUT_TYPE.BYTE1)
+            if (inputType == FST.INPUT_TYPE.BYTE1)
             {
                 // Unsigned byte:
                 v = @in.ReadByte() & 0xFF;
             }
-            else if (inputType == INPUT_TYPE.BYTE2)
+            else if (inputType == FST.INPUT_TYPE.BYTE2)
             {
                 // Unsigned short:
                 v = @in.ReadShort() & 0xFFFF;
@@ -667,7 +643,7 @@ namespace Lucene.Net.Util.Fst
         /// returns true if the node at this address has any
         ///  outgoing arcs
         /// </summary>
-        public static bool TargetHasArcs(Arc<T> arc)
+        public static bool TargetHasArcs(FST.Arc<T> arc)
         {
             return arc.Target > 0;
         }
@@ -681,11 +657,11 @@ namespace Lucene.Net.Util.Fst
             {
                 if (nodeIn.IsFinal)
                 {
-                    return FINAL_END_NODE;
+                    return FST.FINAL_END_NODE;
                 }
                 else
                 {
-                    return NON_FINAL_END_NODE;
+                    return FST.NON_FINAL_END_NODE;
                 }
             }
 
@@ -717,7 +693,7 @@ namespace Lucene.Net.Util.Fst
 
                 if (arcIdx == lastArc)
                 {
-                    flags += BIT_LAST_ARC;
+                    flags += FST.BIT_LAST_ARC;
                 }
 
                 if (lastFrozenNode == target.Node && !doFixedArray)
@@ -725,15 +701,15 @@ namespace Lucene.Net.Util.Fst
                     // TODO: for better perf (but more RAM used) we
                     // could avoid this except when arc is "near" the
                     // last arc:
-                    flags += BIT_TARGET_NEXT;
+                    flags += FST.BIT_TARGET_NEXT;
                 }
 
                 if (arc.IsFinal)
                 {
-                    flags += BIT_FINAL_ARC;
+                    flags += FST.BIT_FINAL_ARC;
                     if (!arc.NextFinalOutput.Equals(NO_OUTPUT))
                     {
-                        flags += BIT_ARC_HAS_FINAL_OUTPUT;
+                        flags += FST.BIT_ARC_HAS_FINAL_OUTPUT;
                     }
                 }
                 else
@@ -745,7 +721,7 @@ namespace Lucene.Net.Util.Fst
 
                 if (!targetHasArcs)
                 {
-                    flags += BIT_STOP_NODE;
+                    flags += FST.BIT_STOP_NODE;
                 }
                 else if (inCounts != null)
                 {
@@ -754,7 +730,7 @@ namespace Lucene.Net.Util.Fst
 
                 if (!arc.Output.Equals(NO_OUTPUT))
                 {
-                    flags += BIT_ARC_HAS_OUTPUT;
+                    flags += FST.BIT_ARC_HAS_OUTPUT;
                 }
 
                 Bytes.WriteByte((byte)(sbyte)flags);
@@ -775,7 +751,7 @@ namespace Lucene.Net.Util.Fst
                     Outputs.WriteFinalOutput(arc.NextFinalOutput, Bytes);
                 }
 
-                if (targetHasArcs && (flags & BIT_TARGET_NEXT) == 0)
+                if (targetHasArcs && (flags & FST.BIT_TARGET_NEXT) == 0)
                 {
                     Debug.Assert(target.Node > 0);
                     //System.out.println("    write target");
@@ -827,7 +803,7 @@ namespace Lucene.Net.Util.Fst
                 byte[] header = new byte[MAX_HEADER_SIZE];
                 var bad = new ByteArrayDataOutput(header);
                 // write a "false" first arc:
-                bad.WriteByte((byte)ARCS_AS_FIXED_ARRAY);
+                bad.WriteByte((byte)FST.ARCS_AS_FIXED_ARRAY);
                 bad.WriteVInt(nodeIn.NumArcs);
                 bad.WriteVInt(maxBytesPerArc);
                 int headerLen = bad.Position;
@@ -898,20 +874,20 @@ namespace Lucene.Net.Util.Fst
         /// Fills virtual 'start' arc, ie, an empty incoming arc to
         ///  the FST's start node
         /// </summary>
-        public Arc<T> GetFirstArc(Arc<T> arc)
+        public FST.Arc<T> GetFirstArc(FST.Arc<T> arc)
         {
             if (emptyOutput != null)
             {
-                arc.Flags = BIT_FINAL_ARC | BIT_LAST_ARC;
+                arc.Flags = FST.BIT_FINAL_ARC | FST.BIT_LAST_ARC;
                 arc.NextFinalOutput = emptyOutput;
                 if (!emptyOutput.Equals(NO_OUTPUT))
                 {
-                    arc.Flags |= BIT_ARC_HAS_FINAL_OUTPUT;
+                    arc.Flags |= FST.BIT_ARC_HAS_FINAL_OUTPUT;
                 }
             }
             else
             {
-                arc.Flags = BIT_LAST_ARC;
+                arc.Flags = FST.BIT_LAST_ARC;
                 arc.NextFinalOutput = NO_OUTPUT;
             }
             arc.Output = NO_OUTPUT;
@@ -929,17 +905,17 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         /// <returns> Returns the second argument
         /// (<code>arc</code>).  </returns>
-        public Arc<T> ReadLastTargetArc(Arc<T> follow, Arc<T> arc, FST.BytesReader @in)
+        public FST.Arc<T> ReadLastTargetArc(FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
             //System.out.println("readLast");
             if (!TargetHasArcs(follow))
             {
                 //System.out.println("  end node");
                 Debug.Assert(follow.IsFinal);
-                arc.Label = END_LABEL;
-                arc.Target = FINAL_END_NODE;
+                arc.Label = FST.END_LABEL;
+                arc.Target = FST.FINAL_END_NODE;
                 arc.Output = follow.NextFinalOutput;
-                arc.Flags = (sbyte)BIT_LAST_ARC;
+                arc.Flags = (sbyte)FST.BIT_LAST_ARC;
                 return arc;
             }
             else
@@ -947,11 +923,11 @@ namespace Lucene.Net.Util.Fst
                 @in.Position = GetNodeAddress(follow.Target);
                 arc.Node = follow.Target;
                 var b = (sbyte)@in.ReadByte();
-                if (b == ARCS_AS_FIXED_ARRAY)
+                if (b == FST.ARCS_AS_FIXED_ARRAY)
                 {
                     // array: jump straight to end
                     arc.NumArcs = @in.ReadVInt();
-                    if (packed || version >= VERSION_VINT_TARGET)
+                    if (packed || version >= FST.VERSION_VINT_TARGET)
                     {
                         arc.BytesPerArc = @in.ReadVInt();
                     }
@@ -973,18 +949,18 @@ namespace Lucene.Net.Util.Fst
                     {
                         // skip this arc:
                         ReadLabel(@in);
-                        if (arc.Flag(BIT_ARC_HAS_OUTPUT))
+                        if (arc.Flag(FST.BIT_ARC_HAS_OUTPUT))
                         {
                             Outputs.Read(@in);
                         }
-                        if (arc.Flag(BIT_ARC_HAS_FINAL_OUTPUT))
+                        if (arc.Flag(FST.BIT_ARC_HAS_FINAL_OUTPUT))
                         {
                             Outputs.ReadFinalOutput(@in);
                         }
-                        if (arc.Flag(BIT_STOP_NODE))
+                        if (arc.Flag(FST.BIT_STOP_NODE))
                         {
                         }
-                        else if (arc.Flag(BIT_TARGET_NEXT))
+                        else if (arc.Flag(FST.BIT_TARGET_NEXT))
                         {
                         }
                         else if (packed)
@@ -1007,10 +983,10 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        private long ReadUnpackedNodeTarget(BytesReader @in)
+        private long ReadUnpackedNodeTarget(FST.BytesReader @in)
         {
             long target;
-            if (version < VERSION_VINT_TARGET)
+            if (version < FST.VERSION_VINT_TARGET)
             {
                 target = @in.ReadInt();
             }
@@ -1027,19 +1003,19 @@ namespace Lucene.Net.Util.Fst
         /// it.
         /// </summary>
         /// <returns> Returns the second argument (<code>arc</code>). </returns>
-        public Arc<T> ReadFirstTargetArc(Arc<T> follow, Arc<T> arc, FST.BytesReader @in)
+        public FST.Arc<T> ReadFirstTargetArc(FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
             //int pos = address;
             //System.out.println("    readFirstTarget follow.target=" + follow.Target + " isFinal=" + follow.isFinal());
             if (follow.IsFinal)
             {
                 // Insert "fake" final first arc:
-                arc.Label = END_LABEL;
+                arc.Label = FST.END_LABEL;
                 arc.Output = follow.NextFinalOutput;
-                arc.Flags = (sbyte)BIT_FINAL_ARC;
+                arc.Flags = (sbyte)FST.BIT_FINAL_ARC;
                 if (follow.Target <= 0)
                 {
-                    arc.Flags |= (sbyte)BIT_LAST_ARC;
+                    arc.Flags |= (sbyte)FST.BIT_LAST_ARC;
                 }
                 else
                 {
@@ -1047,7 +1023,7 @@ namespace Lucene.Net.Util.Fst
                     // NOTE: nextArc is a node (not an address!) in this case:
                     arc.NextArc = follow.Target;
                 }
-                arc.Target = FINAL_END_NODE;
+                arc.Target = FST.FINAL_END_NODE;
                 //System.out.println("    insert isFinal; nextArc=" + follow.Target + " isLast=" + arc.isLast() + " output=" + outputs.outputToString(arc.Output));
                 return arc;
             }
@@ -1057,7 +1033,7 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        public Arc<T> ReadFirstRealTargetArc(long node, Arc<T> arc, FST.BytesReader @in)
+        public FST.Arc<T> ReadFirstRealTargetArc(long node, FST.Arc<T> arc, FST.BytesReader @in)
         {
             long address = GetNodeAddress(node);
             @in.Position = address;
@@ -1066,12 +1042,12 @@ namespace Lucene.Net.Util.Fst
             //System.out.println("   flags=" + arc.flags);
             arc.Node = node;
 
-            if (@in.ReadByte() == ARCS_AS_FIXED_ARRAY)
+            if (@in.ReadByte() == FST.ARCS_AS_FIXED_ARRAY)
             {
                 //System.out.println("  fixedArray");
                 // this is first arc in a fixed-array
                 arc.NumArcs = @in.ReadVInt();
-                if (packed || version >= VERSION_VINT_TARGET)
+                if (packed || version >= FST.VERSION_VINT_TARGET)
                 {
                     arc.BytesPerArc = @in.ReadVInt();
                 }
@@ -1098,7 +1074,7 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         /// <returns> Returns <code>true</code> if <code>arc</code> points to a state in an
         /// expanded array format. </returns>
-        public bool IsExpandedTarget(Arc<T> follow, BytesReader @in)
+        public bool IsExpandedTarget(FST.Arc<T> follow, FST.BytesReader @in)
         {
             if (!TargetHasArcs(follow))
             {
@@ -1107,15 +1083,15 @@ namespace Lucene.Net.Util.Fst
             else
             {
                 @in.Position = GetNodeAddress(follow.Target);
-                return @in.ReadByte() == ARCS_AS_FIXED_ARRAY;
+                return @in.ReadByte() == FST.ARCS_AS_FIXED_ARRAY;
             }
         }
 
         /// <summary>
         /// In-place read; returns the arc. </summary>
-        public Arc<T> ReadNextArc(Arc<T> arc, FST.BytesReader @in)
+        public FST.Arc<T> ReadNextArc(FST.Arc<T> arc, FST.BytesReader @in)
         {
-            if (arc.Label == END_LABEL)
+            if (arc.Label == FST.END_LABEL)
             {
                 // this was a fake inserted "final" arc
                 if (arc.NextArc <= 0)
@@ -1134,11 +1110,11 @@ namespace Lucene.Net.Util.Fst
         /// Peeks at next arc's label; does not alter arc.  Do
         ///  not call this if arc.isLast()!
         /// </summary>
-        public int ReadNextArcLabel(Arc<T> arc, BytesReader @in)
+        public int ReadNextArcLabel(FST.Arc<T> arc, FST.BytesReader @in)
         {
             Debug.Assert(!arc.IsLast);
 
-            if (arc.Label == END_LABEL)
+            if (arc.Label == FST.END_LABEL)
             {
                 //System.out.println("    nextArc fake " +
                 //arc.nextArc);
@@ -1147,13 +1123,13 @@ namespace Lucene.Net.Util.Fst
                 @in.Position = pos;
 
                 var b = (sbyte)@in.ReadByte();
-                if (b == ARCS_AS_FIXED_ARRAY)
+                if (b == FST.ARCS_AS_FIXED_ARRAY)
                 {
                     //System.out.println("    nextArc fixed array");
                     @in.ReadVInt();
 
                     // Skip bytesPerArc:
-                    if (packed || version >= VERSION_VINT_TARGET)
+                    if (packed || version >= FST.VERSION_VINT_TARGET)
                     {
                         @in.ReadVInt();
                     }
@@ -1192,7 +1168,7 @@ namespace Lucene.Net.Util.Fst
         /// Never returns null, but you should never call this if
         ///  arc.isLast() is true.
         /// </summary>
-        public Arc<T> ReadNextRealArc(Arc<T> arc, FST.BytesReader @in)
+        public FST.Arc<T> ReadNextRealArc(FST.Arc<T> arc, FST.BytesReader @in)
         {
             // TODO: can't assert this because we call from readFirstArc
             // assert !flag(arc.flags, BIT_LAST_ARC);
@@ -1214,7 +1190,7 @@ namespace Lucene.Net.Util.Fst
             arc.Flags = (sbyte)@in.ReadByte();
             arc.Label = ReadLabel(@in);
 
-            if (arc.Flag(BIT_ARC_HAS_OUTPUT))
+            if (arc.Flag(FST.BIT_ARC_HAS_OUTPUT))
             {
                 arc.Output = Outputs.Read(@in);
             }
@@ -1223,7 +1199,7 @@ namespace Lucene.Net.Util.Fst
                 arc.Output = Outputs.NoOutput;
             }
 
-            if (arc.Flag(BIT_ARC_HAS_FINAL_OUTPUT))
+            if (arc.Flag(FST.BIT_ARC_HAS_FINAL_OUTPUT))
             {
                 arc.NextFinalOutput = Outputs.ReadFinalOutput(@in);
             }
@@ -1232,26 +1208,26 @@ namespace Lucene.Net.Util.Fst
                 arc.NextFinalOutput = Outputs.NoOutput;
             }
 
-            if (arc.Flag(BIT_STOP_NODE))
+            if (arc.Flag(FST.BIT_STOP_NODE))
             {
-                if (arc.Flag(BIT_FINAL_ARC))
+                if (arc.Flag(FST.BIT_FINAL_ARC))
                 {
-                    arc.Target = FINAL_END_NODE;
+                    arc.Target = FST.FINAL_END_NODE;
                 }
                 else
                 {
-                    arc.Target = NON_FINAL_END_NODE;
+                    arc.Target = FST.NON_FINAL_END_NODE;
                 }
                 arc.NextArc = @in.Position;
             }
-            else if (arc.Flag(BIT_TARGET_NEXT))
+            else if (arc.Flag(FST.BIT_TARGET_NEXT))
             {
                 arc.NextArc = @in.Position;
                 // TODO: would be nice to make this lazy -- maybe
                 // caller doesn't need the target and is scanning arcs...
                 if (nodeAddress == null)
                 {
-                    if (!arc.Flag(BIT_LAST_ARC))
+                    if (!arc.Flag(FST.BIT_LAST_ARC))
                     {
                         if (arc.BytesPerArc == 0)
                         {
@@ -1278,7 +1254,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     long pos = @in.Position;
                     long code = @in.ReadVLong();
-                    if (arc.Flag(BIT_TARGET_DELTA))
+                    if (arc.Flag(FST.BIT_TARGET_DELTA))
                     {
                         // Address is delta-coded from current address:
                         arc.Target = pos + code;
@@ -1313,15 +1289,15 @@ namespace Lucene.Net.Util.Fst
         /// Finds an arc leaving the incoming arc, replacing the arc in place.
         ///  this returns null if the arc was not found, else the incoming arc.
         /// </summary>
-        public Arc<T> FindTargetArc(int labelToMatch, Arc<T> follow, Arc<T> arc, FST.BytesReader @in)
+        public FST.Arc<T> FindTargetArc(int labelToMatch, FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
-            if (labelToMatch == END_LABEL)
+            if (labelToMatch == FST.END_LABEL)
             {
                 if (follow.IsFinal)
                 {
                     if (follow.Target <= 0)
                     {
-                        arc.Flags = (sbyte)BIT_LAST_ARC;
+                        arc.Flags = (sbyte)FST.BIT_LAST_ARC;
                     }
                     else
                     {
@@ -1331,7 +1307,7 @@ namespace Lucene.Net.Util.Fst
                         arc.Node = follow.Target;
                     }
                     arc.Output = follow.NextFinalOutput;
-                    arc.Label = END_LABEL;
+                    arc.Label = FST.END_LABEL;
                     return arc;
                 }
                 else
@@ -1346,7 +1322,7 @@ namespace Lucene.Net.Util.Fst
                 // LUCENE-5152: detect tricky cases where caller
                 // modified previously returned cached root-arcs:
                 Debug.Assert(AssertRootArcs());
-                Arc<T> result = cachedRootArcs[labelToMatch];
+                FST.Arc<T> result = cachedRootArcs[labelToMatch];
                 if (result == null)
                 {
                     return null;
@@ -1369,11 +1345,11 @@ namespace Lucene.Net.Util.Fst
 
             // System.out.println("fta label=" + (char) labelToMatch);
 
-            if (@in.ReadByte() == ARCS_AS_FIXED_ARRAY)
+            if (@in.ReadByte() == FST.ARCS_AS_FIXED_ARRAY)
             {
                 // Arcs are full array; do binary search:
                 arc.NumArcs = @in.ReadVInt();
-                if (packed || version >= VERSION_VINT_TARGET)
+                if (packed || version >= FST.VERSION_VINT_TARGET)
                 {
                     arc.BytesPerArc = @in.ReadVInt();
                 }
@@ -1447,17 +1423,17 @@ namespace Lucene.Net.Util.Fst
                 int flags = @in.ReadByte();
                 ReadLabel(@in);
 
-                if (Flag(flags, BIT_ARC_HAS_OUTPUT))
+                if (Flag(flags, FST.BIT_ARC_HAS_OUTPUT))
                 {
                     Outputs.Read(@in);
                 }
 
-                if (Flag(flags, BIT_ARC_HAS_FINAL_OUTPUT))
+                if (Flag(flags, FST.BIT_ARC_HAS_FINAL_OUTPUT))
                 {
                     Outputs.ReadFinalOutput(@in);
                 }
 
-                if (!Flag(flags, BIT_STOP_NODE) && !Flag(flags, BIT_TARGET_NEXT))
+                if (!Flag(flags, FST.BIT_STOP_NODE) && !Flag(flags, FST.BIT_TARGET_NEXT))
                 {
                     if (packed)
                     {
@@ -1469,7 +1445,7 @@ namespace Lucene.Net.Util.Fst
                     }
                 }
 
-                if (Flag(flags, BIT_LAST_ARC))
+                if (Flag(flags, FST.BIT_LAST_ARC))
                 {
                     return;
                 }
@@ -1517,7 +1493,7 @@ namespace Lucene.Net.Util.Fst
         /// <seealso cref= Builder.UnCompiledNode#depth </seealso>
         private bool ShouldExpand(Builder<T>.UnCompiledNode<T> node)
         {
-            return allowArrayArcs && ((node.Depth <= FIXED_ARRAY_SHALLOW_DISTANCE && node.NumArcs >= FIXED_ARRAY_NUM_ARCS_SHALLOW) || node.NumArcs >= FIXED_ARRAY_NUM_ARCS_DEEP);
+            return allowArrayArcs && ((node.Depth <= FST.FIXED_ARRAY_SHALLOW_DISTANCE && node.NumArcs >= FST.FIXED_ARRAY_NUM_ARCS_SHALLOW) || node.NumArcs >= FST.FIXED_ARRAY_NUM_ARCS_DEEP);
         }
 
         /// <summary>
@@ -1671,9 +1647,9 @@ namespace Lucene.Net.Util.Fst
        */
 
         // Creates a packed FST
-        private FST(INPUT_TYPE inputType, Outputs<T> outputs, int bytesPageBits)
+        private FST(FST.INPUT_TYPE inputType, Outputs<T> outputs, int bytesPageBits)
         {
-            version = VERSION_CURRENT;
+            version = FST.VERSION_CURRENT;
             packed = true;
             this.inputType = inputType;
             Bytes = new BytesStore(bytesPageBits);
@@ -1720,24 +1696,24 @@ namespace Lucene.Net.Util.Fst
                 throw new System.ArgumentException("this FST was not built with willPackFST=true");
             }
 
-            Arc<T> arc = new Arc<T>();
+            FST.Arc<T> arc = new FST.Arc<T>();
 
-            BytesReader r = BytesReader;
+            FST.BytesReader r = BytesReader;
 
             int topN = Math.Min(maxDerefNodes, inCounts.Size());
 
             // Find top nodes with highest number of incoming arcs:
-            NodeQueue q = new NodeQueue(topN);
+            FST.NodeQueue q = new FST.NodeQueue(topN);
 
             // TODO: we could use more RAM efficient selection algo here...
-            NodeAndInCount bottom = null;
+            FST.NodeAndInCount bottom = null;
             for (int node = 0; node < inCounts.Size(); node++)
             {
                 if (inCounts.Get(node) >= minInCountDeref)
                 {
                     if (bottom == null)
                     {
-                        q.Add(new NodeAndInCount(node, (int)inCounts.Get(node)));
+                        q.Add(new FST.NodeAndInCount(node, (int)inCounts.Get(node)));
                         if (q.Size() == topN)
                         {
                             bottom = q.Top();
@@ -1745,7 +1721,7 @@ namespace Lucene.Net.Util.Fst
                     }
                     else if (inCounts.Get(node) > bottom.Count)
                     {
-                        q.InsertWithOverflow(new NodeAndInCount(node, (int)inCounts.Get(node)));
+                        q.InsertWithOverflow(new FST.NodeAndInCount(node, (int)inCounts.Get(node)));
                     }
                 }
             }
@@ -1756,7 +1732,7 @@ namespace Lucene.Net.Util.Fst
             IDictionary<int, int> topNodeMap = new Dictionary<int, int>();
             for (int downTo = q.Size() - 1; downTo >= 0; downTo--)
             {
-                NodeAndInCount n = q.Pop();
+                FST.NodeAndInCount n = q.Pop();
                 topNodeMap[n.Node] = downTo;
                 //System.out.println("map node=" + n.Node + " inCount=" + n.count + " to newID=" + downTo);
             }
@@ -1846,7 +1822,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 bytesPerArc = arc.BytesPerArc;
                             }
-                            writer.WriteByte((byte)ARCS_AS_FIXED_ARRAY);
+                            writer.WriteByte((byte)FST.ARCS_AS_FIXED_ARRAY);
                             writer.WriteVInt(arc.NumArcs);
                             writer.WriteVInt(bytesPerArc);
                             //System.out.println("node " + node + ": " + arc.numArcs + " arcs");
@@ -1865,7 +1841,7 @@ namespace Lucene.Net.Util.Fst
 
                             if (arc.IsLast)
                             {
-                                flags += (sbyte)BIT_LAST_ARC;
+                                flags += (sbyte)FST.BIT_LAST_ARC;
                             }
                             /*
                             if (!useArcArray && nodeUpto < nodes.length-1 && arc.Target == nodes[nodeUpto+1]) {
@@ -1874,7 +1850,7 @@ namespace Lucene.Net.Util.Fst
                             */
                             if (!useArcArray && node != 1 && arc.Target == node - 1)
                             {
-                                flags += (sbyte)BIT_TARGET_NEXT;
+                                flags += (sbyte)FST.BIT_TARGET_NEXT;
                                 if (!retry)
                                 {
                                     nextCount++;
@@ -1882,10 +1858,10 @@ namespace Lucene.Net.Util.Fst
                             }
                             if (arc.IsFinal)
                             {
-                                flags += (sbyte)BIT_FINAL_ARC;
+                                flags += (sbyte)FST.BIT_FINAL_ARC;
                                 if (!arc.NextFinalOutput.Equals(NO_OUTPUT))
                                 {
-                                    flags += (sbyte)BIT_ARC_HAS_FINAL_OUTPUT;
+                                    flags += (sbyte)FST.BIT_ARC_HAS_FINAL_OUTPUT;
                                 }
                             }
                             else
@@ -1894,16 +1870,16 @@ namespace Lucene.Net.Util.Fst
                             }
                             if (!TargetHasArcs(arc))
                             {
-                                flags += (sbyte)BIT_STOP_NODE;
+                                flags += (sbyte)FST.BIT_STOP_NODE;
                             }
 
                             if (!arc.Output.Equals(NO_OUTPUT))
                             {
-                                flags += (sbyte)BIT_ARC_HAS_OUTPUT;
+                                flags += (sbyte)FST.BIT_ARC_HAS_OUTPUT;
                             }
 
                             long absPtr;
-                            bool doWriteTarget = TargetHasArcs(arc) && (flags & BIT_TARGET_NEXT) == 0;
+                            bool doWriteTarget = TargetHasArcs(arc) && (flags & FST.BIT_TARGET_NEXT) == 0;
                             if (doWriteTarget)
                             {
                                 int ptr;
@@ -1926,7 +1902,7 @@ namespace Lucene.Net.Util.Fst
 
                                 if (delta < absPtr)
                                 {
-                                    flags |= BIT_TARGET_DELTA;
+                                    flags |= FST.BIT_TARGET_DELTA;
                                 }
                             }
                             else
@@ -1934,7 +1910,7 @@ namespace Lucene.Net.Util.Fst
                                 absPtr = 0;
                             }
 
-                            Debug.Assert(flags != ARCS_AS_FIXED_ARRAY);
+                            Debug.Assert(flags != FST.ARCS_AS_FIXED_ARRAY);
                             writer.WriteByte((byte)(sbyte)flags);
 
                             fst.WriteLabel(writer, arc.Label);
@@ -1962,7 +1938,7 @@ namespace Lucene.Net.Util.Fst
                                     delta = 0;
                                 }
 
-                                if (Flag(flags, BIT_TARGET_DELTA))
+                                if (Flag(flags, FST.BIT_TARGET_DELTA))
                                 {
                                     //System.out.println("        delta");
                                     writer.WriteVLong(delta);
@@ -2100,11 +2076,14 @@ namespace Lucene.Net.Util.Fst
     }
 
     /// <summary>
-    /// .NET Port: This new base class is to mimic Java's ability to use nested types without specifying
+    /// LUCENENET specific: This new base class is to mimic Java's ability to use nested types without specifying
     /// a type parameter. i.e. FST.BytesReader instead of FST&lt;BytesRef&gt;.BytesReader
     /// </summary>
-    public class FST
+    public sealed class FST
     {
+        public FST()
+        { }
+
         internal const int BIT_FINAL_ARC = 1 << 0;
         internal const int BIT_LAST_ARC = 1 << 1;
         internal const int BIT_TARGET_NEXT = 1 << 2;
@@ -2177,6 +2156,10 @@ namespace Lucene.Net.Util.Fst
         // non-final node w/ no arcs:
         internal const long NON_FINAL_END_NODE = 0;
 
+        /// <summary>
+        /// If arc has this label then that arc is final/accepted </summary>
+        public static readonly int END_LABEL = -1;
+
         // returns true if the node at this address has any
         // outgoing arcs
         public static bool TargetHasArcs<T>(Arc<T> arc)
@@ -2185,6 +2168,32 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
+        /// Reads an automaton from a file.
+        /// </summary>
+        public static FST<T> Read<T>(FileInfo file, Outputs<T> outputs)
+        {
+            var bs = new BufferedStream(file.OpenRead());
+            bool success = false;
+            try
+            {
+                FST<T> fst = new FST<T>(new InputStreamDataInput(bs), outputs);
+                success = true;
+                return fst;
+            }
+            finally
+            {
+                if (success)
+                {
+                    IOUtils.Close(bs);
+                }
+                else
+                {
+                    IOUtils.CloseWhileHandlingException(bs);
+                }
+            }
+        }
+
+        /// <summary>
         /// Reads bytes stored in an FST.
         /// </summary>
         public abstract class BytesReader : DataInput

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/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 dfdaf67..89b36a2 100644
--- a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
@@ -30,14 +30,14 @@ namespace Lucene.Net.Util.Fst
     {
         protected internal readonly FST<T> fst;
 
-        protected internal FST<T>.Arc<T>[] arcs = new FST<T>.Arc<T>[10];
+        protected internal FST.Arc<T>[] arcs = new FST.Arc<T>[10];
 
         // outputs are cumulative
         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.BytesReader fstReader;
+        protected internal readonly FST.Arc<T> scratchArc = new FST.Arc<T>();
 
         protected internal int upto;
         protected internal int targetLength;
@@ -91,7 +91,7 @@ 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.Arc<T> arc = GetArc(upto);
                     fst.ReadFirstTargetArc(GetArc(upto - 1), arc, fstReader);
                     //System.out.println("    seek first arc");
                     break;
@@ -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.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.BytesReader @in = fst.BytesReader;
                     int low = arc.ArcIdx;
                     int high = arc.NumArcs - 1;
                     int mid = 0;
@@ -203,7 +203,7 @@ namespace Lucene.Net.Util.Fst
                         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);
-                        if (targetLabel == FST<T>.END_LABEL)
+                        if (targetLabel == FST.END_LABEL)
                         {
                             return;
                         }
@@ -228,7 +228,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 return;
                             }
-                            FST<T>.Arc<T> prevArc = GetArc(upto);
+                            FST.Arc<T> prevArc = GetArc(upto);
                             //System.out.println("  rollback upto=" + upto + " arc.label=" + prevArc.label + " isLast?=" + prevArc.isLast());
                             if (!prevArc.IsLast)
                             {
@@ -255,7 +255,7 @@ namespace Lucene.Net.Util.Fst
                     {
                         // recurse
                         output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
-                        if (targetLabel == FST<T>.END_LABEL)
+                        if (targetLabel == FST.END_LABEL)
                         {
                             return;
                         }
@@ -280,7 +280,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 return;
                             }
-                            FST<T>.Arc<T> prevArc = GetArc(upto);
+                            FST.Arc<T> prevArc = GetArc(upto);
                             //System.out.println("  rollback upto=" + upto + " arc.label=" + prevArc.label + " isLast?=" + prevArc.isLast());
                             if (!prevArc.IsLast)
                             {
@@ -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.Arc<T> arc = GetArc(upto);
             int targetLabel = TargetLabel;
 
             //System.out.println("FE: init targetLabel=" + targetLabel);
@@ -329,12 +329,12 @@ namespace Lucene.Net.Util.Fst
             {
                 //System.out.println("  cycle upto=" + upto + " arc.label=" + arc.label + " (" + (char) arc.label + ") targetLabel=" + targetLabel + " isLast?=" + arc.isLast() + " bba=" + arc.bytesPerArc);
 
-                if (arc.BytesPerArc != 0 && arc.Label != FST<T>.END_LABEL)
+                if (arc.BytesPerArc != 0 && arc.Label != FST.END_LABEL)
                 {
                     // Arcs are fixed array -- use binary search to find
                     // the target.
 
-                    FST<T>.BytesReader @in = fst.BytesReader;
+                    FST.BytesReader @in = fst.BytesReader;
                     int low = arc.ArcIdx;
                     int high = arc.NumArcs - 1;
                     int mid = 0;
@@ -374,7 +374,7 @@ namespace Lucene.Net.Util.Fst
                         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);
-                        if (targetLabel == FST<T>.END_LABEL)
+                        if (targetLabel == FST.END_LABEL)
                         {
                             return;
                         }
@@ -435,7 +435,7 @@ namespace Lucene.Net.Util.Fst
                     {
                         // Match -- recurse
                         output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
-                        if (targetLabel == FST<T>.END_LABEL)
+                        if (targetLabel == FST.END_LABEL)
                         {
                             return;
                         }
@@ -514,15 +514,15 @@ namespace Lucene.Net.Util.Fst
             RewindPrefix();
 
             //System.out.println("FE: after rewind upto=" + upto);
-            FST<T>.Arc<T> arc = GetArc(upto - 1);
+            FST.Arc<T> arc = GetArc(upto - 1);
             int targetLabel = TargetLabel;
 
-            FST<T>.BytesReader fstReader = fst.BytesReader;
+            FST.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.Arc<T> nextArc = fst.FindTargetArc(targetLabel, arc, GetArc(upto), fstReader);
                 if (nextArc == null)
                 {
                     // short circuit
@@ -534,7 +534,7 @@ namespace Lucene.Net.Util.Fst
                 }
                 // Match -- recurse:
                 output[upto] = fst.Outputs.Add(output[upto - 1], nextArc.Output);
-                if (targetLabel == FST<T>.END_LABEL)
+                if (targetLabel == FST.END_LABEL)
                 {
                     //System.out.println("  return found; upto=" + upto + " output=" + output[upto] + " nextArc=" + nextArc.isLast());
                     return true;
@@ -552,7 +552,7 @@ namespace Lucene.Net.Util.Fst
             Grow();
             if (arcs.Length <= upto)
             {
-                FST<T>.Arc<T>[] newArcs = new FST<T>.Arc<T>[ArrayUtil.Oversize(1 + upto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+                FST.Arc<T>[] newArcs = new FST.Arc<T>[ArrayUtil.Oversize(1 + upto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
                 Array.Copy(arcs, 0, newArcs, 0, arcs.Length);
                 arcs = newArcs;
             }
@@ -568,13 +568,13 @@ 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.Arc<T> arc = arcs[upto];
             Debug.Assert(arc != null);
 
             while (true)
             {
                 output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
-                if (arc.Label == FST<T>.END_LABEL)
+                if (arc.Label == FST.END_LABEL)
                 {
                     // Final node
                     break;
@@ -583,7 +583,7 @@ namespace Lucene.Net.Util.Fst
                 CurrentLabel = arc.Label;
                 Incr();
 
-                FST<T>.Arc<T> nextArc = GetArc(upto);
+                FST.Arc<T> nextArc = GetArc(upto);
                 fst.ReadFirstTargetArc(arc, nextArc, fstReader);
                 arc = nextArc;
             }
@@ -593,14 +593,14 @@ namespace Lucene.Net.Util.Fst
         // way to the first final node
         private void PushLast()
         {
-            FST<T>.Arc<T> arc = arcs[upto];
+            FST.Arc<T> arc = arcs[upto];
             Debug.Assert(arc != null);
 
             while (true)
             {
                 CurrentLabel = arc.Label;
                 output[upto] = fst.Outputs.Add(output[upto - 1], arc.Output);
-                if (arc.Label == FST<T>.END_LABEL)
+                if (arc.Label == FST.END_LABEL)
                 {
                     // Final node
                     break;
@@ -611,11 +611,11 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        private FST<T>.Arc<T> GetArc(int idx)
+        private FST.Arc<T> GetArc(int idx)
         {
             if (arcs[idx] == null)
             {
-                arcs[idx] = new FST<T>.Arc<T>();
+                arcs[idx] = new FST.Arc<T>();
             }
             return arcs[idx];
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/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 f679a6f..370b5a9 100644
--- a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
@@ -105,7 +105,7 @@ namespace Lucene.Net.Util.Fst
             {
                 if (upto - 1 == target.Length)
                 {
-                    return FST<T>.END_LABEL;
+                    return FST.END_LABEL;
                 }
                 else
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/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 a0fb659..95b6115 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -30,7 +30,7 @@ namespace Lucene.Net.Util.Fst
         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.Arc<T> scratchArc = new FST.Arc<T>();
         private readonly FST.BytesReader input;
 
         public NodeHash(FST<T> fst, FST.BytesReader input)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/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 baf648f..15a80b7 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -43,7 +43,7 @@ namespace Lucene.Net.Util.Fst
         public static T Get<T>(FST<T> fst, IntsRef input)
         {
             // TODO: would be nice not to alloc this on every lookup
-            var arc = fst.GetFirstArc(new FST<T>.Arc<T>());
+            var arc = fst.GetFirstArc(new FST.Arc<T>());
 
             var fstReader = fst.BytesReader;
 
@@ -76,12 +76,12 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         public static T Get<T>(FST<T> fst, BytesRef input)
         {
-            Debug.Assert(fst.inputType == FST<long>.INPUT_TYPE.BYTE1);
+            Debug.Assert(fst.InputType == FST.INPUT_TYPE.BYTE1);
 
             var fstReader = fst.BytesReader;
 
             // TODO: would be nice not to alloc this on every lookup
-            var arc = fst.GetFirstArc(new FST<T>.Arc<T>());
+            var arc = fst.GetFirstArc(new FST.Arc<T>());
 
             // Accumulate output as we go
             T output = fst.Outputs.NoOutput;
@@ -123,9 +123,9 @@ namespace Lucene.Net.Util.Fst
             var @in = fst.BytesReader;
 
             // TODO: would be nice not to alloc this on every lookup
-            FST<long?>.Arc<long?> arc = fst.GetFirstArc(new FST<long?>.Arc<long?>());
+            FST.Arc<long?> arc = fst.GetFirstArc(new FST.Arc<long?>());
 
-            FST<long?>.Arc<long?> scratchArc = new FST<long?>.Arc<long?>();
+            FST.Arc<long?> scratchArc = new FST.Arc<long?>();
 
             IntsRef result = new IntsRef();
 
@@ -136,7 +136,7 @@ namespace Lucene.Net.Util.Fst
         /// Expert: like <seealso cref="Util#getByOutput(FST, long)"/> except reusing
         /// BytesReader, initial and scratch Arc, and result.
         /// </summary>
-        public static IntsRef GetByOutput(FST<long?> fst, long targetOutput, FST<long?>.BytesReader @in, FST<long?>.Arc<long?> arc, FST<long?>.Arc<long?> scratchArc, IntsRef result)
+        public static IntsRef GetByOutput(FST<long?> fst, long targetOutput, FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc, IntsRef result)
         {
             long output = arc.Output.Value;
             int upto = 0;
@@ -188,7 +188,7 @@ namespace Lucene.Net.Util.Fst
                             var flags = (sbyte)@in.ReadByte();
                             fst.ReadLabel(@in);
                             long minArcOutput;
-                            if ((flags & FST<long>.BIT_ARC_HAS_OUTPUT) != 0)
+                            if ((flags & FST.BIT_ARC_HAS_OUTPUT) != 0)
                             {
                                 long arcOutput = fst.Outputs.Read(@in).Value;
                                 minArcOutput = output + arcOutput;
@@ -231,7 +231,7 @@ namespace Lucene.Net.Util.Fst
                     }
                     else
                     {
-                        FST<long?>.Arc<long?> prevArc = null;
+                        FST.Arc<long?> prevArc = null;
 
                         while (true)
                         {
@@ -300,15 +300,15 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         public class FSTPath<T>
         {
-            public FST<T>.Arc<T> Arc;
+            public FST.Arc<T> Arc;
             public T Cost;
             public readonly IntsRef Input;
 
             /// <summary>
             /// Sole constructor </summary>
-            public FSTPath(T cost, FST<T>.Arc<T> arc, IntsRef input)
+            public FSTPath(T cost, FST.Arc<T> arc, IntsRef input)
             {
-                this.Arc = (new FST<T>.Arc<T>()).CopyFrom(arc);
+                this.Arc = (new FST.Arc<T>()).CopyFrom(arc);
                 this.Cost = cost;
                 this.Input = input;
             }
@@ -353,11 +353,11 @@ namespace Lucene.Net.Util.Fst
         public class TopNSearcher<T>
         {
             private readonly FST<T> fst;
-            private readonly FST<T>.BytesReader bytesReader;
+            private readonly FST.BytesReader bytesReader;
             private readonly int topN;
             private readonly int maxQueueDepth;
 
-            private readonly FST<T>.Arc<T> scratchArc = new FST<T>.Arc<T>();
+            private readonly FST.Arc<T> scratchArc = new FST.Arc<T>();
 
             internal readonly IComparer<T> Comparator;
 
@@ -441,7 +441,7 @@ namespace Lucene.Net.Util.Fst
             /// Adds all leaving arcs, including 'finished' arc, if
             ///  the node is final, from this node into the queue.
             /// </summary>
-            public virtual void AddStartPaths(FST<T>.Arc<T> node, T startOutput, bool allowEmptyString, IntsRef input)
+            public virtual void AddStartPaths(FST.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))
@@ -457,7 +457,7 @@ namespace Lucene.Net.Util.Fst
                 // Bootstrap: find the min starting arc
                 while (true)
                 {
-                    if (allowEmptyString || path.Arc.Label != FST<T>.END_LABEL)
+                    if (allowEmptyString || path.Arc.Label != FST.END_LABEL)
                     {
                         AddIfCompetitive(path);
                     }
@@ -511,7 +511,7 @@ namespace Lucene.Net.Util.Fst
                         break;
                     }
 
-                    if (path.Arc.Label == FST<T>.END_LABEL)
+                    if (path.Arc.Label == FST.END_LABEL)
                     {
                         //System.out.println("    empty string!  cost=" + path.cost);
                         // Empty string!
@@ -586,7 +586,7 @@ namespace Lucene.Net.Util.Fst
                             path.Arc.CopyFrom(scratchArc);
                         }
 
-                        if (path.Arc.Label == FST<T>.END_LABEL)
+                        if (path.Arc.Label == FST.END_LABEL)
                         {
                             // Add final output:
                             //System.out.println("    done!: " + path);
@@ -674,7 +674,7 @@ namespace Lucene.Net.Util.Fst
         /// Starting from node, find the top N min cost
         ///  completions to a final node.
         /// </summary>
-        public static TopResults<T> ShortestPaths<T>(FST<T> fst, FST<T>.Arc<T> fromNode, T startOutput, IComparer<T> comparator, int topN, bool allowEmptyString)
+        public static TopResults<T> ShortestPaths<T>(FST<T> fst, FST.Arc<T> fromNode, T startOutput, IComparer<T> comparator, int topN, bool allowEmptyString)
         {
             // All paths are kept, so we can pass topN for
             // maxQueueDepth and the pruning is admissible:
@@ -723,13 +723,13 @@ namespace Lucene.Net.Util.Fst
 
             // this is the start arc in the automaton (from the epsilon state to the first state
             // with outgoing transitions.
-            FST<T>.Arc<T> startArc = fst.GetFirstArc(new FST<T>.Arc<T>());
+            FST.Arc<T> startArc = fst.GetFirstArc(new FST.Arc<T>());
 
             // A queue of transitions to consider for the next level.
-            IList<FST<T>.Arc<T>> thisLevelQueue = new List<FST<T>.Arc<T>>();
+            IList<FST.Arc<T>> thisLevelQueue = new List<FST.Arc<T>>();
 
             // A queue of transitions to consider when processing the next level.
-            IList<FST<T>.Arc<T>> nextLevelQueue = new List<FST<T>.Arc<T>>();
+            IList<FST.Arc<T>> nextLevelQueue = new List<FST.Arc<T>>();
             nextLevelQueue.Add(startArc);
             //System.out.println("toDot: startArc: " + startArc);
 
@@ -802,7 +802,7 @@ namespace Lucene.Net.Util.Fst
                 @out.Write("\n  // Transitions and states at level: " + level + "\n");
                 while (thisLevelQueue.Count > 0)
                 {
-                    FST<T>.Arc<T> arc = thisLevelQueue[thisLevelQueue.Count - 1];
+                    FST.Arc<T> arc = thisLevelQueue[thisLevelQueue.Count - 1];
                     thisLevelQueue.RemoveAt(thisLevelQueue.Count - 1);
                     //System.out.println("  pop: " + arc);
                     if (FST<T>.TargetHasArcs(arc))
@@ -857,7 +857,7 @@ namespace Lucene.Net.Util.Fst
                                 // To see the node address, use this instead:
                                 //emitDotState(out, Integer.toString(arc.target), stateShape, stateColor, String.valueOf(arc.target));
                                 seen.SafeSet((int)arc.Target, true);
-                                nextLevelQueue.Add((new FST<T>.Arc<T>()).CopyFrom(arc));
+                                nextLevelQueue.Add((new FST.Arc<T>()).CopyFrom(arc));
                                 sameLevelStates.Add((int)arc.Target);
                             }
 
@@ -883,7 +883,7 @@ namespace Lucene.Net.Util.Fst
                             }
 
                             string arcColor;
-                            if (arc.Flag(FST<T>.BIT_TARGET_NEXT))
+                            if (arc.Flag(FST.BIT_TARGET_NEXT))
                             {
                                 arcColor = "red";
                             }
@@ -892,7 +892,7 @@ namespace Lucene.Net.Util.Fst
                                 arcColor = "black";
                             }
 
-                            Debug.Assert(arc.Label != FST<T>.END_LABEL);
+                            Debug.Assert(arc.Label != FST.END_LABEL);
                             @out.Write("  " + node + " -> " + arc.Target + " [label=\"" + PrintableLabel(arc.Label) + outs + "\"" + (arc.IsFinal ? " style=\"bold\"" : "") + " color=\"" + arcColor + "\"]\n");
 
                             // Break the loop if we're on the last arc of this state.
@@ -1062,16 +1062,16 @@ namespace Lucene.Net.Util.Fst
         /// <param name="follow"> the arc to follow reading the label from </param>
         /// <param name="arc"> the arc to read into in place </param>
         /// <param name="in"> the fst's <seealso cref="BytesReader"/> </param>
-        public static FST<T>.Arc<T> ReadCeilArc<T>(int label, FST<T> fst, FST<T>.Arc<T> follow, FST<T>.Arc<T> arc, FST<T>.BytesReader @in)
+        public static FST.Arc<T> ReadCeilArc<T>(int label, FST<T> fst, FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
             // TODO maybe this is a useful in the FST class - we could simplify some other code like FSTEnum?
-            if (label == FST<T>.END_LABEL)
+            if (label == FST.END_LABEL)
             {
                 if (follow.IsFinal)
                 {
                     if (follow.Target <= 0)
                     {
-                        arc.Flags = (sbyte)FST<T>.BIT_LAST_ARC;
+                        arc.Flags = (sbyte)FST.BIT_LAST_ARC;
                     }
                     else
                     {
@@ -1081,7 +1081,7 @@ namespace Lucene.Net.Util.Fst
                         arc.Node = follow.Target;
                     }
                     arc.Output = follow.NextFinalOutput;
-                    arc.Label = FST<T>.END_LABEL;
+                    arc.Label = FST.END_LABEL;
                     return arc;
                 }
                 else
@@ -1095,7 +1095,7 @@ namespace Lucene.Net.Util.Fst
                 return null;
             }
             fst.ReadFirstTargetArc(follow, arc, @in);
-            if (arc.BytesPerArc != 0 && arc.Label != FST<T>.END_LABEL)
+            if (arc.BytesPerArc != 0 && arc.Label != FST.END_LABEL)
             {
                 // Arcs are fixed array -- use binary search to find
                 // the target.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/01e903b1/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
index cb5f44d..492dca4 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -217,7 +217,7 @@ namespace Lucene.Net.Util.Fst
         private T Run(FST<T> fst, IntsRef term, int[] prefixLength)
         {
             Debug.Assert(prefixLength == null || prefixLength.Length == 1);
-            FST<T>.Arc<T> arc = fst.GetFirstArc(new FST.Arc<T>());
+            FST.Arc<T> arc = fst.GetFirstArc(new FST.Arc<T>());
             T NO_OUTPUT = fst.Outputs.NoOutput;
             T output = NO_OUTPUT;
             FST.BytesReader fstReader = fst.BytesReader;
@@ -227,7 +227,7 @@ namespace Lucene.Net.Util.Fst
                 int label;
                 if (i == term.Length)
                 {
-                    label = FST<T>.END_LABEL;
+                    label = FST.END_LABEL;
                 }
                 else
                 {
@@ -288,7 +288,7 @@ namespace Lucene.Net.Util.Fst
                 output = fst.Outputs.Add(output, arc.Output);
 
                 // append label
-                if (arc.Label == FST<T>.END_LABEL)
+                if (arc.Label == FST.END_LABEL)
                 {
                     break;
                 }