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

[01/49] lucenenet git commit: Setup InternalsVisibleTo Lucene.Net.Core <- Lucene.Net.Tests for testing.

Repository: lucenenet
Updated Branches:
  refs/heads/master 1946bf82c -> e6012b5a7


Setup InternalsVisibleTo Lucene.Net.Core <- Lucene.Net.Tests for testing.


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

Branch: refs/heads/master
Commit: c67366fd4b383c31971a8ae68b458dec7aee2d7f
Parents: 859d37d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Sep 5 21:25:35 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Mon Sep 5 21:25:35 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/AssemblyInfo.cs             | 22 +++++++++++++-------
 .../core/Index/TestConcurrentMergeScheduler.cs  |  4 ++--
 .../core/Index/TestFieldsReader.cs              |  2 +-
 .../core/Index/TestIndexReaderClose.cs          |  2 +-
 .../core/Index/TestIndexWriter.cs               |  4 ++--
 .../core/Index/TestIndexWriterDelete.cs         |  2 +-
 .../core/Index/TestIndexWriterExceptions.cs     |  2 +-
 .../core/Search/JustCompileSearch.cs            |  4 ++--
 .../core/Search/Spans/JustCompileSearchSpans.cs |  2 +-
 .../core/Search/TestBooleanQuery.cs             |  2 +-
 .../core/Search/TestDocIdSet.cs                 |  4 ++--
 .../core/Search/TestFilteredQuery.cs            |  2 +-
 .../core/Search/TestLiveFieldValues.cs          |  2 +-
 .../core/Search/TestMultiTermQueryRewrites.cs   |  2 +-
 .../core/Search/TestPrefixRandom.cs             |  2 +-
 .../core/Search/TestQueryRescorer.cs            |  6 +++---
 .../core/Search/TestRegexpRandom2.cs            |  2 +-
 .../core/Search/TestTopDocsCollector.cs         |  2 +-
 .../core/Store/TestBufferedIndexInput.cs        |  2 +-
 .../core/Store/TestHugeRamFile.cs               |  2 +-
 .../core/TestMergeSchedulerExternal.cs          |  6 +++---
 .../core/Util/TestCloseableThreadLocal.cs       |  2 +-
 .../core/Util/TestFilterIterator.cs             | 16 +++++++-------
 .../core/Util/TestPriorityQueue.cs              |  2 +-
 .../core/Util/TestRollingBuffer.cs              |  2 +-
 25 files changed, 53 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Core/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/AssemblyInfo.cs b/src/Lucene.Net.Core/AssemblyInfo.cs
index dc4e47d..7eb9f7e 100644
--- a/src/Lucene.Net.Core/AssemblyInfo.cs
+++ b/src/Lucene.Net.Core/AssemblyInfo.cs
@@ -39,11 +39,17 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyInformationalVersionAttribute("4.8.0")]
 
 // for testing
-[assembly: InternalsVisibleTo("Lucene.Net.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010075a07ce602f88e" +
-                                                         "f263c7db8cb342c58ebd49ecdcc210fac874260b0213fb929ac3dcaf4f5b39744b800f99073eca" +
-                                                         "72aebfac5f7284e1d5f2c82012a804a140f06d7d043d83e830cdb606a04da2ad5374cc92c0a495" +
-                                                         "08437802fb4f8fb80a05e59f80afb99f4ccd0dfe44065743543c4b053b669509d29d332cd32a0c" +
-                                                         "b1e97e84")]
+//[assembly: InternalsVisibleTo("Lucene.Net.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010075a07ce602f88e" +
+//                                                         "f263c7db8cb342c58ebd49ecdcc210fac874260b0213fb929ac3dcaf4f5b39744b800f99073eca" +
+//                                                         "72aebfac5f7284e1d5f2c82012a804a140f06d7d043d83e830cdb606a04da2ad5374cc92c0a495" +
+//                                                         "08437802fb4f8fb80a05e59f80afb99f4ccd0dfe44065743543c4b053b669509d29d332cd32a0c" +
+//                                                         "b1e97e84")]
+
+// LUCENENET NOTE: For now it is not possible to use a SNK because we have unmanaged references in Analysis.Common.
+// However, we still need InternalsVisibleTo in order to prevent making everything public just for the sake of testing.
+// This has broad implications, though because many methods are marked "protected internal", which means other assemblies
+// must update overridden methods to match.
+[assembly: InternalsVisibleTo("Lucene.Net.Tests")]
 
 //
 // Version information for an assembly consists of the following four values:
@@ -84,6 +90,6 @@ using System.Runtime.CompilerServices;
 //   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
 //       documentation for more information on this.
 //
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+//[assembly: AssemblyKeyName("")]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
index 14397b9..888a0e4 100644
--- a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
@@ -351,7 +351,7 @@ namespace Lucene.Net.Index
                 this.Failed = failed;
             }
 
-            protected override void DoMerge(MergePolicy.OneMerge merge)
+            protected internal override void DoMerge(MergePolicy.OneMerge merge)
             {
                 try
                 {
@@ -401,7 +401,7 @@ namespace Lucene.Net.Index
                 SetMaxMergesAndThreads(5, 5);
             }
 
-            protected override void DoMerge(MergePolicy.OneMerge merge)
+            protected internal override void DoMerge(MergePolicy.OneMerge merge)
             {
                 TotMergedBytes += merge.TotalBytesSize();
                 base.DoMerge(merge);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs b/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
index 3aa8842..fa54837 100644
--- a/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
@@ -185,7 +185,7 @@ namespace Lucene.Net.Index
                 }
             }
 
-            protected override void ReadInternal(byte[] b, int offset, int length)
+            protected internal override void ReadInternal(byte[] b, int offset, int length)
             {
                 SimOutage();
                 @delegate.Seek(FilePointer);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Index/TestIndexReaderClose.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexReaderClose.cs b/src/Lucene.Net.Tests/core/Index/TestIndexReaderClose.cs
index 1d4b7fc..038dfab 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexReaderClose.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexReaderClose.cs
@@ -113,7 +113,7 @@ namespace Lucene.Net.Index
                 this.ThrowOnClose = throwOnClose;
             }
 
-            protected override void DoClose()
+            protected internal override void DoClose()
             {
                 base.DoClose();
                 if (ThrowOnClose)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
index 3627ed9..64b2348 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
@@ -957,12 +957,12 @@ namespace Lucene.Net.Index
             internal bool AfterWasCalled;
             internal bool BeforeWasCalled;
 
-            protected override void DoAfterFlush()
+            protected internal override void DoAfterFlush()
             {
                 AfterWasCalled = true;
             }
 
-            protected override void DoBeforeFlush()
+            protected internal override void DoBeforeFlush()
             {
                 BeforeWasCalled = true;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
index 4d640f3..272c331 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
@@ -1368,7 +1368,7 @@ namespace Lucene.Net.Index
                 this.SawAfterFlush = sawAfterFlush;
             }
 
-            protected override void DoAfterFlush()
+            protected internal override void DoAfterFlush()
             {
                 Assert.IsTrue(Closing.Get() || DocsInSegment.Get() >= 7, "only " + DocsInSegment.Get() + " in segment");
                 DocsInSegment.Set(0);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index 56371db..fdc5489 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -2440,7 +2440,7 @@ namespace Lucene.Net.Index
                 this.OuterInstance = outerInstance;
             }
 
-            protected override void HandleMergeException(Exception exc)
+            protected internal override void HandleMergeException(Exception exc)
             {
                 // suppress only FakeIOException:
                 if (!(exc is MockDirectoryWrapper.FakeIOException))

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/JustCompileSearch.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/JustCompileSearch.cs b/src/Lucene.Net.Tests/core/Search/JustCompileSearch.cs
index 8859494..91604a4 100644
--- a/src/Lucene.Net.Tests/core/Search/JustCompileSearch.cs
+++ b/src/Lucene.Net.Tests/core/Search/JustCompileSearch.cs
@@ -201,7 +201,7 @@ namespace Lucene.Net.Search
             {
             }
 
-            protected override bool Match(int docid)
+            protected internal override bool Match(int docid)
             {
                 throw new System.NotSupportedException(UNSUPPORTED_MSG);
             }
@@ -214,7 +214,7 @@ namespace Lucene.Net.Search
             {
             }
 
-            protected override bool Match(int doc)
+            protected internal override bool Match(int doc)
             {
                 throw new System.NotSupportedException(UNSUPPORTED_MSG);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/Spans/JustCompileSearchSpans.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/JustCompileSearchSpans.cs b/src/Lucene.Net.Tests/core/Search/Spans/JustCompileSearchSpans.cs
index 9cc35e7..9e28b68 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/JustCompileSearchSpans.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/JustCompileSearchSpans.cs
@@ -162,7 +162,7 @@ namespace Lucene.Net.Search.Spans
             {
             }
 
-            protected override bool SetFreqCurrentDoc()
+            protected internal override bool SetFreqCurrentDoc()
             {
                 throw new System.NotSupportedException(UNSUPPORTED_MSG);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs b/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
index 2e3272f..b7e2582 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
@@ -396,7 +396,7 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
             }
 
-            protected override void Search(IList<AtomicReaderContext> leaves, Weight weight, Collector collector)
+            protected internal override void Search(IList<AtomicReaderContext> leaves, Weight weight, Collector collector)
             {
                 Assert.AreEqual(-1, collector.GetType().Name.IndexOf("OutOfOrder"));
                 base.Search(leaves, weight, collector);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs b/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
index e322c18..3cf73b9 100644
--- a/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
@@ -135,7 +135,7 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool Match(int docid)
+            protected internal override bool Match(int docid)
             {
                 return docid % 2 == 0; //validate only even docids
             }
@@ -244,7 +244,7 @@ namespace Lucene.Net.Search
                     this.OuterInstance = outerInstance;
                 }
 
-                protected override bool Match(int docid)
+                protected internal override bool Match(int docid)
                 {
                     return true;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs b/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
index 29eeac3..adae39e 100644
--- a/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
@@ -462,7 +462,7 @@ namespace Lucene.Net.Search
             {
             }
 
-            protected override bool UseRandomAccess(Bits bits, int firstFilterDoc)
+            protected internal override bool UseRandomAccess(Bits bits, int firstFilterDoc)
             {
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs b/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
index 4857fe1..c19b7ca 100644
--- a/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
@@ -111,7 +111,7 @@ namespace Lucene.Net.Search
             {
             }
 
-            protected override int? LookupFromSearcher(IndexSearcher s, string id)
+            protected internal override int? LookupFromSearcher(IndexSearcher s, string id)
             {
                 TermQuery tq = new TermQuery(new Term("id", id));
                 TopDocs hits = s.Search(tq, 1);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestMultiTermQueryRewrites.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/core/Search/TestMultiTermQueryRewrites.cs
index 2449b89..61ee69b 100644
--- a/src/Lucene.Net.Tests/core/Search/TestMultiTermQueryRewrites.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestMultiTermQueryRewrites.cs
@@ -226,7 +226,7 @@ namespace Lucene.Net.Search
 
                 internal readonly IBoostAttribute boostAtt;
 
-                protected override AcceptStatus Accept(BytesRef term)
+                protected internal override AcceptStatus Accept(BytesRef term)
                 {
                     boostAtt.Boost = Convert.ToSingle(term.Utf8ToString());
                     return base.Accept(term);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestPrefixRandom.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestPrefixRandom.cs b/src/Lucene.Net.Tests/core/Search/TestPrefixRandom.cs
index 06bdf3a..3384aa8 100644
--- a/src/Lucene.Net.Tests/core/Search/TestPrefixRandom.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestPrefixRandom.cs
@@ -117,7 +117,7 @@ namespace Lucene.Net.Search
                     InitialSeekTerm = new BytesRef("");
                 }
 
-                protected override AcceptStatus Accept(BytesRef term)
+                protected internal override AcceptStatus Accept(BytesRef term)
                 {
                     return StringHelper.StartsWith(term, Prefix) ? AcceptStatus.YES : AcceptStatus.NO;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestQueryRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestQueryRescorer.cs b/src/Lucene.Net.Tests/core/Search/TestQueryRescorer.cs
index f7dfd3e..ac811ca 100644
--- a/src/Lucene.Net.Tests/core/Search/TestQueryRescorer.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestQueryRescorer.cs
@@ -174,7 +174,7 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
             }
 
-            protected override float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
+            protected internal override float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
             {
                 float score = firstPassScore;
                 if (secondPassMatches)
@@ -262,7 +262,7 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
             }
 
-            protected override float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
+            protected internal override float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
             {
                 float score = firstPassScore;
                 if (secondPassMatches)
@@ -403,7 +403,7 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
             }
 
-            protected override float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
+            protected internal override float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
             {
                 return secondPassScore;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestRegexpRandom2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestRegexpRandom2.cs b/src/Lucene.Net.Tests/core/Search/TestRegexpRandom2.cs
index 6171c87..e09d787 100644
--- a/src/Lucene.Net.Tests/core/Search/TestRegexpRandom2.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestRegexpRandom2.cs
@@ -150,7 +150,7 @@ namespace Lucene.Net.Search
                     InitialSeekTerm = new BytesRef("");
                 }
 
-                protected override AcceptStatus Accept(BytesRef term)
+                protected internal override AcceptStatus Accept(BytesRef term)
                 {
                     UnicodeUtil.UTF8toUTF16(term.Bytes, term.Offset, term.Length, Utf16);
                     return RunAutomaton.Run(Utf16.Chars, 0, Utf16.Length) ? AcceptStatus.YES : AcceptStatus.NO;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Search/TestTopDocsCollector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestTopDocsCollector.cs b/src/Lucene.Net.Tests/core/Search/TestTopDocsCollector.cs
index 6addfca..555b18a 100644
--- a/src/Lucene.Net.Tests/core/Search/TestTopDocsCollector.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestTopDocsCollector.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Search
             {
             }
 
-            protected override TopDocs NewTopDocs(ScoreDoc[] results, int start)
+            protected internal override TopDocs NewTopDocs(ScoreDoc[] results, int start)
             {
                 if (results == null)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs b/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
index 86335f0..aa0f80a 100644
--- a/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
@@ -242,7 +242,7 @@ namespace Lucene.Net.Store
                 // an infinite file
             }
 
-            protected override void ReadInternal(byte[] b, int offset, int length)
+            protected internal override void ReadInternal(byte[] b, int offset, int length)
             {
                 for (int i = offset; i < offset + length; i++)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs b/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
index 1ee2c48..c3714fc 100644
--- a/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
@@ -40,7 +40,7 @@ namespace Lucene.Net.Store
             private long Capacity = 0;
             private readonly Dictionary<int, byte[]> SingleBuffers = new Dictionary<int, byte[]>();
 
-            protected override byte[] NewBuffer(int size)
+            protected internal override byte[] NewBuffer(int size)
             {
                 Capacity += size;
                 if (Capacity <= MAX_VALUE)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs b/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
index 59a7ffd..7512d5d 100644
--- a/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
+++ b/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
@@ -72,7 +72,7 @@ namespace Lucene.Net.Tests
                 }
             }
 
-            protected override MergeThread GetMergeThread(IndexWriter writer, MergePolicy.OneMerge merge)
+            protected internal override MergeThread GetMergeThread(IndexWriter writer, MergePolicy.OneMerge merge)
             {
                 MergeThread thread = new MyMergeThread(this, writer, merge);
                 thread.ThreadPriority = MergeThreadPriority;
@@ -81,12 +81,12 @@ namespace Lucene.Net.Tests
                 return thread;
             }
 
-            protected override void HandleMergeException(Exception t)
+            protected internal override void HandleMergeException(Exception t)
             {
                 OuterInstance.ExcCalled = true;
             }
 
-            protected override void DoMerge(MergePolicy.OneMerge merge)
+            protected internal override void DoMerge(MergePolicy.OneMerge merge)
             {
                 OuterInstance.MergeCalled = true;
                 base.DoMerge(merge);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Util/TestCloseableThreadLocal.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestCloseableThreadLocal.cs b/src/Lucene.Net.Tests/core/Util/TestCloseableThreadLocal.cs
index f109198..ca202f9 100644
--- a/src/Lucene.Net.Tests/core/Util/TestCloseableThreadLocal.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestCloseableThreadLocal.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override object InitialValue()
+            protected internal override object InitialValue()
             {
                 return TEST_VALUE;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Util/TestFilterIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestFilterIterator.cs b/src/Lucene.Net.Tests/core/Util/TestFilterIterator.cs
index 5d1616c..dbc4f9b 100644
--- a/src/Lucene.Net.Tests/core/Util/TestFilterIterator.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestFilterIterator.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return false;
             }
@@ -75,7 +75,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return "a".Equals(s);
             }
@@ -101,7 +101,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return "a".Equals(s);
             }
@@ -126,7 +126,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return "b".Equals(s);
             }
@@ -152,7 +152,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return "b".Equals(s);
             }
@@ -181,7 +181,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return true;
             }
@@ -210,7 +210,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return true;
             }
@@ -243,7 +243,7 @@ namespace Lucene.Net.Util
                 this.OuterInstance = outerInstance;
             }
 
-            protected override bool PredicateFunction(string s)
+            protected internal override bool PredicateFunction(string s)
             {
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Util/TestPriorityQueue.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestPriorityQueue.cs b/src/Lucene.Net.Tests/core/Util/TestPriorityQueue.cs
index 3868ee3..59bc78d 100644
--- a/src/Lucene.Net.Tests/core/Util/TestPriorityQueue.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestPriorityQueue.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Util
             {
             }
 
-            protected override int? SentinelObject
+            protected internal override int? SentinelObject
             {
                 get
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c67366fd/src/Lucene.Net.Tests/core/Util/TestRollingBuffer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestRollingBuffer.cs b/src/Lucene.Net.Tests/core/Util/TestRollingBuffer.cs
index 336b1ed..e0fac3e 100644
--- a/src/Lucene.Net.Tests/core/Util/TestRollingBuffer.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestRollingBuffer.cs
@@ -103,7 +103,7 @@ namespace Lucene.Net.Util
                 return pos;
             }
 
-            protected override Position NewInstance()
+            protected internal override Position NewInstance()
             {
                 Position pos = new Position();
                 pos.Pos = -1;


[14/49] lucenenet git commit: Normalized FST license headers

Posted by sy...@apache.org.
Normalized FST license headers


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

Branch: refs/heads/master
Commit: 0ccb5b65809ad6b341b3b04fcdfb43c58e53aff5
Parents: 3994051
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 18:17:58 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:56 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/FST.cs      | 38 +++++++++++++--------------
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs | 30 ++++++++++-----------
 src/Lucene.Net.Core/Util/Fst/Util.cs     |  4 ---
 3 files changed, 33 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0ccb5b65/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 3350068..6b4a3e2 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -1,32 +1,30 @@
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Text;
 
 namespace Lucene.Net.Util.Fst
 {
-    using Lucene.Net.Util;
-    using System.Collections;
-    using System.IO;
-    using ByteArrayDataOutput = Lucene.Net.Store.ByteArrayDataOutput;
-
     /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
 
+    using ByteArrayDataOutput = Lucene.Net.Store.ByteArrayDataOutput;
     using CodecUtil = Lucene.Net.Codecs.CodecUtil;
     using DataInput = Lucene.Net.Store.DataInput;
     using DataOutput = Lucene.Net.Store.DataOutput;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0ccb5b65/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 fcc9429..a0fb659 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -4,21 +4,21 @@ namespace Lucene.Net.Util.Fst
 {
     using System.Collections;
     /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
 
     using PackedInts = Lucene.Net.Util.Packed.PackedInts;
     using PagedGrowableWriter = Lucene.Net.Util.Packed.PagedGrowableWriter;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0ccb5b65/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 451ee51..baf648f 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -24,10 +24,6 @@ namespace Lucene.Net.Util.Fst
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
-    /*
-	using Lucene.Net.Util.Fst.FST;
-	using BytesReader = Lucene.Net.Util.Fst.FST.BytesReader;
-    */
 
     /// <summary>
     /// Static helper methods.


[11/49] lucenenet git commit: .NETify FST: Private/protected fields should be camelCase.

Posted by sy...@apache.org.
.NETify FST: Private/protected fields should be camelCase.


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

Branch: refs/heads/master
Commit: b8db797ba917041dabe034e3ddf5960dd14fc04a
Parents: dfa2310
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 17:28:33 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:52 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/Builder.cs         | 164 +++++++--------
 .../Util/Fst/ByteSequenceOutputs.cs             |   4 +-
 src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs |  44 ++--
 src/Lucene.Net.Core/Util/Fst/BytesStore.cs      | 180 ++++++++--------
 .../Util/Fst/CharSequenceOutputs.cs             |   4 +-
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 206 ++++++++++---------
 src/Lucene.Net.Core/Util/Fst/FSTEnum.cs         | 190 ++++++++---------
 .../Util/Fst/ForwardBytesReader.cs              |  18 +-
 .../Util/Fst/IntSequenceOutputs.cs              |   4 +-
 src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs  |  44 ++--
 src/Lucene.Net.Core/Util/Fst/NoOutputs.cs       |   4 +-
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        |  84 ++++----
 src/Lucene.Net.Core/Util/Fst/PairOutputs.cs     |  44 ++--
 .../Util/Fst/ReverseBytesReader.cs              |  16 +-
 src/Lucene.Net.Core/Util/Fst/Util.cs            |  54 ++---
 15 files changed, 531 insertions(+), 529 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/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 a566625..540b913 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -49,36 +49,36 @@ namespace Lucene.Net.Util.Fst
 
     public class Builder<T>
     {
-        private readonly NodeHash<T> DedupHash;
-        private readonly FST<T> Fst;
+        private readonly NodeHash<T> dedupHash;
+        private readonly FST<T> fst;
         private readonly T NO_OUTPUT;
 
         // private static final boolean DEBUG = true;
 
         // simplistic pruning: we prune node (and all following
         // nodes) if less than this number of terms go through it:
-        private readonly int MinSuffixCount1;
+        private readonly int minSuffixCount1;
 
         // better pruning: we prune node (and all following
         // nodes) if the prior node has less than this number of
         // terms go through it:
-        private readonly int MinSuffixCount2;
+        private readonly int minSuffixCount2;
 
-        private readonly bool DoShareNonSingletonNodes;
-        private readonly int ShareMaxTailLength;
+        private readonly bool doShareNonSingletonNodes;
+        private readonly int shareMaxTailLength;
 
-        private readonly IntsRef LastInput = new IntsRef();
+        private readonly IntsRef lastInput = new IntsRef();
 
         // for packing
-        private readonly bool DoPackFST;
+        private readonly bool doPackFST;
 
-        private readonly float AcceptableOverheadRatio;
+        private readonly float acceptableOverheadRatio;
 
         // NOTE: cutting this over to ArrayList instead loses ~6%
         // in build performance on 9.8M Wikipedia terms; so we
         // left this as an array:
         // current "frontier"
-        private UnCompiledNode<T>[] Frontier;
+        private UnCompiledNode<T>[] frontier;
 
         /// <summary>
         /// Expert: this is invoked by Builder whenever a suffix
@@ -89,7 +89,7 @@ namespace Lucene.Net.Util.Fst
             public abstract void Freeze(UnCompiledNode<S>[] frontier, int prefixLenPlus1, IntsRef prevInput);
         }
 
-        private readonly FreezeTail<T> FreezeTail_Renamed;
+        private readonly FreezeTail<T> freezeTail;
 
         /// <summary>
         /// Instantiates an FST/FSA builder without any pruning. A shortcut
@@ -154,29 +154,29 @@ namespace Lucene.Net.Util.Fst
         ///    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)
         {
-            this.MinSuffixCount1 = minSuffixCount1;
-            this.MinSuffixCount2 = minSuffixCount2;
-            this.FreezeTail_Renamed = freezeTail;
-            this.DoShareNonSingletonNodes = doShareNonSingletonNodes;
-            this.ShareMaxTailLength = shareMaxTailLength;
-            this.DoPackFST = doPackFST;
-            this.AcceptableOverheadRatio = acceptableOverheadRatio;
-            Fst = new FST<T>(inputType, outputs, doPackFST, acceptableOverheadRatio, allowArrayArcs, bytesPageBits);
+            this.minSuffixCount1 = minSuffixCount1;
+            this.minSuffixCount2 = minSuffixCount2;
+            this.freezeTail = freezeTail;
+            this.doShareNonSingletonNodes = doShareNonSingletonNodes;
+            this.shareMaxTailLength = shareMaxTailLength;
+            this.doPackFST = doPackFST;
+            this.acceptableOverheadRatio = acceptableOverheadRatio;
+            fst = new FST<T>(inputType, outputs, doPackFST, acceptableOverheadRatio, allowArrayArcs, bytesPageBits);
             if (doShareSuffix)
             {
-                DedupHash = new NodeHash<T>(Fst, Fst.Bytes.GetReverseReader(false));
+                dedupHash = new NodeHash<T>(fst, fst.Bytes.GetReverseReader(false));
             }
             else
             {
-                DedupHash = null;
+                dedupHash = null;
             }
             NO_OUTPUT = outputs.NoOutput;
 
             UnCompiledNode<T>[] f = (UnCompiledNode<T>[])new UnCompiledNode<T>[10];
-            Frontier = f;
-            for (int idx = 0; idx < Frontier.Length; idx++)
+            frontier = f;
+            for (int idx = 0; idx < frontier.Length; idx++)
             {
-                Frontier[idx] = new UnCompiledNode<T>(this, idx);
+                frontier[idx] = new UnCompiledNode<T>(this, idx);
             }
         }
 
@@ -184,7 +184,7 @@ namespace Lucene.Net.Util.Fst
         {
             get
             {
-                return Fst.nodeCount;
+                return fst.nodeCount;
             }
         }
 
@@ -192,7 +192,7 @@ namespace Lucene.Net.Util.Fst
         {
             get
             {
-                return Frontier[0].InputCount;
+                return frontier[0].InputCount;
             }
         }
 
@@ -200,27 +200,27 @@ namespace Lucene.Net.Util.Fst
         {
             get
             {
-                return DedupHash == null ? 0 : Fst.nodeCount;
+                return dedupHash == null ? 0 : fst.nodeCount;
             }
         }
 
         private CompiledNode CompileNode(UnCompiledNode<T> nodeIn, int tailLength)
         {
             long node;
-            if (DedupHash != null && (DoShareNonSingletonNodes || nodeIn.NumArcs <= 1) && tailLength <= ShareMaxTailLength)
+            if (dedupHash != null && (doShareNonSingletonNodes || nodeIn.NumArcs <= 1) && tailLength <= shareMaxTailLength)
             {
                 if (nodeIn.NumArcs == 0)
                 {
-                    node = Fst.AddNode(nodeIn);
+                    node = fst.AddNode(nodeIn);
                 }
                 else
                 {
-                    node = DedupHash.Add(nodeIn);
+                    node = dedupHash.Add(nodeIn);
                 }
             }
             else
             {
-                node = Fst.AddNode(nodeIn);
+                node = fst.AddNode(nodeIn);
             }
             Debug.Assert(node != -2);
 
@@ -233,24 +233,24 @@ namespace Lucene.Net.Util.Fst
 
         private void DoFreezeTail(int prefixLenPlus1)
         {
-            if (FreezeTail_Renamed != null)
+            if (freezeTail != null)
             {
                 // Custom plugin:
-                FreezeTail_Renamed.Freeze(Frontier, prefixLenPlus1, LastInput);
+                freezeTail.Freeze(frontier, prefixLenPlus1, lastInput);
             }
             else
             {
                 //System.out.println("  compileTail " + prefixLenPlus1);
                 int downTo = Math.Max(1, prefixLenPlus1);
-                for (int idx = LastInput.Length; idx >= downTo; idx--)
+                for (int idx = lastInput.Length; idx >= downTo; idx--)
                 {
                     bool doPrune = false;
                     bool doCompile = false;
 
-                    UnCompiledNode<T> node = Frontier[idx];
-                    UnCompiledNode<T> parent = Frontier[idx - 1];
+                    UnCompiledNode<T> node = frontier[idx];
+                    UnCompiledNode<T> parent = frontier[idx - 1];
 
-                    if (node.InputCount < MinSuffixCount1)
+                    if (node.InputCount < minSuffixCount1)
                     {
                         doPrune = true;
                         doCompile = true;
@@ -258,7 +258,7 @@ namespace Lucene.Net.Util.Fst
                     else if (idx > prefixLenPlus1)
                     {
                         // prune if parent's inputCount is less than suffixMinCount2
-                        if (parent.InputCount < MinSuffixCount2 || (MinSuffixCount2 == 1 && parent.InputCount == 1 && idx > 1))
+                        if (parent.InputCount < minSuffixCount2 || (minSuffixCount2 == 1 && parent.InputCount == 1 && idx > 1))
                         {
                             // my parent, about to be compiled, doesn't make the cut, so
                             // I'm definitely pruned
@@ -284,12 +284,12 @@ namespace Lucene.Net.Util.Fst
                     {
                         // if pruning is disabled (count is 0) we can always
                         // compile current node
-                        doCompile = MinSuffixCount2 == 0;
+                        doCompile = minSuffixCount2 == 0;
                     }
 
                     //System.out.println("    label=" + ((char) lastInput.ints[lastInput.offset+idx-1]) + " idx=" + idx + " inputCount=" + frontier[idx].inputCount + " doCompile=" + doCompile + " doPrune=" + doPrune);
 
-                    if (node.InputCount < MinSuffixCount2 || (MinSuffixCount2 == 1 && node.InputCount == 1 && idx > 1))
+                    if (node.InputCount < minSuffixCount2 || (minSuffixCount2 == 1 && node.InputCount == 1 && idx > 1))
                     {
                         // drop all arcs
                         for (int arcIdx = 0; arcIdx < node.NumArcs; arcIdx++)
@@ -304,13 +304,13 @@ namespace Lucene.Net.Util.Fst
                     {
                         // this node doesn't make it -- deref it
                         node.Clear();
-                        parent.DeleteLast(LastInput.Ints[LastInput.Offset + idx - 1], node);
+                        parent.DeleteLast(lastInput.Ints[lastInput.Offset + idx - 1], node);
                     }
                     else
                     {
-                        if (MinSuffixCount2 != 0)
+                        if (minSuffixCount2 != 0)
                         {
-                            CompileAllTargets(node, LastInput.Length - idx);
+                            CompileAllTargets(node, lastInput.Length - idx);
                         }
                         T nextFinalOutput = node.Output;
 
@@ -326,18 +326,18 @@ namespace Lucene.Net.Util.Fst
                             // this node makes it and we now compile it.  first,
                             // compile any targets that were previously
                             // undecided:
-                            parent.ReplaceLast(LastInput.Ints[LastInput.Offset + idx - 1], CompileNode(node, 1 + LastInput.Length - idx), nextFinalOutput, isFinal);
+                            parent.ReplaceLast(lastInput.Ints[lastInput.Offset + idx - 1], CompileNode(node, 1 + lastInput.Length - idx), nextFinalOutput, isFinal);
                         }
                         else
                         {
                             // replaceLast just to install
                             // nextFinalOutput/isFinal onto the arc
-                            parent.ReplaceLast(LastInput.Ints[LastInput.Offset + idx - 1], node, nextFinalOutput, isFinal);
+                            parent.ReplaceLast(lastInput.Ints[lastInput.Offset + idx - 1], node, nextFinalOutput, isFinal);
                             // this node will stay in play for now, since we are
                             // undecided on whether to prune it.  later, it
                             // will be either compiled or pruned, so we must
                             // allocate a new node:
-                            Frontier[idx] = new UnCompiledNode<T>(this, idx);
+                            frontier[idx] = new UnCompiledNode<T>(this, idx);
                         }
                     }
                 }
@@ -400,21 +400,21 @@ namespace Lucene.Net.Util.Fst
                 // format cannot represent the empty input since
                 // 'finalness' is stored on the incoming arc, not on
                 // the node
-                Frontier[0].InputCount++;
-                Frontier[0].IsFinal = true;
-                Fst.EmptyOutput = output;
+                frontier[0].InputCount++;
+                frontier[0].IsFinal = true;
+                fst.EmptyOutput = output;
                 return;
             }
 
             // compare shared prefix length
             int pos1 = 0;
             int pos2 = input.Offset;
-            int pos1Stop = Math.Min(LastInput.Length, input.Length);
+            int pos1Stop = Math.Min(lastInput.Length, input.Length);
             while (true)
             {
-                Frontier[pos1].InputCount++;
+                frontier[pos1].InputCount++;
                 //System.out.println("  incr " + pos1 + " ct=" + frontier[pos1].inputCount + " n=" + frontier[pos1]);
-                if (pos1 >= pos1Stop || LastInput.Ints[pos1] != input.Ints[pos2])
+                if (pos1 >= pos1Stop || lastInput.Ints[pos1] != input.Ints[pos2])
                 {
                     break;
                 }
@@ -423,15 +423,15 @@ namespace Lucene.Net.Util.Fst
             }
             int prefixLenPlus1 = pos1 + 1;
 
-            if (Frontier.Length < input.Length + 1)
+            if (frontier.Length < input.Length + 1)
             {
                 UnCompiledNode<T>[] next = new UnCompiledNode<T>[ArrayUtil.Oversize(input.Length + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
-                Array.Copy(Frontier, 0, next, 0, Frontier.Length);
-                for (int idx = Frontier.Length; idx < next.Length; idx++)
+                Array.Copy(frontier, 0, next, 0, frontier.Length);
+                for (int idx = frontier.Length; idx < next.Length; idx++)
                 {
                     next[idx] = new UnCompiledNode<T>(this, idx);
                 }
-                Frontier = next;
+                frontier = next;
             }
 
             // minimize/compile states from previous input's
@@ -441,12 +441,12 @@ namespace Lucene.Net.Util.Fst
             // init tail states for current input
             for (int idx = prefixLenPlus1; idx <= input.Length; idx++)
             {
-                Frontier[idx - 1].AddArc(input.Ints[input.Offset + idx - 1], Frontier[idx]);
-                Frontier[idx].InputCount++;
+                frontier[idx - 1].AddArc(input.Ints[input.Offset + idx - 1], frontier[idx]);
+                frontier[idx].InputCount++;
             }
 
-            UnCompiledNode<T> lastNode = Frontier[input.Length];
-            if (LastInput.Length != input.Length || prefixLenPlus1 != input.Length + 1)
+            UnCompiledNode<T> lastNode = frontier[input.Length];
+            if (lastInput.Length != input.Length || prefixLenPlus1 != input.Length + 1)
             {
                 lastNode.IsFinal = true;
                 lastNode.Output = NO_OUTPUT;
@@ -456,8 +456,8 @@ namespace Lucene.Net.Util.Fst
             // needed
             for (int idx = 1; idx < prefixLenPlus1; idx++)
             {
-                UnCompiledNode<T> node = Frontier[idx];
-                UnCompiledNode<T> parentNode = Frontier[idx - 1];
+                UnCompiledNode<T> node = frontier[idx];
+                UnCompiledNode<T> parentNode = frontier[idx - 1];
 
                 T lastOutput = parentNode.GetLastOutput(input.Ints[input.Offset + idx - 1]);
                 Debug.Assert(ValidOutput(lastOutput));
@@ -467,9 +467,9 @@ namespace Lucene.Net.Util.Fst
 
                 if (!lastOutput.Equals(NO_OUTPUT))
                 {
-                    commonOutputPrefix = Fst.Outputs.Common(output, lastOutput);
+                    commonOutputPrefix = fst.Outputs.Common(output, lastOutput);
                     Debug.Assert(ValidOutput(commonOutputPrefix));
-                    wordSuffix = Fst.Outputs.Subtract(lastOutput, commonOutputPrefix);
+                    wordSuffix = fst.Outputs.Subtract(lastOutput, commonOutputPrefix);
                     Debug.Assert(ValidOutput(wordSuffix));
                     parentNode.SetLastOutput(input.Ints[input.Offset + idx - 1], commonOutputPrefix);
                     node.PrependOutput(wordSuffix);
@@ -479,25 +479,25 @@ namespace Lucene.Net.Util.Fst
                     commonOutputPrefix = wordSuffix = NO_OUTPUT;
                 }
 
-                output = Fst.Outputs.Subtract(output, commonOutputPrefix);
+                output = fst.Outputs.Subtract(output, commonOutputPrefix);
                 Debug.Assert(ValidOutput(output));
             }
 
-            if (LastInput.Length == input.Length && prefixLenPlus1 == 1 + input.Length)
+            if (lastInput.Length == input.Length && prefixLenPlus1 == 1 + input.Length)
             {
                 // same input more than 1 time in a row, mapping to
                 // multiple outputs
-                lastNode.Output = Fst.Outputs.Merge(lastNode.Output, output);
+                lastNode.Output = fst.Outputs.Merge(lastNode.Output, output);
             }
             else
             {
                 // this new arc is private to this new input; set its
                 // arc output to the leftover output:
-                Frontier[prefixLenPlus1 - 1].SetLastOutput(input.Ints[input.Offset + prefixLenPlus1 - 1], output);
+                frontier[prefixLenPlus1 - 1].SetLastOutput(input.Ints[input.Offset + prefixLenPlus1 - 1], output);
             }
 
             // save last input
-            LastInput.CopyInts(input);
+            lastInput.CopyInts(input);
 
             //System.out.println("  count[0]=" + frontier[0].inputCount);
         }
@@ -513,17 +513,17 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         public virtual FST<T> Finish()
         {
-            UnCompiledNode<T> root = Frontier[0];
+            UnCompiledNode<T> root = frontier[0];
 
             // minimize nodes in the last word's suffix
             DoFreezeTail(0);
-            if (root.InputCount < MinSuffixCount1 || root.InputCount < MinSuffixCount2 || root.NumArcs == 0)
+            if (root.InputCount < minSuffixCount1 || root.InputCount < minSuffixCount2 || root.NumArcs == 0)
             {
-                if (Fst.emptyOutput == null)
+                if (fst.emptyOutput == null)
                 {
                     return null;
                 }
-                else if (MinSuffixCount1 > 0 || MinSuffixCount2 > 0)
+                else if (minSuffixCount1 > 0 || minSuffixCount2 > 0)
                 {
                     // empty string got pruned
                     return null;
@@ -531,21 +531,21 @@ namespace Lucene.Net.Util.Fst
             }
             else
             {
-                if (MinSuffixCount2 != 0)
+                if (minSuffixCount2 != 0)
                 {
-                    CompileAllTargets(root, LastInput.Length);
+                    CompileAllTargets(root, lastInput.Length);
                 }
             }
             //if (DEBUG) System.out.println("  builder.finish root.isFinal=" + root.isFinal + " root.Output=" + root.Output);
-            Fst.Finish(CompileNode(root, LastInput.Length).Node);
+            fst.Finish(CompileNode(root, lastInput.Length).Node);
 
-            if (DoPackFST)
+            if (doPackFST)
             {
-                return Fst.Pack(3, Math.Max(10, (int)(Fst.NodeCount / 4)), AcceptableOverheadRatio);
+                return fst.Pack(3, Math.Max(10, (int)(fst.NodeCount / 4)), acceptableOverheadRatio);
             }
             else
             {
-                return Fst;
+                return fst;
             }
         }
 
@@ -590,7 +590,7 @@ namespace Lucene.Net.Util.Fst
 
         public virtual long FstSizeInBytes()
         {
-            return Fst.SizeInBytes();
+            return fst.SizeInBytes();
         }
 
         public sealed class CompiledNode : Node
@@ -726,13 +726,13 @@ namespace Lucene.Net.Util.Fst
 
                 for (int arcIdx = 0; arcIdx < NumArcs; arcIdx++)
                 {
-                    Arcs[arcIdx].Output = Owner.Fst.Outputs.Add(outputPrefix, Arcs[arcIdx].Output);
+                    Arcs[arcIdx].Output = Owner.fst.Outputs.Add(outputPrefix, Arcs[arcIdx].Output);
                     Debug.Assert(Owner.ValidOutput(Arcs[arcIdx].Output));
                 }
 
                 if (IsFinal)
                 {
-                    Output = Owner.Fst.Outputs.Add(outputPrefix, Output);
+                    Output = Owner.fst.Outputs.Add(outputPrefix, Output);
                     Debug.Assert(Owner.ValidOutput(Output));
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
index 08ca319..1d09ce2 100644
--- a/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Util.Fst
     public sealed class ByteSequenceOutputs : Outputs<BytesRef>
     {
         private static readonly BytesRef NO_OUTPUT = new BytesRef();
-        private static readonly ByteSequenceOutputs Singleton_Renamed = new ByteSequenceOutputs();
+        private static readonly ByteSequenceOutputs singleton = new ByteSequenceOutputs();
 
         private ByteSequenceOutputs()
         {
@@ -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/BytesRefFSTEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
index 9be4680..6774b21 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
@@ -28,9 +28,9 @@ namespace Lucene.Net.Util.Fst
 
     public sealed class BytesRefFSTEnum<T> : FSTEnum<T>
     {
-        private readonly BytesRef Current_Renamed = new BytesRef(10);
-        private readonly InputOutput<T> Result = new InputOutput<T>();
-        private BytesRef Target;
+        private readonly BytesRef current = new BytesRef(10);
+        private readonly InputOutput<T> result = new InputOutput<T>();
+        private BytesRef target;
 
         /// <summary>
         /// Holds a single input (BytesRef) + output pair. </summary>
@@ -48,13 +48,13 @@ namespace Lucene.Net.Util.Fst
         public BytesRefFSTEnum(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(BytesRef 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(BytesRef 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(BytesRef 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.Bytes[Target.Offset + Upto - 1] & 0xFF;
+                    return target.Bytes[target.Offset + upto - 1] & 0xFF;
                 }
             }
         }
@@ -125,30 +125,30 @@ namespace Lucene.Net.Util.Fst
             get
             {
                 // current.offset fixed at 1
-                return Current_Renamed.Bytes[Upto] & 0xFF;
+                return current.Bytes[upto] & 0xFF;
             }
             set
             {
-                Current_Renamed.Bytes[Upto] = (byte)value;
+                current.Bytes[upto] = (byte)value;
             }
         }
 
         protected internal override void Grow()
         {
-            Current_Renamed.Bytes = ArrayUtil.Grow(Current_Renamed.Bytes, Upto + 1);
+            current.Bytes = ArrayUtil.Grow(current.Bytes, 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/BytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
index b23da69..26bc85a 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
@@ -29,21 +29,21 @@ namespace Lucene.Net.Util.Fst
 
     internal class BytesStore : DataOutput
     {
-        private readonly List<byte[]> Blocks = new List<byte[]>();
+        private readonly List<byte[]> blocks = new List<byte[]>();
 
-        private readonly int BlockSize;
+        private readonly int blockSize;
         private readonly int blockBits;
-        private readonly int BlockMask;
+        private readonly int blockMask;
 
-        private byte[] Current;
-        private int NextWrite;
+        private byte[] current;
+        private int nextWrite;
 
         public BytesStore(int blockBits)
         {
             this.blockBits = blockBits;
-            BlockSize = 1 << blockBits;
-            BlockMask = BlockSize - 1;
-            NextWrite = BlockSize;
+            blockSize = 1 << blockBits;
+            blockMask = blockSize - 1;
+            nextWrite = blockSize;
         }
 
         /// <summary>
@@ -58,20 +58,20 @@ namespace Lucene.Net.Util.Fst
                 blockBits++;
             }
             this.blockBits = blockBits;
-            this.BlockSize = blockSize;
-            this.BlockMask = blockSize - 1;
+            this.blockSize = blockSize;
+            this.blockMask = blockSize - 1;
             long left = numBytes;
             while (left > 0)
             {
                 int chunk = (int)Math.Min(blockSize, left);
                 byte[] block = new byte[chunk];
                 @in.ReadBytes(block, 0, block.Length);
-                Blocks.Add(block);
+                blocks.Add(block);
                 left -= chunk;
             }
 
             // So .getPosition still works
-            NextWrite = Blocks[Blocks.Count - 1].Length;
+            nextWrite = blocks[blocks.Count - 1].Length;
         }
 
         /// <summary>
@@ -81,43 +81,43 @@ namespace Lucene.Net.Util.Fst
         public virtual void WriteByte(int dest, byte b)
         {
             int blockIndex = dest >> blockBits;
-            byte[] block = Blocks[blockIndex];
-            block[dest & BlockMask] = b;
+            byte[] block = blocks[blockIndex];
+            block[dest & blockMask] = b;
         }
 
         public override void WriteByte(byte b)
         {
-            if (NextWrite == BlockSize)
+            if (nextWrite == blockSize)
             {
-                Current = new byte[BlockSize];
-                Blocks.Add(Current);
-                NextWrite = 0;
+                current = new byte[blockSize];
+                blocks.Add(current);
+                nextWrite = 0;
             }
-            Current[NextWrite++] = b;
+            current[nextWrite++] = b;
         }
 
         public override void WriteBytes(byte[] b, int offset, int len)
         {
             while (len > 0)
             {
-                int chunk = BlockSize - NextWrite;
+                int chunk = blockSize - nextWrite;
                 if (len <= chunk)
                 {
-                    System.Buffer.BlockCopy(b, offset, Current, NextWrite, len);
-                    NextWrite += len;
+                    System.Buffer.BlockCopy(b, offset, current, nextWrite, len);
+                    nextWrite += len;
                     break;
                 }
                 else
                 {
                     if (chunk > 0)
                     {
-                        Array.Copy(b, offset, Current, NextWrite, chunk);
+                        Array.Copy(b, offset, current, nextWrite, chunk);
                         offset += chunk;
                         len -= chunk;
                     }
-                    Current = new byte[BlockSize];
-                    Blocks.Add(Current);
-                    NextWrite = 0;
+                    current = new byte[blockSize];
+                    blocks.Add(current);
+                    nextWrite = 0;
                 }
             }
         }
@@ -168,13 +168,13 @@ namespace Lucene.Net.Util.Fst
 
             long end = dest + len;
             int blockIndex = (int)(end >> blockBits);
-            int downTo = (int)(end & BlockMask);
+            int downTo = (int)(end & blockMask);
             if (downTo == 0)
             {
                 blockIndex--;
-                downTo = BlockSize;
+                downTo = blockSize;
             }
-            byte[] block = Blocks[blockIndex];
+            byte[] block = blocks[blockIndex];
 
             while (len > 0)
             {
@@ -191,8 +191,8 @@ namespace Lucene.Net.Util.Fst
                     //System.out.println("      partial: offset=" + (offset + len) + " len=" + downTo + " dest=0");
                     Array.Copy(b, offset + len, block, 0, downTo);
                     blockIndex--;
-                    block = Blocks[blockIndex];
-                    downTo = BlockSize;
+                    block = blocks[blockIndex];
+                    downTo = blockSize;
                 }
             }
         }
@@ -236,13 +236,13 @@ namespace Lucene.Net.Util.Fst
             long end = src + len;
 
             int blockIndex = (int)(end >> blockBits);
-            int downTo = (int)(end & BlockMask);
+            int downTo = (int)(end & blockMask);
             if (downTo == 0)
             {
                 blockIndex--;
-                downTo = BlockSize;
+                downTo = blockSize;
             }
-            byte[] block = Blocks[blockIndex];
+            byte[] block = blocks[blockIndex];
 
             while (len > 0)
             {
@@ -259,8 +259,8 @@ namespace Lucene.Net.Util.Fst
                     len -= downTo;
                     WriteBytes(dest + len, block, 0, downTo);
                     blockIndex--;
-                    block = Blocks[blockIndex];
-                    downTo = BlockSize;
+                    block = blocks[blockIndex];
+                    downTo = blockSize;
                 }
             }
         }
@@ -272,18 +272,18 @@ namespace Lucene.Net.Util.Fst
         public virtual void WriteInt(long pos, int value)
         {
             int blockIndex = (int)(pos >> blockBits);
-            int upto = (int)(pos & BlockMask);
-            byte[] block = Blocks[blockIndex];
+            int upto = (int)(pos & blockMask);
+            byte[] block = blocks[blockIndex];
             int shift = 24;
             for (int i = 0; i < 4; i++)
             {
                 block[upto++] = (byte)(value >> shift);
                 shift -= 8;
-                if (upto == BlockSize)
+                if (upto == blockSize)
                 {
                     upto = 0;
                     blockIndex++;
-                    block = Blocks[blockIndex];
+                    block = blocks[blockIndex];
                 }
             }
         }
@@ -297,12 +297,12 @@ namespace Lucene.Net.Util.Fst
             //System.out.println("reverse src=" + srcPos + " dest=" + destPos);
 
             int srcBlockIndex = (int)(srcPos >> blockBits);
-            int src = (int)(srcPos & BlockMask);
-            byte[] srcBlock = Blocks[srcBlockIndex];
+            int src = (int)(srcPos & blockMask);
+            byte[] srcBlock = blocks[srcBlockIndex];
 
             int destBlockIndex = (int)(destPos >> blockBits);
-            int dest = (int)(destPos & BlockMask);
-            byte[] destBlock = Blocks[destBlockIndex];
+            int dest = (int)(destPos & blockMask);
+            byte[] destBlock = blocks[destBlockIndex];
             //System.out.println("  srcBlock=" + srcBlockIndex + " destBlock=" + destBlockIndex);
 
             int limit = (int)(destPos - srcPos + 1) / 2;
@@ -313,10 +313,10 @@ namespace Lucene.Net.Util.Fst
                 srcBlock[src] = destBlock[dest];
                 destBlock[dest] = b;
                 src++;
-                if (src == BlockSize)
+                if (src == blockSize)
                 {
                     srcBlockIndex++;
-                    srcBlock = Blocks[srcBlockIndex];
+                    srcBlock = blocks[srcBlockIndex];
                     //System.out.println("  set destBlock=" + destBlock + " srcBlock=" + srcBlock);
                     src = 0;
                 }
@@ -325,9 +325,9 @@ namespace Lucene.Net.Util.Fst
                 if (dest == -1)
                 {
                     destBlockIndex--;
-                    destBlock = Blocks[destBlockIndex];
+                    destBlock = blocks[destBlockIndex];
                     //System.out.println("  set destBlock=" + destBlock + " srcBlock=" + srcBlock);
-                    dest = BlockSize - 1;
+                    dest = blockSize - 1;
                 }
             }
         }
@@ -336,18 +336,18 @@ namespace Lucene.Net.Util.Fst
         {
             while (len > 0)
             {
-                int chunk = BlockSize - NextWrite;
+                int chunk = blockSize - nextWrite;
                 if (len <= chunk)
                 {
-                    NextWrite += len;
+                    nextWrite += len;
                     break;
                 }
                 else
                 {
                     len -= chunk;
-                    Current = new byte[BlockSize];
-                    Blocks.Add(Current);
-                    NextWrite = 0;
+                    current = new byte[blockSize];
+                    blocks.Add(current);
+                    nextWrite = 0;
                 }
             }
         }
@@ -356,7 +356,7 @@ namespace Lucene.Net.Util.Fst
         {
             get
             {
-                return ((long)Blocks.Count - 1) * BlockSize + NextWrite;
+                return ((long)blocks.Count - 1) * blockSize + nextWrite;
             }
         }
 
@@ -369,32 +369,32 @@ namespace Lucene.Net.Util.Fst
             Debug.Assert(newLen <= Position);
             Debug.Assert(newLen >= 0);
             int blockIndex = (int)(newLen >> blockBits);
-            NextWrite = (int)(newLen & BlockMask);
-            if (NextWrite == 0)
+            nextWrite = (int)(newLen & blockMask);
+            if (nextWrite == 0)
             {
                 blockIndex--;
-                NextWrite = BlockSize;
+                nextWrite = blockSize;
             }
-            Blocks.RemoveRange(blockIndex + 1, Blocks.Count - (blockIndex + 1));
+            blocks.RemoveRange(blockIndex + 1, blocks.Count - (blockIndex + 1));
             if (newLen == 0)
             {
-                Current = null;
+                current = null;
             }
             else
             {
-                Current = Blocks[blockIndex];
+                current = blocks[blockIndex];
             }
             Debug.Assert(newLen == Position);
         }
 
         public virtual void Finish()
         {
-            if (Current != null)
+            if (current != null)
             {
-                byte[] lastBuffer = new byte[NextWrite];
-                Array.Copy(Current, 0, lastBuffer, 0, NextWrite);
-                Blocks[Blocks.Count - 1] = lastBuffer;
-                Current = null;
+                byte[] lastBuffer = new byte[nextWrite];
+                Array.Copy(current, 0, lastBuffer, 0, nextWrite);
+                blocks[blocks.Count - 1] = lastBuffer;
+                current = null;
             }
         }
 
@@ -402,7 +402,7 @@ namespace Lucene.Net.Util.Fst
         /// Writes all of our bytes to the target <seealso cref="DataOutput"/>. </summary>
         public virtual void WriteTo(DataOutput @out)
         {
-            foreach (byte[] block in Blocks)
+            foreach (byte[] block in blocks)
             {
                 @out.WriteBytes(block, 0, block.Length);
             }
@@ -412,9 +412,9 @@ namespace Lucene.Net.Util.Fst
         {
             get
             {
-                if (Blocks.Count == 1)
+                if (blocks.Count == 1)
                 {
-                    return new ForwardBytesReader(Blocks[0]);
+                    return new ForwardBytesReader(blocks[0]);
                 }
                 return new ForwardBytesReaderAnonymousInner(this);
             }
@@ -422,12 +422,12 @@ namespace Lucene.Net.Util.Fst
 
         private class ForwardBytesReaderAnonymousInner : FST.BytesReader
         {
-            private readonly BytesStore OuterInstance;
+            private readonly BytesStore outerInstance;
 
             public ForwardBytesReaderAnonymousInner(BytesStore outerInstance)
             {
-                this.OuterInstance = outerInstance;
-                nextRead = outerInstance.BlockSize;
+                this.outerInstance = outerInstance;
+                nextRead = outerInstance.blockSize;
             }
 
             private byte[] Current;
@@ -436,9 +436,9 @@ namespace Lucene.Net.Util.Fst
 
             public override byte ReadByte()
             {
-                if (nextRead == OuterInstance.BlockSize)
+                if (nextRead == outerInstance.blockSize)
                 {
-                    Current = OuterInstance.Blocks[nextBuffer++];
+                    Current = outerInstance.blocks[nextBuffer++];
                     nextRead = 0;
                 }
                 return Current[nextRead++];
@@ -453,7 +453,7 @@ namespace Lucene.Net.Util.Fst
             {
                 while (len > 0)
                 {
-                    int chunkLeft = OuterInstance.BlockSize - nextRead;
+                    int chunkLeft = outerInstance.blockSize - nextRead;
                     if (len <= chunkLeft)
                     {
                         Array.Copy(Current, nextRead, b, offset, len);
@@ -468,7 +468,7 @@ namespace Lucene.Net.Util.Fst
                             offset += chunkLeft;
                             len -= chunkLeft;
                         }
-                        Current = OuterInstance.Blocks[nextBuffer++];
+                        Current = outerInstance.blocks[nextBuffer++];
                         nextRead = 0;
                     }
                 }
@@ -478,14 +478,14 @@ namespace Lucene.Net.Util.Fst
             {
                 get
                 {
-                    return ((long)nextBuffer - 1) * OuterInstance.BlockSize + nextRead;
+                    return ((long)nextBuffer - 1) * outerInstance.blockSize + nextRead;
                 }
                 set
                 {
-                    int bufferIndex = (int)(value >> OuterInstance.blockBits);
+                    int bufferIndex = (int)(value >> outerInstance.blockBits);
                     nextBuffer = bufferIndex + 1;
-                    Current = OuterInstance.Blocks[bufferIndex];
-                    nextRead = (int)(value & OuterInstance.BlockMask);
+                    Current = outerInstance.blocks[bufferIndex];
+                    nextRead = (int)(value & outerInstance.blockMask);
                     Debug.Assert(this.Position == value, "pos=" + value + " getPos()=" + this.Position);
                 }
             }
@@ -506,21 +506,21 @@ namespace Lucene.Net.Util.Fst
 
         internal virtual FST.BytesReader GetReverseReader(bool allowSingle)
         {
-            if (allowSingle && Blocks.Count == 1)
+            if (allowSingle && blocks.Count == 1)
             {
-                return new ReverseBytesReader(Blocks[0]);
+                return new ReverseBytesReader(blocks[0]);
             }
             return new ReverseBytesReaderAnonymousInner(this);
         }
 
         private class ReverseBytesReaderAnonymousInner : FST.BytesReader
         {
-            private readonly BytesStore OuterInstance;
+            private readonly BytesStore outerInstance;
 
             public ReverseBytesReaderAnonymousInner(BytesStore outerInstance)
             {
-                this.OuterInstance = outerInstance;
-                Current = outerInstance.Blocks.Count == 0 ? null : outerInstance.Blocks[0];
+                this.outerInstance = outerInstance;
+                Current = outerInstance.blocks.Count == 0 ? null : outerInstance.blocks[0];
                 nextBuffer = -1;
                 nextRead = 0;
             }
@@ -533,8 +533,8 @@ namespace Lucene.Net.Util.Fst
             {
                 if (nextRead == -1)
                 {
-                    Current = OuterInstance.Blocks[nextBuffer--];
-                    nextRead = OuterInstance.BlockSize - 1;
+                    Current = outerInstance.blocks[nextBuffer--];
+                    nextRead = outerInstance.blockSize - 1;
                 }
                 return Current[nextRead--];
             }
@@ -556,7 +556,7 @@ namespace Lucene.Net.Util.Fst
             {
                 get
                 {
-                    return ((long)nextBuffer + 1) * OuterInstance.BlockSize + nextRead;
+                    return ((long)nextBuffer + 1) * outerInstance.blockSize + nextRead;
                 }
                 set
                 {
@@ -564,10 +564,10 @@ namespace Lucene.Net.Util.Fst
                     // setPosition(0), the next byte you read is
                     // bytes[0] ... but I would expect bytes[-1] (ie,
                     // EOF)...?
-                    int bufferIndex = (int)(value >> OuterInstance.blockBits);
+                    int bufferIndex = (int)(value >> outerInstance.blockBits);
                     nextBuffer = bufferIndex - 1;
-                    Current = OuterInstance.Blocks[bufferIndex];
-                    nextRead = (int)(value & OuterInstance.BlockMask);
+                    Current = outerInstance.blocks[bufferIndex];
+                    nextRead = (int)(value & outerInstance.blockMask);
                     Debug.Assert(this.Position == value, "value=" + value + " this.Position=" + this.Position);
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b8db797b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
index b541544..fc0b44f 100644
--- a/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Util.Fst
     public sealed class CharSequenceOutputs : Outputs<CharsRef>
     {
         private static readonly CharsRef NO_OUTPUT = new CharsRef();
-        private static readonly CharSequenceOutputs Singleton_Renamed = new CharSequenceOutputs();
+        private static readonly CharSequenceOutputs singleton = new CharSequenceOutputs();
 
         private CharSequenceOutputs()
         {
@@ -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/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FST.cs b/src/Lucene.Net.Core/Util/Fst/FST.cs
index f0d7173..3350068 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -104,7 +104,7 @@ namespace Lucene.Net.Util.Fst
         /// <seealso cref= #shouldExpand(UnCompiledNode) </seealso>
         internal const int FIXED_ARRAY_NUM_ARCS_DEEP = 10;*/
 
-        private int[] BytesPerArc = new int[0];
+        private int[] bytesPerArc = new int[0];
 
         /*// Increment version to change it
         private const string FILE_FORMAT_NAME = "FST";
@@ -144,7 +144,7 @@ namespace Lucene.Net.Util.Fst
 
         internal readonly BytesStore Bytes;
 
-        private long StartNode = -1;
+        private long startNode = -1;
 
         public readonly Outputs<T> Outputs;
 
@@ -152,7 +152,7 @@ namespace Lucene.Net.Util.Fst
         // instead of storing the address of the target node for
         // a given arc, we mark a single bit noting that the next
         // node in the byte[] is the target node):
-        private long LastFrozenNode;
+        private long lastFrozenNode;
 
         private readonly T NO_OUTPUT;
 
@@ -160,31 +160,33 @@ namespace Lucene.Net.Util.Fst
         public long arcCount;
         public long arcWithOutputCount;
 
-        private readonly bool Packed;
-        private PackedInts.Reader NodeRefToAddress;
+        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;
 
-        private readonly bool AllowArrayArcs;
+        private readonly bool allowArrayArcs;
 
-        private Arc<T>[] CachedRootArcs;
-        private Arc<T>[] AssertingCachedRootArcs; // only set wit assert
+        private Arc<T>[] cachedRootArcs;
+        private Arc<T>[] assertingCachedRootArcs; // only set wit assert
+
+        // LUCENENET NOTE: Arc<T> moved into FST class
 
         internal static bool Flag(int flags, int bit)
         {
             return (flags & bit) != 0;
         }
 
-        private GrowableWriter NodeAddress;
+        private GrowableWriter nodeAddress;
 
         // TODO: we could be smarter here, and prune periodically
         // as we go; high in-count nodes will "usually" become
         // clear early on:
-        private GrowableWriter InCounts;
+        private GrowableWriter inCounts;
 
-        private readonly int Version;
+        private readonly int version;
 
         // make a new empty FST, for building; Builder invokes
         // this ctor
@@ -192,8 +194,8 @@ namespace Lucene.Net.Util.Fst
         {
             this.inputType = inputType;
             this.Outputs = outputs;
-            this.AllowArrayArcs = allowArrayArcs;
-            Version = VERSION_CURRENT;
+            this.allowArrayArcs = allowArrayArcs;
+            version = VERSION_CURRENT;
             Bytes = new BytesStore(bytesPageBits);
             // pad: ensure no node gets address 0 which is reserved to mean
             // the stop state w/ no arcs
@@ -201,18 +203,18 @@ namespace Lucene.Net.Util.Fst
             NO_OUTPUT = outputs.NoOutput;
             if (willPackFST)
             {
-                NodeAddress = new GrowableWriter(15, 8, acceptableOverheadRatio);
-                InCounts = new GrowableWriter(1, 8, acceptableOverheadRatio);
+                nodeAddress = new GrowableWriter(15, 8, acceptableOverheadRatio);
+                inCounts = new GrowableWriter(1, 8, acceptableOverheadRatio);
             }
             else
             {
-                NodeAddress = null;
-                InCounts = null;
+                nodeAddress = null;
+                inCounts = null;
             }
 
             emptyOutput = default(T);
-            Packed = false;
-            NodeRefToAddress = null;
+            packed = false;
+            nodeRefToAddress = null;
         }
 
         public static readonly int DEFAULT_MAX_BLOCK_BITS = Constants.JRE_IS_64BIT ? 30 : 28;
@@ -239,8 +241,8 @@ 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);
-            Packed = @in.ReadByte() == 1;
+            version = CodecUtil.CheckHeader(@in, FILE_FORMAT_NAME, VERSION_PACKED, VERSION_VINT_TARGET);
+            packed = @in.ReadByte() == 1;
             if (@in.ReadByte() == 1)
             {
                 // accepts empty string
@@ -251,7 +253,7 @@ namespace Lucene.Net.Util.Fst
 
                 // De-serialize empty-string output:
                 BytesReader reader;
-                if (Packed)
+                if (packed)
                 {
                     reader = emptyBytes.ForwardReader;
                 }
@@ -290,15 +292,15 @@ namespace Lucene.Net.Util.Fst
                 default:
                     throw new InvalidOperationException("invalid input type " + t);
             }
-            if (Packed)
+            if (packed)
             {
-                NodeRefToAddress = PackedInts.GetReader(@in);
+                nodeRefToAddress = PackedInts.GetReader(@in);
             }
             else
             {
-                NodeRefToAddress = null;
+                nodeRefToAddress = null;
             }
-            StartNode = @in.ReadVLong();
+            startNode = @in.ReadVLong();
             nodeCount = @in.ReadVLong();
             arcCount = @in.ReadVLong();
             arcWithOutputCount = @in.ReadVLong();
@@ -313,7 +315,7 @@ namespace Lucene.Net.Util.Fst
             // NOTE: bogus because this is only used during
             // building; we need to break out mutable FST from
             // immutable
-            AllowArrayArcs = false;
+            allowArrayArcs = false;
 
             /*
             if (bytes.length == 665) {
@@ -338,21 +340,21 @@ namespace Lucene.Net.Util.Fst
         public long SizeInBytes()
         {
             long size = Bytes.Position;
-            if (Packed)
+            if (packed)
             {
-                size += NodeRefToAddress.RamBytesUsed();
+                size += nodeRefToAddress.RamBytesUsed();
             }
-            else if (NodeAddress != null)
+            else if (nodeAddress != null)
             {
-                size += NodeAddress.RamBytesUsed();
-                size += InCounts.RamBytesUsed();
+                size += nodeAddress.RamBytesUsed();
+                size += inCounts.RamBytesUsed();
             }
             return size;
         }
 
         public void Finish(long newStartNode)
         {
-            if (StartNode != -1)
+            if (startNode != -1)
             {
                 throw new InvalidOperationException("already finished");
             }
@@ -360,7 +362,7 @@ namespace Lucene.Net.Util.Fst
             {
                 newStartNode = 0;
             }
-            StartNode = newStartNode;
+            startNode = newStartNode;
             Bytes.Finish();
 
             CacheRootArcs();
@@ -368,10 +370,10 @@ namespace Lucene.Net.Util.Fst
 
         private long GetNodeAddress(long node)
         {
-            if (NodeAddress != null)
+            if (nodeAddress != null)
             {
                 // Deref
-                return NodeAddress.Get((int)node);
+                return nodeAddress.Get((int)node);
             }
             else
             {
@@ -383,10 +385,10 @@ namespace Lucene.Net.Util.Fst
         // Caches first 128 labels
         private void CacheRootArcs()
         {
-            CachedRootArcs = (Arc<T>[])new Arc<T>[0x80];
-            ReadRootArcs(CachedRootArcs);
+            cachedRootArcs = (Arc<T>[])new Arc<T>[0x80];
+            ReadRootArcs(cachedRootArcs);
 
-            Debug.Assert(SetAssertingRootArcs(CachedRootArcs));
+            Debug.Assert(SetAssertingRootArcs(cachedRootArcs));
             Debug.Assert(AssertRootArcs());
         }
 
@@ -401,7 +403,7 @@ namespace Lucene.Net.Util.Fst
                 while (true)
                 {
                     Debug.Assert(arc.Label != END_LABEL);
-                    if (arc.Label < CachedRootArcs.Length)
+                    if (arc.Label < cachedRootArcs.Length)
                     {
                         arcs[arc.Label] = (new Arc<T>()).CopyFrom(arc);
                     }
@@ -420,19 +422,19 @@ namespace Lucene.Net.Util.Fst
 
         private bool SetAssertingRootArcs(Arc<T>[] arcs)
         {
-            AssertingCachedRootArcs = (Arc<T>[])new Arc<T>[arcs.Length];
-            ReadRootArcs(AssertingCachedRootArcs);
+            assertingCachedRootArcs = (Arc<T>[])new Arc<T>[arcs.Length];
+            ReadRootArcs(assertingCachedRootArcs);
             return true;
         }
 
         private bool AssertRootArcs()
         {
-            Debug.Assert(CachedRootArcs != null);
-            Debug.Assert(AssertingCachedRootArcs != null);
-            for (int i = 0; i < CachedRootArcs.Length; i++)
+            Debug.Assert(cachedRootArcs != null);
+            Debug.Assert(assertingCachedRootArcs != null);
+            for (int i = 0; i < cachedRootArcs.Length; i++)
             {
-                Arc<T> root = CachedRootArcs[i];
-                Arc<T> asserting = AssertingCachedRootArcs[i];
+                Arc<T> root = cachedRootArcs[i];
+                Arc<T> asserting = assertingCachedRootArcs[i];
                 if (root != null)
                 {
                     Debug.Assert(root.ArcIdx == asserting.ArcIdx);
@@ -491,20 +493,20 @@ namespace Lucene.Net.Util.Fst
 
         public void Save(DataOutput @out)
         {
-            if (StartNode == -1)
+            if (startNode == -1)
             {
                 throw new InvalidOperationException("call finish first");
             }
-            if (NodeAddress != null)
+            if (nodeAddress != null)
             {
                 throw new InvalidOperationException("cannot save an FST pre-packed FST; it must first be packed");
             }
-            if (Packed && !(NodeRefToAddress is PackedInts.Mutable))
+            if (packed && !(nodeRefToAddress is PackedInts.Mutable))
             {
                 throw new InvalidOperationException("cannot save a FST which has been loaded from disk ");
             }
             CodecUtil.WriteHeader(@out, FILE_FORMAT_NAME, VERSION_CURRENT);
-            if (Packed)
+            if (packed)
             {
                 @out.WriteByte(1);
             }
@@ -526,7 +528,7 @@ namespace Lucene.Net.Util.Fst
                 var emptyOutputBytes = new byte[(int)ros.FilePointer];
                 ros.WriteTo(emptyOutputBytes, 0);
 
-                if (!Packed)
+                if (!packed)
                 {
                     // reverse
                     int stopAt = emptyOutputBytes.Length / 2;
@@ -560,11 +562,11 @@ namespace Lucene.Net.Util.Fst
                 t = 2;
             }
             @out.WriteByte((byte)t);
-            if (Packed)
+            if (packed)
             {
-                ((PackedInts.Mutable)NodeRefToAddress).Save(@out);
+                ((PackedInts.Mutable)nodeRefToAddress).Save(@out);
             }
-            @out.WriteVLong(StartNode);
+            @out.WriteVLong(startNode);
             @out.WriteVLong(nodeCount);
             @out.WriteVLong(arcCount);
             @out.WriteVLong(arcWithOutputCount);
@@ -696,9 +698,9 @@ namespace Lucene.Net.Util.Fst
             if (doFixedArray)
             {
                 //System.out.println("  fixedArray");
-                if (BytesPerArc.Length < nodeIn.NumArcs)
+                if (bytesPerArc.Length < nodeIn.NumArcs)
                 {
-                    BytesPerArc = new int[ArrayUtil.Oversize(nodeIn.NumArcs, 1)];
+                    bytesPerArc = new int[ArrayUtil.Oversize(nodeIn.NumArcs, 1)];
                 }
             }
 
@@ -720,7 +722,7 @@ namespace Lucene.Net.Util.Fst
                     flags += BIT_LAST_ARC;
                 }
 
-                if (LastFrozenNode == target.Node && !doFixedArray)
+                if (lastFrozenNode == target.Node && !doFixedArray)
                 {
                     // TODO: for better perf (but more RAM used) we
                     // could avoid this except when arc is "near" the
@@ -747,9 +749,9 @@ namespace Lucene.Net.Util.Fst
                 {
                     flags += BIT_STOP_NODE;
                 }
-                else if (InCounts != null)
+                else if (inCounts != null)
                 {
-                    InCounts.Set((int)target.Node, InCounts.Get((int)target.Node) + 1);
+                    inCounts.Set((int)target.Node, inCounts.Get((int)target.Node) + 1);
                 }
 
                 if (!arc.Output.Equals(NO_OUTPUT))
@@ -787,9 +789,9 @@ namespace Lucene.Net.Util.Fst
                 // byte size:
                 if (doFixedArray)
                 {
-                    BytesPerArc[arcIdx] = (int)(Bytes.Position - lastArcStart);
+                    bytesPerArc[arcIdx] = (int)(Bytes.Position - lastArcStart);
                     lastArcStart = Bytes.Position;
-                    maxBytesPerArc = Math.Max(maxBytesPerArc, BytesPerArc[arcIdx]);
+                    maxBytesPerArc = Math.Max(maxBytesPerArc, bytesPerArc[arcIdx]);
                     //System.out.println("    bytes=" + bytesPerArc[arcIdx]);
                 }
             }
@@ -844,13 +846,13 @@ namespace Lucene.Net.Util.Fst
                     for (int arcIdx = nodeIn.NumArcs - 1; arcIdx >= 0; arcIdx--)
                     {
                         destPos -= maxBytesPerArc;
-                        srcPos -= BytesPerArc[arcIdx];
+                        srcPos -= bytesPerArc[arcIdx];
                         //System.out.println("  repack arcIdx=" + arcIdx + " srcPos=" + srcPos + " destPos=" + destPos);
                         if (srcPos != destPos)
                         {
                             //System.out.println("  copy len=" + bytesPerArc[arcIdx]);
-                            Debug.Assert(destPos > srcPos, "destPos=" + destPos + " srcPos=" + srcPos + " arcIdx=" + arcIdx + " maxBytesPerArc=" + maxBytesPerArc + " bytesPerArc[arcIdx]=" + BytesPerArc[arcIdx] + " nodeIn.numArcs=" + nodeIn.NumArcs);
-                            Bytes.CopyBytes(srcPos, destPos, BytesPerArc[arcIdx]);
+                            Debug.Assert(destPos > srcPos, "destPos=" + destPos + " srcPos=" + srcPos + " arcIdx=" + arcIdx + " maxBytesPerArc=" + maxBytesPerArc + " bytesPerArc[arcIdx]=" + bytesPerArc[arcIdx] + " nodeIn.numArcs=" + nodeIn.NumArcs);
+                            Bytes.CopyBytes(srcPos, destPos, bytesPerArc[arcIdx]);
                         }
                     }
                 }
@@ -865,22 +867,22 @@ namespace Lucene.Net.Util.Fst
 
             // PackedInts uses int as the index, so we cannot handle
             // > 2.1B nodes when packing:
-            if (NodeAddress != null && nodeCount == int.MaxValue)
+            if (nodeAddress != null && nodeCount == int.MaxValue)
             {
                 throw new InvalidOperationException("cannot create a packed FST with more than 2.1 billion nodes");
             }
 
             nodeCount++;
             long node;
-            if (NodeAddress != null)
+            if (nodeAddress != null)
             {
                 // Nodes are addressed by 1+ord:
-                if ((int)nodeCount == NodeAddress.Size())
+                if ((int)nodeCount == nodeAddress.Size())
                 {
-                    NodeAddress = NodeAddress.Resize(ArrayUtil.Oversize(NodeAddress.Size() + 1, NodeAddress.BitsPerValue));
-                    InCounts = InCounts.Resize(ArrayUtil.Oversize(InCounts.Size() + 1, InCounts.BitsPerValue));
+                    nodeAddress = nodeAddress.Resize(ArrayUtil.Oversize(nodeAddress.Size() + 1, nodeAddress.BitsPerValue));
+                    inCounts = inCounts.Resize(ArrayUtil.Oversize(inCounts.Size() + 1, inCounts.BitsPerValue));
                 }
-                NodeAddress.Set((int)nodeCount, thisNodeAddress);
+                nodeAddress.Set((int)nodeCount, thisNodeAddress);
                 // System.out.println("  write nodeAddress[" + nodeCount + "] = " + endAddress);
                 node = nodeCount;
             }
@@ -888,7 +890,7 @@ namespace Lucene.Net.Util.Fst
             {
                 node = thisNodeAddress;
             }
-            LastFrozenNode = node;
+            lastFrozenNode = node;
 
             //System.out.println("  ret node=" + node + " address=" + thisNodeAddress + " nodeAddress=" + nodeAddress);
             return node;
@@ -918,7 +920,7 @@ namespace Lucene.Net.Util.Fst
 
             // If there are no nodes, ie, the FST only accepts the
             // empty string, then startNode is 0
-            arc.Target = StartNode;
+            arc.Target = startNode;
             return arc;
         }
 
@@ -951,7 +953,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     // array: jump straight to end
                     arc.NumArcs = @in.ReadVInt();
-                    if (Packed || Version >= VERSION_VINT_TARGET)
+                    if (packed || version >= VERSION_VINT_TARGET)
                     {
                         arc.BytesPerArc = @in.ReadVInt();
                     }
@@ -987,7 +989,7 @@ namespace Lucene.Net.Util.Fst
                         else if (arc.Flag(BIT_TARGET_NEXT))
                         {
                         }
-                        else if (Packed)
+                        else if (packed)
                         {
                             @in.ReadVLong();
                         }
@@ -1010,7 +1012,7 @@ namespace Lucene.Net.Util.Fst
         private long ReadUnpackedNodeTarget(BytesReader @in)
         {
             long target;
-            if (Version < VERSION_VINT_TARGET)
+            if (version < VERSION_VINT_TARGET)
             {
                 target = @in.ReadInt();
             }
@@ -1071,7 +1073,7 @@ namespace Lucene.Net.Util.Fst
                 //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 >= VERSION_VINT_TARGET)
                 {
                     arc.BytesPerArc = @in.ReadVInt();
                 }
@@ -1153,7 +1155,7 @@ namespace Lucene.Net.Util.Fst
                     @in.ReadVInt();
 
                     // Skip bytesPerArc:
-                    if (Packed || Version >= VERSION_VINT_TARGET)
+                    if (packed || version >= VERSION_VINT_TARGET)
                     {
                         @in.ReadVInt();
                     }
@@ -1249,7 +1251,7 @@ namespace Lucene.Net.Util.Fst
                 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 (nodeAddress == null)
                 {
                     if (!arc.Flag(BIT_LAST_ARC))
                     {
@@ -1274,7 +1276,7 @@ namespace Lucene.Net.Util.Fst
             }
             else
             {
-                if (Packed)
+                if (packed)
                 {
                     long pos = @in.Position;
                     long code = @in.ReadVLong();
@@ -1284,10 +1286,10 @@ namespace Lucene.Net.Util.Fst
                         arc.Target = pos + code;
                         //System.out.println("    delta pos=" + pos + " delta=" + code + " target=" + arc.target);
                     }
-                    else if (code < NodeRefToAddress.Size())
+                    else if (code < nodeRefToAddress.Size())
                     {
                         // Deref
-                        arc.Target = NodeRefToAddress.Get((int)code);
+                        arc.Target = nodeRefToAddress.Get((int)code);
                         //System.out.println("    deref code=" + code + " target=" + arc.target);
                     }
                     else
@@ -1341,12 +1343,12 @@ namespace Lucene.Net.Util.Fst
             }
 
             // Short-circuit if this arc is in the root arc cache:
-            if (follow.Target == StartNode && labelToMatch < CachedRootArcs.Length)
+            if (follow.Target == startNode && labelToMatch < cachedRootArcs.Length)
             {
                 // LUCENE-5152: detect tricky cases where caller
                 // modified previously returned cached root-arcs:
                 Debug.Assert(AssertRootArcs());
-                Arc<T> result = CachedRootArcs[labelToMatch];
+                Arc<T> result = cachedRootArcs[labelToMatch];
                 if (result == null)
                 {
                     return null;
@@ -1373,7 +1375,7 @@ namespace Lucene.Net.Util.Fst
             {
                 // Arcs are full array; do binary search:
                 arc.NumArcs = @in.ReadVInt();
-                if (Packed || Version >= VERSION_VINT_TARGET)
+                if (packed || version >= VERSION_VINT_TARGET)
                 {
                     arc.BytesPerArc = @in.ReadVInt();
                 }
@@ -1459,7 +1461,7 @@ namespace Lucene.Net.Util.Fst
 
                 if (!Flag(flags, BIT_STOP_NODE) && !Flag(flags, BIT_TARGET_NEXT))
                 {
-                    if (Packed)
+                    if (packed)
                     {
                         @in.ReadVLong();
                     }
@@ -1517,7 +1519,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 <= FIXED_ARRAY_SHALLOW_DISTANCE && node.NumArcs >= FIXED_ARRAY_NUM_ARCS_SHALLOW) || node.NumArcs >= FIXED_ARRAY_NUM_ARCS_DEEP);
         }
 
         /// <summary>
@@ -1529,7 +1531,7 @@ namespace Lucene.Net.Util.Fst
             get
             {
                 FST.BytesReader @in;
-                if (Packed)
+                if (packed)
                 {
                     @in = Bytes.ForwardReader;
                 }
@@ -1673,8 +1675,8 @@ namespace Lucene.Net.Util.Fst
         // Creates a packed FST
         private FST(INPUT_TYPE inputType, Outputs<T> outputs, int bytesPageBits)
         {
-            Version = VERSION_CURRENT;
-            Packed = true;
+            version = VERSION_CURRENT;
+            packed = true;
             this.inputType = inputType;
             Bytes = new BytesStore(bytesPageBits);
             this.Outputs = outputs;
@@ -1683,7 +1685,7 @@ namespace Lucene.Net.Util.Fst
             // NOTE: bogus because this is only used during
             // building; we need to break out mutable FST from
             // immutable
-            AllowArrayArcs = false;
+            allowArrayArcs = false;
         }
 
         /// <summary>
@@ -1715,7 +1717,7 @@ namespace Lucene.Net.Util.Fst
             //   - use spare bits in flags.... for top few labels /
             //     outputs / targets
 
-            if (NodeAddress == null)
+            if (nodeAddress == null)
             {
                 throw new System.ArgumentException("this FST was not built with willPackFST=true");
             }
@@ -1724,34 +1726,34 @@ namespace Lucene.Net.Util.Fst
 
             BytesReader r = BytesReader;
 
-            int topN = Math.Min(maxDerefNodes, InCounts.Size());
+            int topN = Math.Min(maxDerefNodes, inCounts.Size());
 
             // Find top nodes with highest number of incoming arcs:
             NodeQueue q = new NodeQueue(topN);
 
             // TODO: we could use more RAM efficient selection algo here...
             NodeAndInCount bottom = null;
-            for (int node = 0; node < InCounts.Size(); node++)
+            for (int node = 0; node < inCounts.Size(); node++)
             {
-                if (InCounts.Get(node) >= minInCountDeref)
+                if (inCounts.Get(node) >= minInCountDeref)
                 {
                     if (bottom == null)
                     {
-                        q.Add(new NodeAndInCount(node, (int)InCounts.Get(node)));
+                        q.Add(new NodeAndInCount(node, (int)inCounts.Get(node)));
                         if (q.Size() == topN)
                         {
                             bottom = q.Top();
                         }
                     }
-                    else if (InCounts.Get(node) > bottom.Count)
+                    else if (inCounts.Get(node) > bottom.Count)
                     {
-                        q.InsertWithOverflow(new NodeAndInCount(node, (int)InCounts.Get(node)));
+                        q.InsertWithOverflow(new NodeAndInCount(node, (int)inCounts.Get(node)));
                     }
                 }
             }
 
             // Free up RAM:
-            InCounts = null;
+            inCounts = null;
 
             IDictionary<int, int> topNodeMap = new Dictionary<int, int>();
             for (int downTo = q.Size() - 1; downTo >= 0; downTo--)
@@ -1767,7 +1769,7 @@ namespace Lucene.Net.Util.Fst
             // Fill initial coarse guess:
             for (int node = 1; node <= nodeCount; node++)
             {
-                newNodeAddress.Set(node, 1 + this.Bytes.Position - NodeAddress.Get(node));
+                newNodeAddress.Set(node, 1 + this.Bytes.Position - nodeAddress.Get(node));
             }
 
             int absCount;
@@ -2075,9 +2077,9 @@ namespace Lucene.Net.Util.Fst
             {
                 nodeRefToAddressIn.Set(ent.Value, newNodeAddress.Get(ent.Key));
             }
-            fst.NodeRefToAddress = nodeRefToAddressIn;
+            fst.nodeRefToAddress = nodeRefToAddressIn;
 
-            fst.StartNode = newNodeAddress.Get((int)StartNode);
+            fst.startNode = newNodeAddress.Get((int)startNode);
             //System.out.println("new startNode=" + fst.startNode + " old startNode=" + startNode);
 
             if (emptyOutput != null)


[18/49] lucenenet git commit: TestFSTs: Added LongRunningTest and Ignore attributes for applicable tests.

Posted by sy...@apache.org.
TestFSTs: Added LongRunningTest and Ignore attributes for applicable tests.


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

Branch: refs/heads/master
Commit: 32e2105bba349544c3166d30f664ef7edd219a3a
Parents: d807eeb
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 8 02:19:29 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:41:01 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs | 61 ++++++++++-----------
 1 file changed, 29 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/32e2105b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
index 3ff21be..8dde689 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
@@ -1,10 +1,14 @@
+using Lucene.Net.Attributes;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
+using NUnit.Framework;
 using System;
-using System.Diagnostics;
 using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Text;
-using Lucene.Net.Randomized.Generators;
 
 namespace Lucene.Net.Util.Fst
 {
@@ -25,46 +29,38 @@ namespace Lucene.Net.Util.Fst
      * limitations under the License.
      */
 
-    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
+    //using Slow = Lucene.Net.Util.LuceneTestCase.Slow;
+    using Automaton = Lucene.Net.Util.Automaton.Automaton;
+    //using InputOutput = Lucene.Net.Util.Fst.BytesRefFSTEnum.InputOutput;
+    //using Arc = Lucene.Net.Util.Fst.FST.Arc;
+    using BytesReader = Lucene.Net.Util.Fst.FST.BytesReader;
+    using CompiledAutomaton = Lucene.Net.Util.Automaton.CompiledAutomaton;
+    using Directory = Lucene.Net.Store.Directory;
+    using DirectoryReader = Lucene.Net.Index.DirectoryReader;
     using Document = Lucene.Net.Documents.Document;
     using Field = Lucene.Net.Documents.Field;
-    using DirectoryReader = Lucene.Net.Index.DirectoryReader;
+    using FSDirectory = Lucene.Net.Store.FSDirectory;
+    using IndexInput = Lucene.Net.Store.IndexInput;
+    using IndexOutput = Lucene.Net.Store.IndexOutput;
     using IndexReader = Lucene.Net.Index.IndexReader;
+    using IndexSearcher = Lucene.Net.Search.IndexSearcher;
     using IndexWriter = Lucene.Net.Index.IndexWriter;
     using IndexWriterConfig = Lucene.Net.Index.IndexWriterConfig;
-    using MultiFields = Lucene.Net.Index.MultiFields;
-    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
-    using Term = Lucene.Net.Index.Term;
-    using Terms = Lucene.Net.Index.Terms;
-    using TermsEnum = Lucene.Net.Index.TermsEnum;
-    using IndexSearcher = Lucene.Net.Search.IndexSearcher;
-    using TermQuery = Lucene.Net.Search.TermQuery;
-    using Directory = Lucene.Net.Store.Directory;
-    using FSDirectory = Lucene.Net.Store.FSDirectory;
     using IOContext = Lucene.Net.Store.IOContext;
-    using IndexInput = Lucene.Net.Store.IndexInput;
-    using IndexOutput = Lucene.Net.Store.IndexOutput;
+    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
-    //using Slow = Lucene.Net.Util.LuceneTestCase.Slow;
-    using SuppressCodecs = Lucene.Net.Util.LuceneTestCase.SuppressCodecs;
-    using Automaton = Lucene.Net.Util.Automaton.Automaton;
-    using CompiledAutomaton = Lucene.Net.Util.Automaton.CompiledAutomaton;
-    using RegExp = Lucene.Net.Util.Automaton.RegExp;
-    //using InputOutput = Lucene.Net.Util.Fst.BytesRefFSTEnum.InputOutput;
-    //using Arc = Lucene.Net.Util.Fst.FST.Arc;
-    using BytesReader = Lucene.Net.Util.Fst.FST.BytesReader;
-    using Pair = Lucene.Net.Util.Fst.PairOutputs<long?, long?>.Pair;
+    using MultiFields = Lucene.Net.Index.MultiFields;
     //using ResultLong = Lucene.Net.Util.Fst.Util.Result<long?>;
     //using ResultPair = Lucene.Net.Util.Fst.Util.Result<long?>;
     using PackedInts = Lucene.Net.Util.Packed.PackedInts;
-    using Lucene.Net.Support;
-    using NUnit.Framework;
-    using System.Globalization;
+    using Pair = Lucene.Net.Util.Fst.PairOutputs<long?, long?>.Pair;
+    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
+    using RegExp = Lucene.Net.Util.Automaton.RegExp;
+    using Term = Lucene.Net.Index.Term;
+    using TermQuery = Lucene.Net.Search.TermQuery;
+    using Terms = Lucene.Net.Index.Terms;
+    using TermsEnum = Lucene.Net.Index.TermsEnum;
 
-    /*
-    import static Lucene.Net.Util.Fst.FSTTester.GetRandomString;
-    import static Lucene.Net.Util.Fst.FSTTester.SimpleRandomString;
-    import static Lucene.Net.Util.Fst.FSTTester.ToIntsRef;*/
 
     [TestFixture]
     public class TestFSTs : LuceneTestCase
@@ -269,7 +265,7 @@ namespace Lucene.Net.Util.Fst
         }
 
 
-        [Test]
+        [Test, LongRunningTest, Timeout(27000000)] // 45 minutes to be on the safe side
         public virtual void TestRandomWords()
         {
             TestRandomWords(1000, AtLeast(2));
@@ -313,6 +309,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         [Test]
+        [Ignore("LUCENENET TODO: This test will take around 10-14 hours to finish. It was marked with a Nightly attribute in the original Java source, but we don't currently have a corresponding attribute")]
         public virtual void TestBigSet()
         {
             TestRandomWords(TestUtil.NextInt(Random(), 50000, 60000), 1);


[35/49] lucenenet git commit: Enabled ignored tests in Core.Index.Test2BDocs + fixed temp dir creation bug in LuceneTestCase

Posted by sy...@apache.org.
Enabled ignored tests in Core.Index.Test2BDocs + fixed temp dir creation bug in LuceneTestCase


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

Branch: refs/heads/master
Commit: 9530d751bba49a31f25ac7c82a99668949283dac
Parents: 0146b47
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 06:13:22 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 06:13:22 2016 +0700

----------------------------------------------------------------------
 .../Util/LuceneTestCase.cs                      |  2 +-
 src/Lucene.Net.Tests/core/Index/Test2BDocs.cs   | 39 ++++++++++----------
 2 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9530d751/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index e7eba75..cb6ee60 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2669,7 +2669,7 @@ namespace Lucene.Net.Util
 
                 try
                 {
-                    if (!f.Exists)
+                    if (!System.IO.Directory.Exists(f.FullName))
                     {
                         f.Create();
                         iterate = false;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9530d751/src/Lucene.Net.Tests/core/Index/Test2BDocs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BDocs.cs b/src/Lucene.Net.Tests/core/Index/Test2BDocs.cs
index 84f69f7..8f9ed67 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BDocs.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BDocs.cs
@@ -1,30 +1,29 @@
+using Lucene.Net.Support;
+using NUnit.Framework;
+
 namespace Lucene.Net.Index
 {
-    using Lucene.Net.Support;
-    using NUnit.Framework;
-    using Directory = Lucene.Net.Store.Directory;
-
     /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
 
+    using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
-    [Ignore]
     [TestFixture]
     public class Test2BDocs : LuceneTestCase
     {


[05/49] lucenenet git commit: .NETify FST: Public member names should be PascalCase.

Posted by sy...@apache.org.
.NETify FST: Public member names should be PascalCase.


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

Branch: refs/heads/master
Commit: 297f92653a0e8e64c25b171444ca18f0387f190a
Parents: 9a56220
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Sep 6 14:18:19 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:46 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs  | 2 +-
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs     | 2 +-
 src/Lucene.Net.Core/Util/Fst/Util.cs               | 6 +++---
 src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/297f9265/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
index d2942e2..5e082dc 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -848,7 +848,7 @@ namespace Lucene.Net.Codecs.Memory
                 private Frame LoadCeilFrame(int label, Frame top, Frame frame)
                 {
                     var arc = frame.arc;
-                    arc = Util.readCeilArc(label, fst, top.arc, arc, fstReader);
+                    arc = Util.ReadCeilArc(label, fst, top.arc, arc, fstReader);
                     if (arc == null)
                     {
                         return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/297f9265/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
index 2d17c5a..011eed6 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -762,7 +762,7 @@ namespace Lucene.Net.Codecs.Memory
                 internal Frame LoadCeilFrame(int label, Frame top, Frame frame)
                 {
                     FST.Arc<FSTTermOutputs.TermData> arc = frame.fstArc;
-                    arc = Util.readCeilArc(label, fst, top.fstArc, arc, fstReader);
+                    arc = Util.ReadCeilArc(label, fst, top.fstArc, arc, fstReader);
                     if (arc == null)
                     {
                         return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/297f9265/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 87514d9..00d2507 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -678,7 +678,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<T>.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:
@@ -721,7 +721,7 @@ namespace Lucene.Net.Util.Fst
         ///          binary format. Expands the graph considerably.
         /// </param>
         /// <seealso cref= "http://www.graphviz.org/" </seealso>
-        public static void toDot<T>(FST<T> fst, TextWriter @out, bool sameRank, bool labelStates)
+        public static void ToDot<T>(FST<T> fst, TextWriter @out, bool sameRank, bool labelStates)
         {
             const string expandedNodeColor = "blue";
 
@@ -1066,7 +1066,7 @@ 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<T>.Arc<T> ReadCeilArc<T>(int label, FST<T> fst, FST<T>.Arc<T> follow, FST<T>.Arc<T> arc, FST<T>.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)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/297f9265/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 d86b695..3e05e6d 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -364,7 +364,7 @@ namespace Lucene.Net.Util.Fst
             if (LuceneTestCase.VERBOSE && Pairs.Count <= 20 && fst != null)
             {
                 TextWriter w = new StreamWriter(new FileStream("out.dot", FileMode.Open), IOUtils.CHARSET_UTF_8);
-                Util.toDot(fst, w, false, false);
+                Util.ToDot(fst, w, false, false);
                 w.Close();
                 Console.WriteLine("SAVED out.dot");
             }


[46/49] lucenenet git commit: Ported part of AtomicReferenceArray from Java for testing.

Posted by sy...@apache.org.
Ported part of AtomicReferenceArray from Java for testing.


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

Branch: refs/heads/master
Commit: 44a5cb543394cc9bd2afa42f42d8666c18e66c48
Parents: 979f4e9
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 18 05:22:51 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 18 05:22:51 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Lucene.Net.csproj           |  1 +
 .../Support/AtomicReferenceArray.cs             | 35 ++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44a5cb54/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 4740604..e06e704 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -608,6 +608,7 @@
     <Compile Include="Support\AtomicInteger.cs" />
     <Compile Include="Support\AtomicLong.cs" />
     <Compile Include="Support\AtomicObject.cs" />
+    <Compile Include="Support\AtomicReferenceArray.cs" />
     <Compile Include="Support\Buffer.cs" />
     <Compile Include="Support\AttributeImplItem.cs" />
     <Compile Include="Support\BitSetSupport.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44a5cb54/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs b/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
new file mode 100644
index 0000000..f6f7316
--- /dev/null
+++ b/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
@@ -0,0 +1,35 @@
+\ufeffusing System.Threading;
+
+namespace Lucene.Net.Support
+{
+    /// <summary>
+    /// Mimics Java's AtomicReferenceArray class (partial implementation)
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class AtomicReferenceArray<T> where T : class
+    {
+        private T[] _array;
+
+        public AtomicReferenceArray(int length)
+        {
+            _array = new T[length];
+        }
+
+        public int Length
+        {
+            get { return _array.Length; }
+        }
+
+        public T this[int index]
+        {
+            get
+            {
+                return Volatile.Read(ref _array[index]);
+            }
+            set
+            {
+                Volatile.Write(ref _array[index], value);
+            }
+        }
+    }
+}


[40/49] lucenenet git commit: Enabled ignored Index.TestStressIndexing2.TestRandom()

Posted by sy...@apache.org.
Enabled ignored Index.TestStressIndexing2.TestRandom()


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

Branch: refs/heads/master
Commit: 74ee08cd9c6318cb1100ee6e139321158a2398b9
Parents: e42f400
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 16:29:57 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 16:29:57 2016 +0700

----------------------------------------------------------------------
 .../core/Index/TestStressIndexing2.cs           | 45 ++++++++++----------
 1 file changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/74ee08cd/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
index a0fc644..02d0255 100644
--- a/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
@@ -1,36 +1,38 @@
+using Lucene.Net.Analysis.Tokenattributes;
+using Lucene.Net.Documents;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
+using NUnit.Framework;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Threading;
-using Lucene.Net.Analysis.Tokenattributes;
-using Lucene.Net.Documents;
 
 namespace Lucene.Net.Index
 {
-    using Lucene.Net.Randomized.Generators;
-    using Lucene.Net.Support;
-    using Lucene.Net.Util;
-    using NUnit.Framework;
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     using Directory = Lucene.Net.Store.Directory;
     using DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator;
     using Document = Documents.Document;
     using Field = Field;
     using FieldType = FieldType;
-
-    /*
-    /// Licensed under the Apache License, Version 2.0 (the "License");
-    /// you may not use this file except in compliance with the License.
-    /// You may obtain a copy of the License at
-    ///
-    ///     http://www.apache.org/licenses/LICENSE-2.0
-    ///
-    /// Unless required by applicable law or agreed to in writing, software
-    /// distributed under the License is distributed on an "AS IS" BASIS,
-    /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    /// See the License for the specific language governing permissions and
-    /// limitations under the License.
-    */
-
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using OpenMode_e = Lucene.Net.Index.IndexWriterConfig.OpenMode_e;
     using TermQuery = Lucene.Net.Search.TermQuery;
@@ -81,7 +83,6 @@ namespace Lucene.Net.Index
             dir.Dispose();
         }
 
-        [Ignore]
         [Test]
         public virtual void TestRandom()
         {


[09/49] lucenenet git commit: Removed duplicate (hidden) class definitions in FST.

Posted by sy...@apache.org.
Removed duplicate (hidden) class definitions in FST.


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

Branch: refs/heads/master
Commit: dfa23109cbe204fa9339e7d4ab23f854c18b46c9
Parents: 510413c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 16:49:13 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:51 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/FST.cs | 101 +++++++------------------------
 1 file changed, 21 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dfa23109/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 d5f53c3..f0d7173 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -1561,17 +1561,6 @@ namespace Lucene.Net.Util.Fst
                 public abstract void SkipBytes(int count);
               }*/
 
-        private class ArcAndState<T>
-        {
-            internal readonly Arc<T> Arc;
-            internal readonly IntsRef Chain;
-
-            public ArcAndState(Arc<T> arc, IntsRef chain)
-            {
-                this.Arc = arc;
-                this.Chain = chain;
-            }
-        }
 
         /*
         public void countSingleChains() throws IOException {
@@ -2108,50 +2097,6 @@ namespace Lucene.Net.Util.Fst
 
             return fst;
         }
-
-        private class NodeAndInCount : IComparable<NodeAndInCount>
-        {
-            internal readonly int Node;
-            internal readonly int Count;
-
-            public NodeAndInCount(int node, int count)
-            {
-                this.Node = node;
-                this.Count = count;
-            }
-
-            public virtual int CompareTo(NodeAndInCount other)
-            {
-                if (Count > other.Count)
-                {
-                    return 1;
-                }
-                else if (Count < other.Count)
-                {
-                    return -1;
-                }
-                else
-                {
-                    // Tie-break: smaller node compares as greater than
-                    return other.Node - Node;
-                }
-            }
-        }
-
-        private class NodeQueue : PriorityQueue<NodeAndInCount>
-        {
-            public NodeQueue(int topN)
-                : base(topN, false)
-            {
-            }
-
-            public override bool LessThan(NodeAndInCount a, NodeAndInCount b)
-            {
-                int cmp = a.CompareTo(b);
-                Debug.Assert(cmp != 0);
-                return cmp < 0;
-            }
-        }
     }
 
     /// <summary>
@@ -2360,47 +2305,43 @@ namespace Lucene.Net.Util.Fst
         }
 
         internal class ArcAndState<T>
-            where T : class
         {
-            private readonly Arc<T> _arc;
-
-            public Arc<T> Arc { get { return _arc; } }
-
-            private readonly IntsRef _chain;
-
-            public IntsRef Chain { get { return _chain; } }
+            internal readonly Arc<T> Arc;
+            internal readonly IntsRef Chain;
 
             public ArcAndState(Arc<T> arc, IntsRef chain)
             {
-                _arc = arc;
-                _chain = chain;
+                this.Arc = arc;
+                this.Chain = chain;
             }
         }
 
         internal class NodeAndInCount : IComparable<NodeAndInCount>
         {
-            private readonly int _node;
-
-            public int Node { get { return _node; } }
-
-            private readonly int _count;
-
-            public int Count { get { return _count; } }
+            internal readonly int Node;
+            internal readonly int Count;
 
             public NodeAndInCount(int node, int count)
             {
-                _node = node;
-                _count = count;
+                this.Node = node;
+                this.Count = count;
             }
 
-            public int CompareTo(NodeAndInCount other)
+            public virtual int CompareTo(NodeAndInCount other)
             {
                 if (Count > other.Count)
+                {
                     return 1;
-                if (Count < other.Count)
+                }
+                else if (Count < other.Count)
+                {
                     return -1;
-                // Tie-break: smaller node compares as greater than
-                return other.Node - Node;
+                }
+                else
+                {
+                    // Tie-break: smaller node compares as greater than
+                    return other.Node - Node;
+                }
             }
         }
 
@@ -2413,8 +2354,8 @@ namespace Lucene.Net.Util.Fst
 
             public override bool LessThan(NodeAndInCount a, NodeAndInCount b)
             {
-                var cmp = a.CompareTo(b);
-                // assert cmp != 0;
+                int cmp = a.CompareTo(b);
+                Debug.Assert(cmp != 0);
                 return cmp < 0;
             }
         }


[10/49] lucenenet git commit: .NETify FST: Private/protected fields should be camelCase.

Posted by sy...@apache.org.
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)


[29/49] lucenenet git commit: Moved tests from namespace Lucene.Net.Document to Lucene.Net.Documents so we don't have conflicts with the Document type and cleaned up headers.

Posted by sy...@apache.org.
Moved tests from namespace Lucene.Net.Document to Lucene.Net.Documents so we don't have conflicts with the Document type and cleaned up headers.


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

Branch: refs/heads/master
Commit: 4b4485bee1984f66c871418fc7266453c96e1095
Parents: f4819a3
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 04:08:30 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 04:19:48 2016 +0700

----------------------------------------------------------------------
 .../core/Document/TestBinaryDocument.cs         | 21 +++++-----
 .../core/Document/TestDateTools.cs              | 14 ++-----
 .../core/Document/TestDocument.cs               | 42 +++++++++----------
 src/Lucene.Net.Tests/core/Document/TestField.cs | 44 ++++++++++----------
 4 files changed, 54 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4b4485be/src/Lucene.Net.Tests/core/Document/TestBinaryDocument.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Document/TestBinaryDocument.cs b/src/Lucene.Net.Tests/core/Document/TestBinaryDocument.cs
index 742a0f4..7fdb751 100644
--- a/src/Lucene.Net.Tests/core/Document/TestBinaryDocument.cs
+++ b/src/Lucene.Net.Tests/core/Document/TestBinaryDocument.cs
@@ -1,18 +1,10 @@
-using Lucene.Net.Documents;
 using Lucene.Net.Support;
+using NUnit.Framework;
+using System;
 using System.Text;
 
-namespace Lucene.Net.Document
+namespace Lucene.Net.Documents
 {
-    using NUnit.Framework;
-    using System;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-    using Directory = Lucene.Net.Store.Directory;
-    using IndexableField = Lucene.Net.Index.IndexableField;
-    using IndexReader = Lucene.Net.Index.IndexReader;
-    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -30,6 +22,13 @@ namespace Lucene.Net.Document
      * limitations under the License.
      */
 
+    using BytesRef = Lucene.Net.Util.BytesRef;
+    using Directory = Lucene.Net.Store.Directory;
+    using IndexableField = Lucene.Net.Index.IndexableField;
+    using IndexReader = Lucene.Net.Index.IndexReader;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
+
     /// <summary>
     /// Tests <seealso cref="Document"/> class.
     /// </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4b4485be/src/Lucene.Net.Tests/core/Document/TestDateTools.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Document/TestDateTools.cs b/src/Lucene.Net.Tests/core/Document/TestDateTools.cs
index 26cb90d..3634e8b 100644
--- a/src/Lucene.Net.Tests/core/Document/TestDateTools.cs
+++ b/src/Lucene.Net.Tests/core/Document/TestDateTools.cs
@@ -1,18 +1,10 @@
+using Lucene.Net.Util;
+using NUnit.Framework;
 using System;
 using System.Globalization;
-using Lucene.Net.Documents;
 
-namespace Lucene.Net.Document
+namespace Lucene.Net.Documents
 {
-    /*using Rule = org.junit.Rule;
-    using RuleChain = org.junit.rules.RuleChain;
-    using TestRule = org.junit.rules.TestRule;
-
-    using SystemPropertiesRestoreRule = com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;*/
-
-    using NUnit.Framework;
-    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4b4485be/src/Lucene.Net.Tests/core/Document/TestDocument.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Document/TestDocument.cs b/src/Lucene.Net.Tests/core/Document/TestDocument.cs
index 458f2a0..c139d13 100644
--- a/src/Lucene.Net.Tests/core/Document/TestDocument.cs
+++ b/src/Lucene.Net.Tests/core/Document/TestDocument.cs
@@ -1,11 +1,27 @@
-using Lucene.Net.Documents;
 using Lucene.Net.Support;
+using NUnit.Framework;
+using System.IO;
 using System.Text;
 
-namespace Lucene.Net.Document
+namespace Lucene.Net.Documents
 {
-    using NUnit.Framework;
-    using System.IO;
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Directory = Lucene.Net.Store.Directory;
     using DirectoryReader = Lucene.Net.Index.DirectoryReader;
@@ -15,24 +31,6 @@ namespace Lucene.Net.Document
     using IndexReader = Lucene.Net.Index.IndexReader;
     using IndexSearcher = Lucene.Net.Search.IndexSearcher;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
-    /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
-
     using MockTokenizer = Lucene.Net.Analysis.MockTokenizer;
     using PhraseQuery = Lucene.Net.Search.PhraseQuery;
     using Query = Lucene.Net.Search.Query;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4b4485be/src/Lucene.Net.Tests/core/Document/TestField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Document/TestField.cs b/src/Lucene.Net.Tests/core/Document/TestField.cs
index cbe8ecd..3799591 100644
--- a/src/Lucene.Net.Tests/core/Document/TestField.cs
+++ b/src/Lucene.Net.Tests/core/Document/TestField.cs
@@ -1,31 +1,29 @@
+using Lucene.Net.Support;
+using NUnit.Framework;
+using System;
+using System.IO;
 using System.Text;
-using Lucene.Net.Documents;
 
-namespace Lucene.Net.Document
+namespace Lucene.Net.Documents
 {
-    using Lucene.Net.Support;
-    using NUnit.Framework;
-    using System;
-    using System.IO;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-
     /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
 
+    using BytesRef = Lucene.Net.Util.BytesRef;
     using CannedTokenStream = Lucene.Net.Analysis.CannedTokenStream;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
     using Token = Lucene.Net.Analysis.Token;


[43/49] lucenenet git commit: Enabled ignored Core.Util.TestBroadWord.TestRank1()

Posted by sy...@apache.org.
Enabled ignored Core.Util.TestBroadWord.TestRank1()


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

Branch: refs/heads/master
Commit: a10dc0ee1080549a7c308b3c6863c7ab1ace76d8
Parents: 751db38
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 16:39:29 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 16:39:29 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/TestBroadWord.cs | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a10dc0ee/src/Lucene.Net.Tests/core/Util/TestBroadWord.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestBroadWord.cs b/src/Lucene.Net.Tests/core/Util/TestBroadWord.cs
index a5751dc..b505972 100644
--- a/src/Lucene.Net.Tests/core/Util/TestBroadWord.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestBroadWord.cs
@@ -28,7 +28,6 @@ namespace Lucene.Net.Util
             Assert.AreEqual(Number.BitCount(x), BroadWord.BitCount(x), "rank(" + x + ")");
         }
 
-        [Ignore]
         [Test]
         public virtual void TestRank1()
         {


[17/49] lucenenet git commit: Core.Util.Fst.TestFSTs: Fixed infinite recursion bug in TestRealTerms(). Use Environment.TickCount rather than DateTime.Now.Millisecond when doing time sensitive testing.

Posted by sy...@apache.org.
Core.Util.Fst.TestFSTs: Fixed infinite recursion bug in TestRealTerms(). Use Environment.TickCount rather than DateTime.Now.Millisecond when doing time sensitive testing.


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

Branch: refs/heads/master
Commit: d807eeba7a8cdbb3efc54a00e12312ea0f11b308
Parents: 8617aa9
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 8 00:46:08 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:41:00 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d807eeba/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
index bb4d206..3ff21be 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
@@ -333,10 +333,10 @@ namespace Lucene.Net.Util.Fst
             DirectoryInfo tempDir = CreateTempDir("fstlines");
             Directory dir = NewFSDirectory(tempDir);
             IndexWriter writer = new IndexWriter(dir, conf);
-            long stopTime = DateTime.Now.Millisecond + RUN_TIME_MSEC;
+            long stopTime = Environment.TickCount + RUN_TIME_MSEC;
             Document doc;
             int docCount = 0;
-            while ((doc = docs.NextDoc()) != null && DateTime.Now.Millisecond < stopTime)
+            while ((doc = docs.NextDoc()) != null && Environment.TickCount < stopTime)
             {
                 writer.AddDocument(doc);
                 docCount++;
@@ -542,7 +542,7 @@ namespace Lucene.Net.Util.Fst
                 try
                 {
                     IntsRef intsRef = new IntsRef(10);
-                    long tStart = DateTime.Now.Millisecond;
+                    long tStart = Environment.TickCount;
                     int ord = 0;
                     while (true)
                     {
@@ -557,7 +557,7 @@ namespace Lucene.Net.Util.Fst
                         ord++;
                         if (ord % 500000 == 0)
                         {
-                            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:000000.000}s: {1:000000000}...", ((DateTime.Now.Millisecond - tStart) / 1000.0), ord));
+                            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:000000.000}s: {1:000000000}...", ((Environment.TickCount - tStart) / 1000.0), ord));
                         }
                         if (ord >= limit)
                         {
@@ -565,12 +565,12 @@ namespace Lucene.Net.Util.Fst
                         }
                     }
 
-                    long tMid = DateTime.Now.Millisecond;
+                    long tMid = Environment.TickCount;
                     Console.WriteLine(((tMid - tStart) / 1000.0) + " sec to add all terms");
 
                     Debug.Assert(Builder.TermCount == ord);
                     FST<T> fst = Builder.Finish();
-                    long tEnd = DateTime.Now.Millisecond;
+                    long tEnd = Environment.TickCount;
                     Console.WriteLine(((tEnd - tMid) / 1000.0) + " sec to finish/pack");
                     if (fst == null)
                     {
@@ -619,7 +619,7 @@ namespace Lucene.Net.Util.Fst
                             @is = new StreamReader(new FileStream(WordsFileIn, FileMode.Open), Encoding.UTF8);
 
                             ord = 0;
-                            tStart = DateTime.Now.Millisecond;
+                            tStart = Environment.TickCount;
                             while (true)
                             {
                                 string w = @is.ReadLine();
@@ -659,7 +659,7 @@ namespace Lucene.Net.Util.Fst
                                 ord++;
                                 if (ord % 500000 == 0)
                                 {
-                                    Console.WriteLine(((DateTime.Now.Millisecond - tStart) / 1000.0) + "s: " + ord + "...");
+                                    Console.WriteLine(((Environment.TickCount - tStart) / 1000.0) + "s: " + ord + "...");
                                 }
                                 if (ord >= limit)
                                 {
@@ -667,7 +667,7 @@ namespace Lucene.Net.Util.Fst
                                 }
                             }
 
-                            double totSec = ((DateTime.Now.Millisecond - tStart) / 1000.0);
+                            double totSec = ((Environment.TickCount - tStart) / 1000.0);
                             Console.WriteLine("Verify " + (iter == 1 ? "(by output) " : "") + "took " + totSec + " sec + (" + (int)((totSec * 1000000000 / ord)) + " nsec per lookup)");
 
                             if (!verifyByOutput)


[08/49] lucenenet git commit: .NETify FST: Changed Final, Last, Compiled, and Reversed() to IsFinal, IsLast, IsCompiled, and IsReversed to make it clear that they are boolean states.

Posted by sy...@apache.org.
.NETify FST: Changed Final, Last, Compiled, and Reversed() to IsFinal, IsLast, IsCompiled, and IsReversed to make it clear that they are boolean states.


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

Branch: refs/heads/master
Commit: 510413ce4b99d15a79a70d876e5f89ca657dc193
Parents: 5effb00
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 16:18:17 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:50 2016 +0700

----------------------------------------------------------------------
 .../Analysis/CharFilter/MappingCharFilter.cs    |  4 +--
 .../Analysis/CharFilter/NormalizeCharMap.cs     |  2 +-
 .../Analysis/Hunspell/Dictionary.cs             |  2 +-
 .../Miscellaneous/StemmerOverrideFilter.cs      |  2 +-
 .../Analysis/Synonym/SynonymFilter.cs           |  2 +-
 .../Memory/FSTOrdTermsReader.cs                 |  8 +++---
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs  | 10 +++----
 .../Codecs/BlockTreeTermsReader.cs              | 28 +++++++++---------
 src/Lucene.Net.Core/Util/Fst/Builder.cs         |  8 +++---
 src/Lucene.Net.Core/Util/Fst/BytesStore.cs      |  8 +++---
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 30 ++++++++++----------
 src/Lucene.Net.Core/Util/Fst/FSTEnum.cs         | 18 ++++++------
 .../Util/Fst/ForwardBytesReader.cs              |  4 +--
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        |  8 +++---
 .../Util/Fst/ReverseBytesReader.cs              |  4 +--
 src/Lucene.Net.Core/Util/Fst/Util.cs            | 24 ++++++++--------
 .../Util/fst/FSTTester.cs                       |  2 +-
 .../core/Util/Fst/TestBytesStore.cs             |  4 +--
 src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs  |  6 ++--
 19 files changed, 87 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/MappingCharFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/MappingCharFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/MappingCharFilter.cs
index f14a5e9..3fc3309 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/MappingCharFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/MappingCharFilter.cs
@@ -136,7 +136,7 @@ namespace Lucene.Net.Analysis.CharFilters
                         if (!FST.TargetHasArcs(arc))
                         {
                             // Fast pass for single character match:
-                            Debug.Assert(arc.Final);
+                            Debug.Assert(arc.IsFinal);
                             lastMatchLen = 1;
                             lastMatch = arc.Output;
                         }
@@ -148,7 +148,7 @@ namespace Lucene.Net.Analysis.CharFilters
                             {
                                 lookahead++;
 
-                                if (arc.Final)
+                                if (arc.IsFinal)
                                 {
                                     // Match! (to node is final)
                                     lastMatchLen = lookahead;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 6d0ed19..9571a31 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Analysis.CharFilters
                         {
                             Debug.Assert(scratchArc.Label != FST<CharsRef>.END_LABEL); // LUCENENET TODO END_LABEL shouldn't be under generic?
                             cachedRootArcs[Convert.ToChar((char)scratchArc.Label)] = (new FST.Arc<CharsRef>()).CopyFrom(scratchArc);
-                            if (scratchArc.Last)
+                            if (scratchArc.IsLast)
                             {
                                 break;
                             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 e9fc124..e27b433 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
@@ -1190,7 +1190,7 @@ namespace Lucene.Net.Analysis.Hunspell
                     {
                         output = fst.Outputs.Add(output, arc.Output);
                     }
-                    if (arc.Final)
+                    if (arc.IsFinal)
                     {
                         longestOutput = fst.Outputs.Add(output, arc.NextFinalOutput);
                         longestMatch = j;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
index 0db4da9..d087551 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
@@ -144,7 +144,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
                     pendingOutput = fst.Outputs.Add(pendingOutput, scratchArc.Output);
                     bufUpto += Character.CharCount(codePoint);
                 }
-                if (scratchArc.Final)
+                if (scratchArc.IsFinal)
                 {
                     matchOutput = fst.Outputs.Add(pendingOutput, scratchArc.NextFinalOutput);
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs
index d2fb3c8..1617259 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs
@@ -437,7 +437,7 @@ namespace Lucene.Net.Analysis.Synonym
 
                 // OK, entire token matched; now see if this is a final
                 // state:
-                if (scratchArc.Final)
+                if (scratchArc.IsFinal)
                 {
                     matchOutput = fst.Outputs.Add(pendingOutput, scratchArc.NextFinalOutput);
                     matchInputLength = tokenCount;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
index 5e082dc..7f3f35b 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -824,7 +824,7 @@ namespace Lucene.Net.Codecs.Memory
                     {
                         return null;
                     }
-                    while (!frame.arc.Last)
+                    while (!frame.arc.IsLast)
                     {
                         frame.arc = fst.ReadNextRealArc(frame.arc, fstReader);
                         frame.state = fsa.Step(top.state, frame.arc.Label);
@@ -864,7 +864,7 @@ namespace Lucene.Net.Codecs.Memory
 
                 private bool IsAccept(Frame frame) // reach a term both fst&fsa accepts
                 {
-                    return fsa.IsAccept(frame.state) && frame.arc.Final;
+                    return fsa.IsAccept(frame.state) && frame.arc.IsFinal;
                 }
 
                 private bool IsValid(Frame frame) // reach a prefix both fst&fsa won't reject
@@ -879,7 +879,7 @@ namespace Lucene.Net.Codecs.Memory
 
                 private bool CanRewind(Frame frame) // can jump to sibling
                 {
-                    return !frame.arc.Last;
+                    return !frame.arc.IsLast;
                 }
 
                 private void PushFrame(Frame frame)
@@ -974,7 +974,7 @@ namespace Lucene.Net.Codecs.Memory
                     while (true)
                     {
                         queue.Add((new FST.Arc<T>()).CopyFrom(arc));
-                        if (arc.Last)
+                        if (arc.IsLast)
                         {
                             break;
                         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
index 011eed6..79e0365 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -582,7 +582,7 @@ namespace Lucene.Net.Codecs.Memory
                         next.Output = fstOutputs.Add(next.Output, last.Output);
                         last = next;
                     }
-                    if (last.Final)
+                    if (last.IsFinal)
                     {
                         meta = fstOutputs.Add(last.Output, last.NextFinalOutput);
                     }
@@ -738,7 +738,7 @@ namespace Lucene.Net.Codecs.Memory
                     {
                         return null;
                     }
-                    while (!frame.fstArc.Last)
+                    while (!frame.fstArc.IsLast)
                     {
                         frame.fstArc = fst.ReadNextRealArc(frame.fstArc, fstReader);
                         frame.fsaState = fsa.Step(top.fsaState, frame.fstArc.Label);
@@ -778,7 +778,7 @@ namespace Lucene.Net.Codecs.Memory
 
                 internal bool IsAccept(Frame frame) // reach a term both fst&fsa accepts
                 {
-                    return fsa.IsAccept(frame.fsaState) && frame.fstArc.Final;
+                    return fsa.IsAccept(frame.fsaState) && frame.fstArc.IsFinal;
                 }
                 internal bool IsValid(Frame frame) // reach a prefix both fst&fsa won't reject
                 {
@@ -790,7 +790,7 @@ namespace Lucene.Net.Codecs.Memory
                 }
                 internal bool CanRewind(Frame frame) // can jump to sibling
                 {
-                    return !frame.fstArc.Last;
+                    return !frame.fstArc.IsLast;
                 }
 
                 internal void PushFrame(Frame frame)
@@ -882,7 +882,7 @@ namespace Lucene.Net.Codecs.Memory
                     while (true)
                     {
                         queue.Add((new FST.Arc<T>()).CopyFrom(arc));
-                        if (arc.Last)
+                        if (arc.IsLast)
                         {
                             break;
                         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 154d23c..8ae85d3 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
@@ -1073,7 +1073,7 @@ namespace Lucene.Net.Codecs
 
                     FST<BytesRef>.Arc<BytesRef> arc = outerInstance.Index.GetFirstArc(Arcs[0]);
                     // Empty string prefix must have an output in the index!
-                    Debug.Assert(arc.Final);
+                    Debug.Assert(arc.IsFinal);
 
                     // Special pushFrame since it's the first one:
                     Frame f = Stack[0];
@@ -1169,7 +1169,7 @@ namespace Lucene.Net.Codecs
 
                     f.Arc = arc;
                     f.OutputPrefix = output;
-                    Debug.Assert(arc.Final);
+                    Debug.Assert(arc.IsFinal);
                     f.Load(OuterInstance.OuterInstance.FstOutputs.Add(output, arc.NextFinalOutput));
                     return f;
                 }
@@ -1578,7 +1578,7 @@ namespace Lucene.Net.Codecs
                     {
                         arc = outerInstance.Index.GetFirstArc(Arcs[0]);
                         // Empty string prefix must have an output in the index!
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                     }
                     else
                     {
@@ -1626,7 +1626,7 @@ namespace Lucene.Net.Codecs
                     {
                         arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
                         // Empty string prefix must have an output in the index!
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                     }
                     else
                     {
@@ -1701,7 +1701,7 @@ namespace Lucene.Net.Codecs
                     {
                         arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
                         // Empty string prefix must have an output in the index!
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                     }
                     else
                     {
@@ -1861,7 +1861,7 @@ namespace Lucene.Net.Codecs
                         // }
 
                         arc = Arcs[0];
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                         output = arc.Output;
                         targetUpto = 0;
 
@@ -1895,7 +1895,7 @@ namespace Lucene.Net.Codecs
                             {
                                 output = OuterInstance.OuterInstance.FstOutputs.Add(output, arc.Output);
                             }
-                            if (arc.Final)
+                            if (arc.IsFinal)
                             {
                                 lastFrame = Stack[1 + lastFrame.Ord];
                             }
@@ -1982,7 +1982,7 @@ namespace Lucene.Net.Codecs
                         arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
 
                         // Empty string prefix must have an output (block) in the index!
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                         Debug.Assert(arc.Output != null);
 
                         // if (DEBUG) {
@@ -2066,7 +2066,7 @@ namespace Lucene.Net.Codecs
                             // }
                             targetUpto++;
 
-                            if (arc.Final)
+                            if (arc.IsFinal)
                             {
                                 //if (DEBUG) System.out.println("    arc is final!");
                                 CurrentFrame = PushFrame(arc, OuterInstance.OuterInstance.FstOutputs.Add(output, arc.NextFinalOutput), targetUpto);
@@ -2150,7 +2150,7 @@ namespace Lucene.Net.Codecs
                         //}
 
                         arc = Arcs[0];
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                         output = arc.Output;
                         targetUpto = 0;
 
@@ -2186,7 +2186,7 @@ namespace Lucene.Net.Codecs
                             {
                                 output = OuterInstance.OuterInstance.FstOutputs.Add(output, arc.Output);
                             }
-                            if (arc.Final)
+                            if (arc.IsFinal)
                             {
                                 lastFrame = Stack[1 + lastFrame.Ord];
                             }
@@ -2267,7 +2267,7 @@ namespace Lucene.Net.Codecs
                         arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
 
                         // Empty string prefix must have an output (block) in the index!
-                        Debug.Assert(arc.Final);
+                        Debug.Assert(arc.IsFinal);
                         Debug.Assert(arc.Output != null);
 
                         //if (DEBUG) {
@@ -2353,7 +2353,7 @@ namespace Lucene.Net.Codecs
                             //}
                             targetUpto++;
 
-                            if (arc.Final)
+                            if (arc.IsFinal)
                             {
                                 //if (DEBUG) System.out.println("    arc is final!");
                                 CurrentFrame = PushFrame(arc, OuterInstance.OuterInstance.FstOutputs.Add(output, arc.NextFinalOutput), targetUpto);
@@ -2474,7 +2474,7 @@ namespace Lucene.Net.Codecs
                         {
                             arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
                             // Empty string prefix must have an output in the index!
-                            Debug.Assert(arc.Final);
+                            Debug.Assert(arc.IsFinal);
                         }
                         else
                         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 bfcf269..a566625 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -554,7 +554,7 @@ namespace Lucene.Net.Util.Fst
             for (int arcIdx = 0; arcIdx < node.NumArcs; arcIdx++)
             {
                 Arc<T> arc = node.Arcs[arcIdx];
-                if (!arc.Target.Compiled)
+                if (!arc.Target.IsCompiled)
                 {
                     // not yet compiled
                     UnCompiledNode<T> n = (UnCompiledNode<T>)arc.Target;
@@ -585,7 +585,7 @@ namespace Lucene.Net.Util.Fst
 
         public interface Node
         {
-            bool Compiled { get; }
+            bool IsCompiled { get; }
         }
 
         public virtual long FstSizeInBytes()
@@ -597,7 +597,7 @@ namespace Lucene.Net.Util.Fst
         {
             public long Node;
 
-            public bool Compiled
+            public bool IsCompiled
             {
                 get
                 {
@@ -640,7 +640,7 @@ namespace Lucene.Net.Util.Fst
                 this.Depth = depth;
             }
 
-            public bool Compiled
+            public bool IsCompiled
             {
                 get
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
index 471cd68..b23da69 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
@@ -490,9 +490,9 @@ namespace Lucene.Net.Util.Fst
                 }
             }
 
-            public override bool Reversed()
+            public override bool IsReversed
             {
-                return false;
+                get { return false; }
             }
         }
 
@@ -572,9 +572,9 @@ namespace Lucene.Net.Util.Fst
                 }
             }
 
-            public override bool Reversed()
+            public override bool IsReversed
             {
-                return true;
+                get { return true; }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 0a21a54..d5f53c3 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -409,7 +409,7 @@ namespace Lucene.Net.Util.Fst
                     {
                         break;
                     }
-                    if (arc.Last)
+                    if (arc.IsLast)
                     {
                         break;
                     }
@@ -935,7 +935,7 @@ namespace Lucene.Net.Util.Fst
             if (!TargetHasArcs(follow))
             {
                 //System.out.println("  end node");
-                Debug.Assert(follow.Final);
+                Debug.Assert(follow.IsFinal);
                 arc.Label = END_LABEL;
                 arc.Target = FINAL_END_NODE;
                 arc.Output = follow.NextFinalOutput;
@@ -969,7 +969,7 @@ namespace Lucene.Net.Util.Fst
                     // non-array: linear scan
                     arc.BytesPerArc = 0;
                     //System.out.println("  scan");
-                    while (!arc.Last)
+                    while (!arc.IsLast)
                     {
                         // skip this arc:
                         ReadLabel(@in);
@@ -1002,7 +1002,7 @@ namespace Lucene.Net.Util.Fst
                     arc.NextArc = @in.Position;
                 }
                 ReadNextRealArc(arc, @in);
-                Debug.Assert(arc.Last);
+                Debug.Assert(arc.IsLast);
                 return arc;
             }
         }
@@ -1031,7 +1031,7 @@ namespace Lucene.Net.Util.Fst
         {
             //int pos = address;
             //System.out.println("    readFirstTarget follow.target=" + follow.Target + " isFinal=" + follow.isFinal());
-            if (follow.Final)
+            if (follow.IsFinal)
             {
                 // Insert "fake" final first arc:
                 arc.Label = END_LABEL;
@@ -1136,7 +1136,7 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         public int ReadNextArcLabel(Arc<T> arc, BytesReader @in)
         {
-            Debug.Assert(!arc.Last);
+            Debug.Assert(!arc.IsLast);
 
             if (arc.Label == END_LABEL)
             {
@@ -1317,7 +1317,7 @@ namespace Lucene.Net.Util.Fst
         {
             if (labelToMatch == END_LABEL)
             {
-                if (follow.Final)
+                if (follow.IsFinal)
                 {
                     if (follow.Target <= 0)
                     {
@@ -1429,7 +1429,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     return null;
                 }
-                else if (arc.Last)
+                else if (arc.IsLast)
                 {
                     return null;
                 }
@@ -1554,7 +1554,7 @@ namespace Lucene.Net.Util.Fst
                 /// Returns true if this reader uses reversed bytes
                 ///  under-the-hood.
                 /// </summary>
-                public abstract bool Reversed();
+                public abstract bool IsReversed { get; }
 
                 /// <summary>
                 /// Skips bytes. </summary>
@@ -1874,7 +1874,7 @@ namespace Lucene.Net.Util.Fst
 
                             sbyte flags = 0;
 
-                            if (arc.Last)
+                            if (arc.IsLast)
                             {
                                 flags += (sbyte)BIT_LAST_ARC;
                             }
@@ -1891,7 +1891,7 @@ namespace Lucene.Net.Util.Fst
                                     nextCount++;
                                 }
                             }
-                            if (arc.Final)
+                            if (arc.IsFinal)
                             {
                                 flags += (sbyte)BIT_FINAL_ARC;
                                 if (!arc.NextFinalOutput.Equals(NO_OUTPUT))
@@ -2021,7 +2021,7 @@ namespace Lucene.Net.Util.Fst
                                 writer.SkipBytes((int)(arcStartPos + bytesPerArc - writer.Position));
                             }
 
-                            if (arc.Last)
+                            if (arc.IsLast)
                             {
                                 break;
                             }
@@ -2254,7 +2254,7 @@ namespace Lucene.Net.Util.Fst
             /// under-the-hood.
             /// </summary>
             /// <returns></returns>
-            public abstract bool Reversed();
+            public abstract bool IsReversed { get; }
 
             /// <summary>
             /// Skips bytes.
@@ -2333,12 +2333,12 @@ namespace Lucene.Net.Util.Fst
                 return FST<T>.Flag(Flags, flag);
             }
 
-            public bool Last
+            public bool IsLast
             {
                 get { return Flag(BIT_LAST_ARC); }
             }
 
-            public bool Final
+            public bool IsFinal
             {
                 get { return Flag(BIT_FINAL_ARC); }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 93469ce..3e19974 100644
--- a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Util.Fst
             {
                 // pop
                 //System.out.println("  check pop curArc target=" + arcs[upto].target + " label=" + arcs[upto].label + " isLast?=" + arcs[upto].isLast());
-                while (Arcs[Upto].Last)
+                while (Arcs[Upto].IsLast)
                 {
                     Upto--;
                     if (Upto == 0)
@@ -218,7 +218,7 @@ namespace Lucene.Net.Util.Fst
                         // Dead end
                         arc.ArcIdx = arc.NumArcs - 2;
                         Fst.ReadNextRealArc(arc, @in);
-                        Debug.Assert(arc.Last);
+                        Debug.Assert(arc.IsLast);
                         // Dead end (target is after the last arc);
                         // rollback to last fork then push
                         Upto--;
@@ -230,7 +230,7 @@ namespace Lucene.Net.Util.Fst
                             }
                             FST<T>.Arc<T> prevArc = GetArc(Upto);
                             //System.out.println("  rollback upto=" + upto + " arc.label=" + prevArc.label + " isLast?=" + prevArc.isLast());
-                            if (!prevArc.Last)
+                            if (!prevArc.IsLast)
                             {
                                 Fst.ReadNextArc(prevArc, FstReader);
                                 PushFirst();
@@ -269,7 +269,7 @@ namespace Lucene.Net.Util.Fst
                         PushFirst();
                         return;
                     }
-                    else if (arc.Last)
+                    else if (arc.IsLast)
                     {
                         // Dead end (target is after the last arc);
                         // rollback to last fork then push
@@ -282,7 +282,7 @@ namespace Lucene.Net.Util.Fst
                             }
                             FST<T>.Arc<T> prevArc = GetArc(Upto);
                             //System.out.println("  rollback upto=" + upto + " arc.label=" + prevArc.label + " isLast?=" + prevArc.isLast());
-                            if (!prevArc.Last)
+                            if (!prevArc.IsLast)
                             {
                                 Fst.ReadNextArc(prevArc, FstReader);
                                 PushFirst();
@@ -401,7 +401,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 // Then, scan forwards to the arc just before
                                 // the targetLabel:
-                                while (!arc.Last && Fst.ReadNextArcLabel(arc, @in) < targetLabel)
+                                while (!arc.IsLast && Fst.ReadNextArcLabel(arc, @in) < targetLabel)
                                 {
                                     Fst.ReadNextArc(arc, FstReader);
                                 }
@@ -423,7 +423,7 @@ namespace Lucene.Net.Util.Fst
                         arc.ArcIdx = (low > high ? high : low) - 1;
                         //System.out.println(" hasFloor arcIdx=" + (arc.arcIdx+1));
                         Fst.ReadNextRealArc(arc, @in);
-                        Debug.Assert(arc.Last || Fst.ReadNextArcLabel(arc, @in) > targetLabel);
+                        Debug.Assert(arc.IsLast || Fst.ReadNextArcLabel(arc, @in) > targetLabel);
                         Debug.Assert(arc.Label < targetLabel, "arc.label=" + arc.Label + " vs targetLabel=" + targetLabel);
                         PushLast();
                         return;
@@ -459,7 +459,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 // Then, scan forwards to the arc just before
                                 // the targetLabel:
-                                while (!arc.Last && Fst.ReadNextArcLabel(arc, FstReader) < targetLabel)
+                                while (!arc.IsLast && Fst.ReadNextArcLabel(arc, FstReader) < targetLabel)
                                 {
                                     Fst.ReadNextArc(arc, FstReader);
                                 }
@@ -475,7 +475,7 @@ namespace Lucene.Net.Util.Fst
                             arc = GetArc(Upto);
                         }
                     }
-                    else if (!arc.Last)
+                    else if (!arc.IsLast)
                     {
                         //System.out.println("  check next label=" + fst.readNextArcLabel(arc) + " (" + (char) fst.readNextArcLabel(arc) + ")");
                         if (Fst.ReadNextArcLabel(arc, FstReader) > targetLabel)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 b8e597b..039e386 100644
--- a/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
@@ -62,9 +62,9 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        public override bool Reversed()
+        public override bool IsReversed
         {
-            return false;
+            get { return false; }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 ad8f2d3..ca92deb 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -51,12 +51,12 @@ namespace Lucene.Net.Util.Fst
             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.Final)
+                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.Last)
+                if (ScratchArc.IsLast)
                 {
                     if (arcUpto == node.NumArcs - 1)
                     {
@@ -157,11 +157,11 @@ namespace Lucene.Net.Util.Fst
                     h = PRIME * h + ScratchArc.NextFinalOutput.GetHashCode();
                 }
 
-                if (ScratchArc.Final)
+                if (ScratchArc.IsFinal)
                 {
                     h += 17;
                 }
-                if (ScratchArc.Last)
+                if (ScratchArc.IsLast)
                 {
                     break;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 65e60f6..3f68547 100644
--- a/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
@@ -59,9 +59,9 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        public override bool Reversed()
+        public override bool IsReversed
         {
-            return true;
+            get { return true; }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 00d2507..749f209 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -62,7 +62,7 @@ namespace Lucene.Net.Util.Fst
                 output = fst.Outputs.Add(output, arc.Output);
             }
 
-            if (arc.Final)
+            if (arc.IsFinal)
             {
                 return fst.Outputs.Add(output, arc.NextFinalOutput);
             }
@@ -98,7 +98,7 @@ namespace Lucene.Net.Util.Fst
                 output = fst.Outputs.Add(output, arc.Output);
             }
 
-            if (arc.Final)
+            if (arc.IsFinal)
             {
                 return fst.Outputs.Add(output, arc.NextFinalOutput);
             }
@@ -150,7 +150,7 @@ namespace Lucene.Net.Util.Fst
             while (true)
             {
                 //System.out.println("loop: output=" + output + " upto=" + upto + " arc=" + arc);
-                if (arc.Final)
+                if (arc.IsFinal)
                 {
                     long finalOutput = output + arc.NextFinalOutput.Value;
                     //System.out.println("  isFinal finalOutput=" + finalOutput);
@@ -270,7 +270,7 @@ namespace Lucene.Net.Util.Fst
                                     break;
                                 }
                             }
-                            else if (arc.Last)
+                            else if (arc.IsLast)
                             {
                                 // Recurse on this arc:
                                 output = minArcOutput;
@@ -465,7 +465,7 @@ namespace Lucene.Net.Util.Fst
                     {
                         AddIfCompetitive(path);
                     }
-                    if (path.Arc.Last)
+                    if (path.Arc.IsLast)
                     {
                         break;
                     }
@@ -572,7 +572,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 AddIfCompetitive(path);
                             }
-                            if (path.Arc.Last)
+                            if (path.Arc.IsLast)
                             {
                                 break;
                             }
@@ -777,7 +777,7 @@ namespace Lucene.Net.Util.Fst
 
                 bool isFinal;
                 T finalOutput;
-                if (startArc.Final)
+                if (startArc.IsFinal)
                 {
                     isFinal = true;
                     finalOutput = startArc.NextFinalOutput.Equals(NO_OUTPUT) ? default(T) : startArc.NextFinalOutput;
@@ -875,7 +875,7 @@ namespace Lucene.Net.Util.Fst
                                 outs = "";
                             }
 
-                            if (!FST<T>.TargetHasArcs(arc) && arc.Final && !arc.NextFinalOutput.Equals(NO_OUTPUT))
+                            if (!FST<T>.TargetHasArcs(arc) && arc.IsFinal && !arc.NextFinalOutput.Equals(NO_OUTPUT))
                             {
                                 // Tricky special case: sometimes, due to
                                 // pruning, the builder can [sillily] produce
@@ -897,10 +897,10 @@ namespace Lucene.Net.Util.Fst
                             }
 
                             Debug.Assert(arc.Label != FST<T>.END_LABEL);
-                            @out.Write("  " + node + " -> " + arc.Target + " [label=\"" + PrintableLabel(arc.Label) + outs + "\"" + (arc.Final ? " style=\"bold\"" : "") + " color=\"" + arcColor + "\"]\n");
+                            @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.
-                            if (arc.Last)
+                            if (arc.IsLast)
                             {
                                 //System.out.println("    break");
                                 break;
@@ -1071,7 +1071,7 @@ namespace Lucene.Net.Util.Fst
             // 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 (follow.Final)
+                if (follow.IsFinal)
                 {
                     if (follow.Target <= 0)
                     {
@@ -1156,7 +1156,7 @@ namespace Lucene.Net.Util.Fst
                     // System.out.println("    found!");
                     return arc;
                 }
-                else if (arc.Last)
+                else if (arc.IsLast)
                 {
                     return null;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/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 4a38575..e5d6f84 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -274,7 +274,7 @@ namespace Lucene.Net.Util.Fst
                 // read all arcs:
                 fst.ReadFirstTargetArc(arc, arc, fstReader);
                 arcs.Add((new FST.Arc<T>()).CopyFrom(arc));
-                while (!arc.Last)
+                while (!arc.IsLast)
                 {
                     fst.ReadNextArc(arc, fstReader);
                     arcs.Add((new FST.Arc<T>()).CopyFrom(arc));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
index ec5b8e6..a07fdcf 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
@@ -286,7 +286,7 @@ namespace Lucene.Net.Util.Fst
                 }
                 // reversed
                 FST.BytesReader r2 = bytes.ReverseReader;
-                Assert.IsTrue(r2.Reversed());
+                Assert.IsTrue(r2.IsReversed);
                 r2.Position = totalLength - 1;
                 r2.ReadBytes(actual, 0, actual.Length);
                 int start = 0;
@@ -308,7 +308,7 @@ namespace Lucene.Net.Util.Fst
                     Console.WriteLine("    bulk: forward");
                 }
                 FST.BytesReader r3 = bytes.ForwardReader;
-                Assert.IsFalse(r3.Reversed());
+                Assert.IsFalse(r3.IsReversed);
                 r3.ReadBytes(actual, 0, actual.Length);
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/510413ce/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
index 2cabfd2..2e972ad 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
@@ -1319,7 +1319,7 @@ namespace Lucene.Net.Util.Fst
                         int children = VerifyStateAndBelow(fst, new FST.Arc<object>().CopyFrom(arc), depth + 1);
 
                         Assert.AreEqual(expanded, (depth <= FST.FIXED_ARRAY_SHALLOW_DISTANCE && children >= FST.FIXED_ARRAY_NUM_ARCS_SHALLOW) || children >= FST.FIXED_ARRAY_NUM_ARCS_DEEP);
-                        if (arc.Last)
+                        if (arc.IsLast)
                         {
                             break;
                         }
@@ -1437,11 +1437,11 @@ namespace Lucene.Net.Util.Fst
             FST.Arc<long?> arc = fst.ReadFirstTargetArc(startArc, new FST.Arc<long?>(), fst.BytesReader);
             Assert.AreEqual('a', arc.Label);
             Assert.AreEqual(17, arc.NextFinalOutput);
-            Assert.IsTrue(arc.Final);
+            Assert.IsTrue(arc.IsFinal);
 
             arc = fst.ReadNextArc(arc, fst.BytesReader);
             Assert.AreEqual('b', arc.Label);
-            Assert.IsFalse(arc.Final);
+            Assert.IsFalse(arc.IsFinal);
             Assert.AreEqual(42, arc.Output);
         }
 


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

Posted by sy...@apache.org.
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;
                 }


[06/49] lucenenet git commit: Ported Core.Util.Fst.TestFSTs

Posted by sy...@apache.org.
Ported Core.Util.Fst.TestFSTs


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

Branch: refs/heads/master
Commit: 3da18fb7d9101d42fedc5932fb22afc7254c52a4
Parents: 297f926
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Sep 6 18:55:43 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:47 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/FST.cs             |   6 +-
 .../Util/fst/FSTTester.cs                       |  16 +-
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |   1 +
 src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs  | 311 ++++++++++---------
 4 files changed, 169 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3da18fb7/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 74beb96..0a21a54 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -902,16 +902,16 @@ namespace Lucene.Net.Util.Fst
         {
             if (emptyOutput != null)
             {
-                arc.Flags = (sbyte)(BIT_FINAL_ARC | BIT_LAST_ARC);
+                arc.Flags = BIT_FINAL_ARC | BIT_LAST_ARC;
                 arc.NextFinalOutput = emptyOutput;
                 if (!emptyOutput.Equals(NO_OUTPUT))
                 {
-                    arc.Flags |= (sbyte)BIT_ARC_HAS_FINAL_OUTPUT;
+                    arc.Flags |= BIT_ARC_HAS_FINAL_OUTPUT;
                 }
             }
             else
             {
-                arc.Flags = (sbyte)BIT_LAST_ARC;
+                arc.Flags = BIT_LAST_ARC;
                 arc.NextFinalOutput = NO_OUTPUT;
             }
             arc.Output = NO_OUTPUT;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3da18fb7/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 3e05e6d..4a38575 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -346,9 +346,10 @@ namespace Lucene.Net.Util.Fst
             if (Random.NextBoolean() && fst != null && !willRewrite)
             {
                 IOContext context = LuceneTestCase.NewIOContext(Random);
-                IndexOutput @out = Dir.CreateOutput("fst.bin", context);
-                fst.Save(@out);
-                @out.Dispose();
+                using (IndexOutput @out = Dir.CreateOutput("fst.bin", context))
+                {
+                    fst.Save(@out);
+                }
                 IndexInput @in = Dir.OpenInput("fst.bin", context);
                 try
                 {
@@ -363,9 +364,10 @@ namespace Lucene.Net.Util.Fst
 
             if (LuceneTestCase.VERBOSE && Pairs.Count <= 20 && fst != null)
             {
-                TextWriter w = new StreamWriter(new FileStream("out.dot", FileMode.Open), IOUtils.CHARSET_UTF_8);
-                Util.ToDot(fst, w, false, false);
-                w.Close();
+                using (TextWriter w = new StreamWriter(new FileStream("out.dot", FileMode.OpenOrCreate), IOUtils.CHARSET_UTF_8))
+                {
+                    Util.ToDot(fst, w, false, false);
+                }
                 Console.WriteLine("SAVED out.dot");
             }
 
@@ -829,7 +831,7 @@ namespace Lucene.Net.Util.Fst
                 for (int idx = 0; idx <= pair.Input.Length; idx++)
                 {
                     scratch.Length = idx;
-                    CountMinOutput<T> cmo = prefixes[scratch];
+                    CountMinOutput<T> cmo = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
                     if (cmo == null)
                     {
                         cmo = new CountMinOutput<T>();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3da18fb7/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 582a278..f030b0d 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -462,6 +462,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="core\Util\Fst\TestBytesStore.cs" />
+    <Compile Include="core\Util\Fst\TestFSTs.cs" />
     <Compile Include="core\Util\Packed\TestEliasFanoDocIdSet.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3da18fb7/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
index 553e071..2cabfd2 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
@@ -8,7 +8,6 @@ using Lucene.Net.Randomized.Generators;
 
 namespace Lucene.Net.Util.Fst
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -27,8 +26,8 @@ namespace Lucene.Net.Util.Fst
      */
 
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
-    using Document = Lucene.Net.Document.Document;
-    using Field = Lucene.Net.Document.Field;
+    using Document = Lucene.Net.Documents.Document;
+    using Field = Lucene.Net.Documents.Field;
     using DirectoryReader = Lucene.Net.Index.DirectoryReader;
     using IndexReader = Lucene.Net.Index.IndexReader;
     using IndexWriter = Lucene.Net.Index.IndexWriter;
@@ -54,12 +53,13 @@ namespace Lucene.Net.Util.Fst
     //using InputOutput = Lucene.Net.Util.Fst.BytesRefFSTEnum.InputOutput;
     //using Arc = Lucene.Net.Util.Fst.FST.Arc;
     using BytesReader = Lucene.Net.Util.Fst.FST.BytesReader;
-    using Pair = Lucene.Net.Util.Fst.PairOutputs<long, long>.Pair<long, long>;
-    using ResultLong = Lucene.Net.Util.Fst.Util.Result<long>;
-    using ResultPair = Lucene.Net.Util.Fst.Util.Result<long>;
+    using Pair = Lucene.Net.Util.Fst.PairOutputs<long?, long?>.Pair;
+    //using ResultLong = Lucene.Net.Util.Fst.Util.Result<long?>;
+    //using ResultPair = Lucene.Net.Util.Fst.Util.Result<long?>;
     using PackedInts = Lucene.Net.Util.Packed.PackedInts;
     using Lucene.Net.Support;
     using NUnit.Framework;
+    using System.Globalization;
 
     /*
     import static Lucene.Net.Util.Fst.FSTTester.GetRandomString;
@@ -107,11 +107,11 @@ namespace Lucene.Net.Util.Fst
 
                 for (int idx = 0; idx < strings.Length; idx++)
                 {
-                    terms[idx] = ToIntsRef(strings[idx], inputMode);
+                    terms[idx] = FSTTester<object>.ToIntsRef(strings[idx], inputMode);
                 }
                 for (int idx = 0; idx < strings2.Length; idx++)
                 {
-                    terms2[idx] = ToIntsRef(strings2[idx], inputMode);
+                    terms2[idx] = FSTTester<object>.ToIntsRef(strings2[idx], inputMode);
                 }
                 Array.Sort(terms2);
 
@@ -123,7 +123,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     Outputs<object> outputs = NoOutputs.Singleton;
                     object NO_OUTPUT = outputs.NoOutput;
-                    IList<FSTTester<object>.InputOutput<object>> pairs = new List<FSTTester<object>.InputOutput<object>>(terms2.Length);
+                    List<FSTTester<object>.InputOutput<object>> pairs = new List<FSTTester<object>.InputOutput<object>>(terms2.Length);
                     foreach (IntsRef term in terms2)
                     {
                         pairs.Add(new FSTTester<object>.InputOutput<object>(term, NO_OUTPUT));
@@ -137,12 +137,12 @@ namespace Lucene.Net.Util.Fst
                 // FST ord pos int
                 {
                     PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-                    IList<FSTTester<long>.InputOutput<long>> pairs = new List<FSTTester<long>.InputOutput<long>>(terms2.Length);
+                    List<FSTTester<long?>.InputOutput<long?>> pairs = new List<FSTTester<long?>.InputOutput<long?>>(terms2.Length);
                     for (int idx = 0; idx < terms2.Length; idx++)
                     {
-                        pairs.Add(new FSTTester<long>.InputOutput<long>(terms2[idx], (long)idx));
+                        pairs.Add(new FSTTester<long?>.InputOutput<long?>(terms2[idx], (long?)idx));
                     }
-                    FST<long> fst = (new FSTTester<long>(Random(), Dir, inputMode, pairs, outputs, true)).DoTest(0, 0, false);
+                    FST<long?> fst = (new FSTTester<long?>(Random(), Dir, inputMode, pairs, outputs, true)).DoTest(0, 0, false);
                     Assert.IsNotNull(fst);
                     Assert.AreEqual(22, fst.NodeCount);
                     Assert.AreEqual(27, fst.ArcCount);
@@ -152,7 +152,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     ByteSequenceOutputs outputs = ByteSequenceOutputs.Singleton;
                     BytesRef NO_OUTPUT = outputs.NoOutput;
-                    IList<FSTTester<BytesRef>.InputOutput<BytesRef>> pairs = new List<FSTTester<BytesRef>.InputOutput<BytesRef>>(terms2.Length);
+                    List<FSTTester<BytesRef>.InputOutput<BytesRef>> pairs = new List<FSTTester<BytesRef>.InputOutput<BytesRef>>(terms2.Length);
                     for (int idx = 0; idx < terms2.Length; idx++)
                     {
                         BytesRef output = Random().Next(30) == 17 ? NO_OUTPUT : new BytesRef(Convert.ToString(idx));
@@ -175,7 +175,7 @@ namespace Lucene.Net.Util.Fst
             {
                 Outputs<object> outputs = NoOutputs.Singleton;
                 object NO_OUTPUT = outputs.NoOutput;
-                IList<FSTTester<object>.InputOutput<object>> pairs = new List<FSTTester<object>.InputOutput<object>>(terms.Length);
+                List<FSTTester<object>.InputOutput<object>> pairs = new List<FSTTester<object>.InputOutput<object>>(terms.Length);
                 foreach (IntsRef term in terms)
                 {
                     pairs.Add(new FSTTester<object>.InputOutput<object>(term, NO_OUTPUT));
@@ -186,51 +186,51 @@ namespace Lucene.Net.Util.Fst
             // PositiveIntOutput (ord)
             {
                 PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-                IList<FSTTester<long>.InputOutput<long>> pairs = new List<FSTTester<long>.InputOutput<long>>(terms.Length);
+                List<FSTTester<long?>.InputOutput<long?>> pairs = new List<FSTTester<long?>.InputOutput<long?>>(terms.Length);
                 for (int idx = 0; idx < terms.Length; idx++)
                 {
-                    pairs.Add(new FSTTester<long>.InputOutput<long>(terms[idx], (long)idx));
+                    pairs.Add(new FSTTester<long?>.InputOutput<long?>(terms[idx], (long?)idx));
                 }
-                (new FSTTester<long>(Random(), Dir, inputMode, pairs, outputs, true)).DoTest(true);
+                (new FSTTester<long?>(Random(), Dir, inputMode, pairs, outputs, true)).DoTest(true);
             }
 
             // PositiveIntOutput (random monotonically increasing positive number)
             {
                 PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-                IList<FSTTester<long>.InputOutput<long>> pairs = new List<FSTTester<long>.InputOutput<long>>(terms.Length);
+                List<FSTTester<long?>.InputOutput<long?>> pairs = new List<FSTTester<long?>.InputOutput<long?>>(terms.Length);
                 long lastOutput = 0;
                 for (int idx = 0; idx < terms.Length; idx++)
                 {
                     long value = lastOutput + TestUtil.NextInt(Random(), 1, 1000);
                     lastOutput = value;
-                    pairs.Add(new FSTTester<long>.InputOutput<long>(terms[idx], value));
+                    pairs.Add(new FSTTester<long?>.InputOutput<long?>(terms[idx], value));
                 }
-                (new FSTTester<long>(Random(), Dir, inputMode, pairs, outputs, true)).DoTest(true);
+                (new FSTTester<long?>(Random(), Dir, inputMode, pairs, outputs, true)).DoTest(true);
             }
 
             // PositiveIntOutput (random positive number)
             {
                 PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-                IList<FSTTester<long>.InputOutput<long>> pairs = new List<FSTTester<long>.InputOutput<long>>(terms.Length);
+                List<FSTTester<long?>.InputOutput<long?>> pairs = new List<FSTTester<long?>.InputOutput<long?>>(terms.Length);
                 for (int idx = 0; idx < terms.Length; idx++)
                 {
-                    pairs.Add(new FSTTester<long>.InputOutput<long>(terms[idx], TestUtil.NextLong(Random(), 0, long.MaxValue)));
+                    pairs.Add(new FSTTester<long?>.InputOutput<long?>(terms[idx], TestUtil.NextLong(Random(), 0, long.MaxValue)));
                 }
-                (new FSTTester<long>(Random(), Dir, inputMode, pairs, outputs, false)).DoTest(true);
+                (new FSTTester<long?>(Random(), Dir, inputMode, pairs, outputs, false)).DoTest(true);
             }
 
             // Pair<ord, (random monotonically increasing positive number>
             {
                 PositiveIntOutputs o1 = PositiveIntOutputs.Singleton;
                 PositiveIntOutputs o2 = PositiveIntOutputs.Singleton;
-                PairOutputs<long, long> outputs = new PairOutputs<long, long>(o1, o2);
-                IList<FSTTester<Pair>.InputOutput<Pair>> pairs = new List<FSTTester<Pair>.InputOutput<Pair>>(terms.Length);
+                PairOutputs<long?, long?> outputs = new PairOutputs<long?, long?>(o1, o2);
+                List<FSTTester<Pair>.InputOutput<Pair>> pairs = new List<FSTTester<Pair>.InputOutput<Pair>>(terms.Length);
                 long lastOutput = 0;
                 for (int idx = 0; idx < terms.Length; idx++)
                 {
                     long value = lastOutput + TestUtil.NextInt(Random(), 1, 1000);
                     lastOutput = value;
-                    pairs.Add(new FSTTester<Pair>.InputOutput<Pair>(terms[idx], outputs.NewPair((long)idx, value)));
+                    pairs.Add(new FSTTester<Pair>.InputOutput<Pair>(terms[idx], outputs.NewPair((long?)idx, value)));
                 }
                 (new FSTTester<Pair>(Random(), Dir, inputMode, pairs, outputs, false)).DoTest(true);
             }
@@ -239,7 +239,7 @@ namespace Lucene.Net.Util.Fst
             {
                 ByteSequenceOutputs outputs = ByteSequenceOutputs.Singleton;
                 BytesRef NO_OUTPUT = outputs.NoOutput;
-                IList<FSTTester<BytesRef>.InputOutput<BytesRef>> pairs = new List<FSTTester<BytesRef>.InputOutput<BytesRef>>(terms.Length);
+                List<FSTTester<BytesRef>.InputOutput<BytesRef>> pairs = new List<FSTTester<BytesRef>.InputOutput<BytesRef>>(terms.Length);
                 for (int idx = 0; idx < terms.Length; idx++)
                 {
                     BytesRef output = Random().Next(30) == 17 ? NO_OUTPUT : new BytesRef(Convert.ToString(idx));
@@ -251,7 +251,7 @@ namespace Lucene.Net.Util.Fst
             // Sequence-of-ints
             {
                 IntSequenceOutputs outputs = IntSequenceOutputs.Singleton;
-                IList<FSTTester<IntsRef>.InputOutput<IntsRef>> pairs = new List<FSTTester<IntsRef>.InputOutput<IntsRef>>(terms.Length);
+                List<FSTTester<IntsRef>.InputOutput<IntsRef>> pairs = new List<FSTTester<IntsRef>.InputOutput<IntsRef>>(terms.Length);
                 for (int idx = 0; idx < terms.Length; idx++)
                 {
                     string s = Convert.ToString(idx);
@@ -304,8 +304,8 @@ namespace Lucene.Net.Util.Fst
                     IntsRef[] terms = new IntsRef[numWords];
                     while (termsSet.Count < numWords)
                     {
-                        string term = GetRandomString(random);
-                        termsSet.Add(ToIntsRef(term, inputMode));
+                        string term = FSTTester<object>.GetRandomString(random);
+                        termsSet.Add(FSTTester<object>.ToIntsRef(term, inputMode));
                     }
                     DoTest(inputMode, termsSet.ToArray(/*new IntsRef[termsSet.Count]*/));
                 }
@@ -347,7 +347,7 @@ namespace Lucene.Net.Util.Fst
 
             bool doRewrite = Random().NextBoolean();
 
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, int.MaxValue, outputs, null, doRewrite, PackedInts.DEFAULT, true, 15);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, int.MaxValue, outputs, null, doRewrite, PackedInts.DEFAULT, true, 15);
 
             bool storeOrd = Random().NextBoolean();
             if (VERBOSE)
@@ -415,7 +415,7 @@ namespace Lucene.Net.Util.Fst
                         Console.WriteLine(ord + " terms...");
                     }
                 }
-                FST<long> fst = builder.Finish();
+                FST<long?> fst = builder.Finish();
                 if (VERBOSE)
                 {
                     Console.WriteLine("FST: " + docCount + " docs; " + ord + " terms; " + fst.NodeCount + " nodes; " + fst.ArcCount + " arcs;" + " " + fst.SizeInBytes() + " bytes");
@@ -426,11 +426,11 @@ namespace Lucene.Net.Util.Fst
                     Random random = new Random(Random().Next());
                     // Now confirm BytesRefFSTEnum and TermsEnum act the
                     // same:
-                    BytesRefFSTEnum<long> fstEnum = new BytesRefFSTEnum<long>(fst);
+                    BytesRefFSTEnum<long?> fstEnum = new BytesRefFSTEnum<long?>(fst);
                     int num = AtLeast(1000);
                     for (int iter = 0; iter < num; iter++)
                     {
-                        BytesRef randomTerm = new BytesRef(GetRandomString(random));
+                        BytesRef randomTerm = new BytesRef(FSTTester<object>.GetRandomString(random));
 
                         if (VERBOSE)
                         {
@@ -438,11 +438,11 @@ namespace Lucene.Net.Util.Fst
                         }
 
                         TermsEnum.SeekStatus seekResult = termsEnum.SeekCeil(randomTerm);
-                        BytesRefFSTEnum<long>.InputOutput<long> fstSeekResult = fstEnum.SeekCeil(randomTerm);
+                        BytesRefFSTEnum<long?>.InputOutput<long?> fstSeekResult = fstEnum.SeekCeil(randomTerm);
 
                         if (seekResult == TermsEnum.SeekStatus.END)
                         {
-                            Assert.IsNull(fstSeekResult.Equals(), "got " + (fstSeekResult == null ? "null" : fstSeekResult.Input.Utf8ToString()) + " but expected null");
+                            Assert.IsNull(fstSeekResult, "got " + (fstSeekResult == null ? "null" : fstSeekResult.Input.Utf8ToString()) + " but expected null");
                         }
                         else
                         {
@@ -472,7 +472,7 @@ namespace Lucene.Net.Util.Fst
                                     {
                                         Console.WriteLine("  end!");
                                     }
-                                    BytesRefFSTEnum<long>.InputOutput<long> nextResult = fstEnum.Next();
+                                    BytesRefFSTEnum<long?>.InputOutput<long?> nextResult = fstEnum.Next();
                                     if (nextResult != null)
                                     {
                                         Console.WriteLine("expected null but got: input=" + nextResult.Input.Utf8ToString() + " output=" + outputs.OutputToString(nextResult.Output));
@@ -538,7 +538,7 @@ namespace Lucene.Net.Util.Fst
 
             public virtual void Run(int limit, bool verify, bool verifyByOutput)
             {
-                BufferedReader @is = new BufferedReader(new InputStreamReader(new FileInputStream(WordsFileIn), StandardCharsets.UTF_8), 65536);
+                TextReader @is = new StreamReader(new FileStream(WordsFileIn, FileMode.Open), Encoding.UTF8);
                 try
                 {
                     IntsRef intsRef = new IntsRef(10);
@@ -546,18 +546,18 @@ namespace Lucene.Net.Util.Fst
                     int ord = 0;
                     while (true)
                     {
-                        string w = @is.readLine();
+                        string w = @is.ReadLine();
                         if (w == null)
                         {
                             break;
                         }
-                        ToIntsRef(w, InputMode, intsRef);
+                        FSTTester<object>.ToIntsRef(w, InputMode, intsRef);
                         Builder.Add(intsRef, GetOutput(intsRef, ord));
 
                         ord++;
                         if (ord % 500000 == 0)
                         {
-                            Console.WriteLine(string.format(Locale.ROOT, "%6.2fs: %9d...", ((DateTime.Now.Millisecond - tStart) / 1000.0), ord));
+                            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:000000.000}s: {1:000000000}...", ((DateTime.Now.Millisecond - tStart) / 1000.0), ord));
                         }
                         if (ord >= limit)
                         {
@@ -586,13 +586,13 @@ namespace Lucene.Net.Util.Fst
                     Console.WriteLine(ord + " terms; " + fst.NodeCount + " nodes; " + fst.ArcCount + " arcs; " + fst.ArcWithOutputCount + " arcs w/ output; tot size " + fst.SizeInBytes());
                     if (fst.NodeCount < 100)
                     {
-                        Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), StandardCharsets.UTF_8);
-                        Util.toDot(fst, w, false, false);
+                        TextWriter w = new StreamWriter(new FileStream("out.dot", FileMode.Create), Encoding.UTF8);
+                        Util.ToDot(fst, w, false, false);
                         w.Dispose();
                         Console.WriteLine("Wrote FST to out.dot");
                     }
 
-                    Directory dir = FSDirectory.Open(new File(DirOut));
+                    Directory dir = FSDirectory.Open(new DirectoryInfo(DirOut));
                     IndexOutput @out = dir.CreateOutput("fst.bin", IOContext.DEFAULT);
                     fst.Save(@out);
                     @out.Dispose();
@@ -616,18 +616,18 @@ namespace Lucene.Net.Util.Fst
                         for (int iter = 0; iter < 2; iter++)
                         {
                             @is.Close();
-                            @is = new BufferedReader(new InputStreamReader(new FileInputStream(WordsFileIn), StandardCharsets.UTF_8), 65536);
+                            @is = new StreamReader(new FileStream(WordsFileIn, FileMode.Open), Encoding.UTF8);
 
                             ord = 0;
                             tStart = DateTime.Now.Millisecond;
                             while (true)
                             {
-                                string w = @is.readLine();
+                                string w = @is.ReadLine();
                                 if (w == null)
                                 {
                                     break;
                                 }
-                                ToIntsRef(w, InputMode, intsRef);
+                                FSTTester<object>.ToIntsRef(w, InputMode, intsRef);
                                 if (iter == 0)
                                 {
                                     T expected = GetOutput(intsRef, ord);
@@ -644,8 +644,8 @@ namespace Lucene.Net.Util.Fst
                                 else
                                 {
                                     // Get by output
-                                    long output = GetOutput(intsRef, ord);
-                                    IntsRef actual = Util.GetByOutput((FST<T>)fst, (long)output);
+                                    long? output = GetOutput(intsRef, ord) as long?;
+                                    IntsRef actual = Util.GetByOutput(fst as FST<long?>, output.GetValueOrDefault());
                                     if (actual == null)
                                     {
                                         throw new Exception("unexpected null input from output=" + output);
@@ -812,12 +812,12 @@ namespace Lucene.Net.Util.Fst
 
         private class VisitTermsAnonymousInnerClassHelper : VisitTerms<Pair>
         {
-            private PairOutputs<long, long> Outputs;
+            private PairOutputs<long?, long?> outputs;
 
-            public VisitTermsAnonymousInnerClassHelper(string dirOut, string wordsFileIn, int inputMode, int prune, PairOutputs<long, long> outputs, bool doPack, bool noArcArrays)
+            public VisitTermsAnonymousInnerClassHelper(string dirOut, string wordsFileIn, int inputMode, int prune, PairOutputs<long?, long?> outputs, bool doPack, bool noArcArrays)
                 : base(dirOut, wordsFileIn, inputMode, prune, outputs, doPack, noArcArrays)
             {
-                this.Outputs = outputs;
+                this.outputs = outputs;
             }
 
             internal Random rand;
@@ -827,24 +827,24 @@ namespace Lucene.Net.Util.Fst
                 {
                     rand = new Random(17);
                 }
-                return Outputs.NewPair((long)ord, (long)TestUtil.NextInt(rand, 1, 5000));
+                return outputs.NewPair(ord, TestUtil.NextInt(rand, 1, 5000));
             }
         }
 
-        private class VisitTermsAnonymousInnerClassHelper2 : VisitTerms<long>
+        private class VisitTermsAnonymousInnerClassHelper2 : VisitTerms<long?>
         {
             public VisitTermsAnonymousInnerClassHelper2(string dirOut, string wordsFileIn, int inputMode, int prune, PositiveIntOutputs outputs, bool doPack, bool noArcArrays)
                 : base(dirOut, wordsFileIn, inputMode, prune, outputs, doPack, noArcArrays)
             {
             }
 
-            protected internal override long GetOutput(IntsRef input, int ord)
+            protected internal override long? GetOutput(IntsRef input, int ord)
             {
-                return (long)ord;
+                return ord;
             }
         }
 
-        private class VisitTermsAnonymousInnerClassHelper3 : VisitTerms<long>
+        private class VisitTermsAnonymousInnerClassHelper3 : VisitTerms<long?>
         {
             public VisitTermsAnonymousInnerClassHelper3(string dirOut, string wordsFileIn, int inputMode, int prune, PositiveIntOutputs outputs, bool doPack, bool noArcArrays)
                 : base(dirOut, wordsFileIn, inputMode, prune, outputs, doPack, noArcArrays)
@@ -852,7 +852,7 @@ namespace Lucene.Net.Util.Fst
             }
 
             internal Random rand;
-            protected internal override long GetOutput(IntsRef input, int ord)
+            protected internal override long? GetOutput(IntsRef input, int ord)
             {
                 if (ord == 0)
                 {
@@ -968,7 +968,7 @@ namespace Lucene.Net.Util.Fst
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
 
             // Build an FST mapping BytesRef -> Long
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, outputs);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, outputs);
 
             BytesRef a = new BytesRef("a");
             BytesRef b = new BytesRef("b");
@@ -978,28 +978,28 @@ namespace Lucene.Net.Util.Fst
             builder.Add(Util.ToIntsRef(b, new IntsRef()), 42L);
             builder.Add(Util.ToIntsRef(c, new IntsRef()), 13824324872317238L);
 
-            FST<long> fst = builder.Finish();
+            FST<long?> fst = builder.Finish();
 
-            Assert.AreEqual(13824324872317238L, (long)Util.Get(fst, c));
-            Assert.AreEqual(42, (long)Util.Get(fst, b));
-            Assert.AreEqual(17, (long)Util.Get(fst, a));
+            Assert.AreEqual(13824324872317238L, Util.Get(fst, c));
+            Assert.AreEqual(42, Util.Get(fst, b));
+            Assert.AreEqual(17, Util.Get(fst, a));
 
-            BytesRefFSTEnum<long> fstEnum = new BytesRefFSTEnum<long>(fst);
-            BytesRefFSTEnum<long>.InputOutput<long> seekResult;
+            BytesRefFSTEnum<long?> fstEnum = new BytesRefFSTEnum<long?>(fst);
+            BytesRefFSTEnum<long?>.InputOutput<long?> seekResult;
             seekResult = fstEnum.SeekFloor(a);
             Assert.IsNotNull(seekResult);
-            Assert.AreEqual(17, (long)seekResult.Output);
+            Assert.AreEqual(17, seekResult.Output);
 
             // goes to a
             seekResult = fstEnum.SeekFloor(new BytesRef("aa"));
             Assert.IsNotNull(seekResult);
-            Assert.AreEqual(17, (long)seekResult.Output);
+            Assert.AreEqual(17, seekResult.Output);
 
             // goes to b
             seekResult = fstEnum.SeekCeil(new BytesRef("aa"));
             Assert.IsNotNull(seekResult);
             Assert.AreEqual(b, seekResult.Input);
-            Assert.AreEqual(42, (long)seekResult.Output);
+            Assert.AreEqual(42, seekResult.Output);
 
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("c"), new IntsRef()), Util.GetByOutput(fst, 13824324872317238L));
             Assert.IsNull(Util.GetByOutput(fst, 47));
@@ -1036,7 +1036,7 @@ namespace Lucene.Net.Util.Fst
                     if (cycle == 0)
                     {
                         // PKs are assigned sequentially
-                        idString = string.Format(Locale.ROOT, "%07d", id);
+                        idString = string.Format(CultureInfo.InvariantCulture, "{0:0000000}", id);
                     }
                     else
                     {
@@ -1063,7 +1063,7 @@ namespace Lucene.Net.Util.Fst
                 w.Dispose();
 
                 IList<string> allIDsList = new List<string>(allIDs);
-                IList<string> sortedAllIDsList = new List<string>(allIDsList);
+                List<string> sortedAllIDsList = new List<string>(allIDsList);
                 sortedAllIDsList.Sort();
 
                 // Sprinkle in some non-existent PKs:
@@ -1073,7 +1073,7 @@ namespace Lucene.Net.Util.Fst
                     string idString;
                     if (cycle == 0)
                     {
-                        idString = string.Format(Locale.ROOT, "%07d", (NUM_IDS + idx));
+                        idString = string.Format(CultureInfo.InvariantCulture, "{0:0000000}", (NUM_IDS + idx));
                     }
                     else
                     {
@@ -1127,8 +1127,8 @@ namespace Lucene.Net.Util.Fst
                         int idv = Random().Next(NUM_IDS - 1);
                         if (cycle == 0)
                         {
-                            id = string.Format(Locale.ROOT, "%07da", idv);
-                            nextID = string.Format(Locale.ROOT, "%07d", idv + 1);
+                            id = string.Format(CultureInfo.InvariantCulture, "{0:0000000}a", idv);
+                            nextID = string.Format(CultureInfo.InvariantCulture, "{0:0000000}", idv + 1);
                         }
                         else
                         {
@@ -1183,7 +1183,8 @@ namespace Lucene.Net.Util.Fst
         {
             Directory dir = NewDirectory();
 
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetOpenMode(IndexWriterConfig.OpenMode.CREATE));
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
             Document doc = new Document();
             Field f = NewStringField("field", "", Field.Store.NO);
             doc.Add(f);
@@ -1197,7 +1198,7 @@ namespace Lucene.Net.Util.Fst
             HashSet<string> allTerms = new HashSet<string>();
             while (allTerms.Count < NUM_TERMS)
             {
-                allTerms.Add(SimpleRandomString(Random()));
+                allTerms.Add(FSTTester<object>.SimpleRandomString(Random()));
             }
 
             foreach (string term in allTerms)
@@ -1255,7 +1256,7 @@ namespace Lucene.Net.Util.Fst
             StringBuilder b = new StringBuilder();
             s.Generate(@out, b, 'a', 'i', 10);
             string[] input = @out.ToArray();
-            Arrays.sort(input);
+            Array.Sort(input);
             FST<object> fst = s.Compile(input);
             FST.Arc<object> arc = fst.GetFirstArc(new FST.Arc<object>());
             s.VerifyStateAndBelow(fst, arc, 1);
@@ -1310,10 +1311,9 @@ namespace Lucene.Net.Util.Fst
                 if (FST<object>.TargetHasArcs(arc))
                 {
                     int childCount = 0;
-                    BytesReader fstReader = fst.GetBytesReader;
-                    for (arc = fst.ReadFirstTargetArc(arc, arc, fstReader);
-                        (arc = fst.ReadNextArc(arc, fstReader)) != null;
-                        childCount++)
+                    BytesReader fstReader = fst.BytesReader;
+                    for (arc = fst.ReadFirstTargetArc(arc, arc, fstReader); ;
+                        arc = fst.ReadNextArc(arc, fstReader), childCount++)
                     {
                         bool expanded = fst.IsExpandedTarget(arc, fstReader);
                         int children = VerifyStateAndBelow(fst, new FST.Arc<object>().CopyFrom(arc), depth + 1);
@@ -1335,13 +1335,13 @@ namespace Lucene.Net.Util.Fst
         {
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
 
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE4, 2, 0, true, true, int.MaxValue, outputs, null, Random().NextBoolean(), PackedInts.DEFAULT, true, 15);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE4, 2, 0, true, true, int.MaxValue, outputs, null, Random().NextBoolean(), PackedInts.DEFAULT, true, 15);
             builder.Add(Util.ToUTF32("stat", new IntsRef()), 17L);
             builder.Add(Util.ToUTF32("station", new IntsRef()), 10L);
-            FST<long> fst = builder.Finish();
+            FST<long?> fst = builder.Finish();
             //Writer w = new OutputStreamWriter(new FileOutputStream("/x/tmp3/out.dot"));
             StringWriter w = new StringWriter();
-            Util.toDot(fst, w, false, false);
+            Util.ToDot(fst, w, false, false);
             w.Dispose();
             //System.out.println(w.toString());
             Assert.IsTrue(w.ToString().IndexOf("label=\"t/[7]\"") != -1);
@@ -1352,13 +1352,13 @@ namespace Lucene.Net.Util.Fst
         {
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
             bool willRewrite = Random().NextBoolean();
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, int.MaxValue, outputs, null, willRewrite, PackedInts.DEFAULT, true, 15);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, int.MaxValue, outputs, null, willRewrite, PackedInts.DEFAULT, true, 15);
             builder.Add(Util.ToIntsRef(new BytesRef("stat"), new IntsRef()), outputs.NoOutput);
             builder.Add(Util.ToIntsRef(new BytesRef("station"), new IntsRef()), outputs.NoOutput);
-            FST<long> fst = builder.Finish();
+            FST<long?> fst = builder.Finish();
             StringWriter w = new StringWriter();
             //Writer w = new OutputStreamWriter(new FileOutputStream("/x/tmp/out.dot"));
-            Util.toDot(fst, w, false, false);
+            Util.ToDot(fst, w, false, false);
             w.Dispose();
             //System.out.println(w.toString());
 
@@ -1374,19 +1374,19 @@ namespace Lucene.Net.Util.Fst
         public virtual void TestNonFinalStopNode()
         {
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-            long nothing = outputs.NoOutput;
-            Builder<long> b = new Builder<long>(FST.INPUT_TYPE.BYTE1, outputs);
+            long? nothing = outputs.NoOutput;
+            Builder<long?> b = new Builder<long?>(FST.INPUT_TYPE.BYTE1, outputs);
 
-            FST<long> fst = new FST<long>(FST.INPUT_TYPE.BYTE1, outputs, false, PackedInts.COMPACT, true, 15);
+            FST<long?> fst = new FST<long?>(FST.INPUT_TYPE.BYTE1, outputs, false, PackedInts.COMPACT, true, 15);
 
-            Builder<long>.UnCompiledNode<long> rootNode = new Builder<long>.UnCompiledNode<long>(b, 0);
+            Builder<long?>.UnCompiledNode<long?> rootNode = new Builder<long?>.UnCompiledNode<long?>(b, 0);
 
             // Add final stop node
             {
-                Builder<long>.UnCompiledNode<long> node = new Builder<long>.UnCompiledNode<long>(b, 0);
+                Builder<long?>.UnCompiledNode<long?> node = new Builder<long?>.UnCompiledNode<long?>(b, 0);
                 node.IsFinal = true;
                 rootNode.AddArc('a', node);
-                Builder<long>.CompiledNode frozen = new Builder<long>.CompiledNode();
+                Builder<long?>.CompiledNode frozen = new Builder<long?>.CompiledNode();
                 frozen.Node = fst.AddNode(node);
                 rootNode.Arcs[0].NextFinalOutput = 17L;
                 rootNode.Arcs[0].IsFinal = true;
@@ -1396,9 +1396,9 @@ namespace Lucene.Net.Util.Fst
 
             // Add non-final stop node
             {
-                Builder<long>.UnCompiledNode<long> node = new Builder<long>.UnCompiledNode<long>(b, 0);
+                Builder<long?>.UnCompiledNode<long?> node = new Builder<long?>.UnCompiledNode<long?>(b, 0);
                 rootNode.AddArc('b', node);
-                Builder<long>.CompiledNode frozen = new Builder<long>.CompiledNode();
+                Builder<long?>.CompiledNode frozen = new Builder<long?>.CompiledNode();
                 frozen.Node = fst.AddNode(node);
                 rootNode.Arcs[1].NextFinalOutput = nothing;
                 rootNode.Arcs[1].Output = 42L;
@@ -1409,7 +1409,7 @@ namespace Lucene.Net.Util.Fst
 
             StringWriter w = new StringWriter();
             //Writer w = new OutputStreamWriter(new FileOutputStream("/x/tmp3/out.dot"));
-            Util.toDot(fst, w, false, false);
+            Util.ToDot(fst, w, false, false);
             w.Dispose();
 
             CheckStopNodes(fst, outputs);
@@ -1421,41 +1421,41 @@ namespace Lucene.Net.Util.Fst
             @out.Dispose();
 
             IndexInput @in = dir.OpenInput("fst", IOContext.DEFAULT);
-            FST<long> fst2 = new FST<long>(@in, outputs);
+            FST<long?> fst2 = new FST<long?>(@in, outputs);
             CheckStopNodes(fst2, outputs);
             @in.Dispose();
             dir.Dispose();
         }
 
-        private void CheckStopNodes(FST<long> fst, PositiveIntOutputs outputs)
+        private void CheckStopNodes(FST<long?> fst, PositiveIntOutputs outputs)
         {
             long? nothing = outputs.NoOutput;
-            FST.Arc<long> startArc = fst.GetFirstArc(new FST.Arc<long>());
+            FST.Arc<long?> startArc = fst.GetFirstArc(new FST.Arc<long?>());
             Assert.AreEqual(nothing, startArc.Output);
             Assert.AreEqual(nothing, startArc.NextFinalOutput);
 
-            FST.Arc<long> arc = fst.ReadFirstTargetArc(startArc, new FST.Arc<long>(), fst.GetBytesReader);
+            FST.Arc<long?> arc = fst.ReadFirstTargetArc(startArc, new FST.Arc<long?>(), fst.BytesReader);
             Assert.AreEqual('a', arc.Label);
-            Assert.AreEqual(17, (long)arc.NextFinalOutput);
+            Assert.AreEqual(17, arc.NextFinalOutput);
             Assert.IsTrue(arc.Final);
 
-            arc = fst.ReadNextArc(arc, fst.GetBytesReader);
+            arc = fst.ReadNextArc(arc, fst.BytesReader);
             Assert.AreEqual('b', arc.Label);
             Assert.IsFalse(arc.Final);
-            Assert.AreEqual(42, (long)arc.Output);
+            Assert.AreEqual(42, arc.Output);
         }
 
-        internal static readonly IComparer<long> minLongComparator = new ComparatorAnonymousInnerClassHelper();
+        internal static readonly IComparer<long?> minLongComparator = new ComparatorAnonymousInnerClassHelper();
 
-        private class ComparatorAnonymousInnerClassHelper : IComparer<long>
+        private class ComparatorAnonymousInnerClassHelper : IComparer<long?>
         {
             public ComparatorAnonymousInnerClassHelper()
             {
             }
 
-            public virtual int Compare(long left, long right)
+            public virtual int Compare(long? left, long? right)
             {
-                return left.CompareTo(right);
+                return left.Value.CompareTo(right.Value);
             }
         }
 
@@ -1463,35 +1463,35 @@ namespace Lucene.Net.Util.Fst
         public virtual void TestShortestPaths()
         {
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, outputs);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, outputs);
 
             IntsRef scratch = new IntsRef();
             builder.Add(Util.ToIntsRef(new BytesRef("aab"), scratch), 22L);
             builder.Add(Util.ToIntsRef(new BytesRef("aac"), scratch), 7L);
             builder.Add(Util.ToIntsRef(new BytesRef("ax"), scratch), 17L);
-            FST<long> fst = builder.Finish();
+            FST<long?> fst = builder.Finish();
             //Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"));
             //Util.toDot(fst, w, false, false);
             //w.Dispose();
 
-            Util.TopResults<long> res = Util.shortestPaths(fst, fst.GetFirstArc(new FST.Arc<long>()), outputs.NoOutput, minLongComparator, 3, true);
+            Util.TopResults<long?> res = Util.ShortestPaths(fst, fst.GetFirstArc(new FST.Arc<long?>()), outputs.NoOutput, minLongComparator, 3, true);
             Assert.IsTrue(res.IsComplete);
             Assert.AreEqual(3, res.TopN.Count);
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("aac"), scratch), res.TopN[0].Input);
-            Assert.AreEqual(7L, (long)res.TopN[0].Output);
+            Assert.AreEqual(7L, res.TopN[0].Output);
 
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("ax"), scratch), res.TopN[1].Input);
-            Assert.AreEqual(17L, (long)res.TopN[1].Output);
+            Assert.AreEqual(17L, res.TopN[1].Output);
 
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("aab"), scratch), res.TopN[2].Input);
-            Assert.AreEqual(22L, (long)res.TopN[2].Output);
+            Assert.AreEqual(22L, res.TopN[2].Output);
         }
 
         [Test]
         public virtual void TestRejectNoLimits()
         {
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, outputs);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, outputs);
 
             IntsRef scratch = new IntsRef();
             builder.Add(Util.ToIntsRef(new BytesRef("aab"), scratch), 22L);
@@ -1500,41 +1500,41 @@ namespace Lucene.Net.Util.Fst
             builder.Add(Util.ToIntsRef(new BytesRef("adcde"), scratch), 17L);
 
             builder.Add(Util.ToIntsRef(new BytesRef("ax"), scratch), 17L);
-            FST<long> fst = builder.Finish();
+            FST<long?> fst = builder.Finish();
             AtomicInteger rejectCount = new AtomicInteger();
-            Util.TopNSearcher<long> searcher = new TopNSearcherAnonymousInnerClassHelper(this, fst, minLongComparator, rejectCount);
+            Util.TopNSearcher<long?> searcher = new TopNSearcherAnonymousInnerClassHelper(this, fst, minLongComparator, rejectCount);
 
-            searcher.AddStartPaths(fst.GetFirstArc(new FST.Arc<long>()), outputs.NoOutput, true, new IntsRef());
-            Util.TopResults<long> res = searcher.Search();
+            searcher.AddStartPaths(fst.GetFirstArc(new FST.Arc<long?>()), outputs.NoOutput, true, new IntsRef());
+            Util.TopResults<long?> res = searcher.Search();
             Assert.AreEqual(rejectCount.Get(), 4);
             Assert.IsTrue(res.IsComplete); // rejected(4) + topN(2) <= maxQueueSize(6)
 
             Assert.AreEqual(1, res.TopN.Count);
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("aac"), scratch), res.TopN[0].Input);
-            Assert.AreEqual(7L, (long)res.TopN[0].Output);
+            Assert.AreEqual(7L, res.TopN[0].Output);
             rejectCount.Set(0);
             searcher = new TopNSearcherAnonymousInnerClassHelper2(this, fst, minLongComparator, rejectCount);
 
-            searcher.AddStartPaths(fst.GetFirstArc(new FST.Arc<long>()), outputs.NoOutput, true, new IntsRef());
+            searcher.AddStartPaths(fst.GetFirstArc(new FST.Arc<long?>()), outputs.NoOutput, true, new IntsRef());
             res = searcher.Search();
             Assert.AreEqual(rejectCount.Get(), 4);
             Assert.IsFalse(res.IsComplete); // rejected(4) + topN(2) > maxQueueSize(5)
         }
 
-        private class TopNSearcherAnonymousInnerClassHelper : Util.TopNSearcher<long>
+        private class TopNSearcherAnonymousInnerClassHelper : Util.TopNSearcher<long?>
         {
             private readonly TestFSTs OuterInstance;
 
             private AtomicInteger RejectCount;
 
-            public TopNSearcherAnonymousInnerClassHelper(TestFSTs outerInstance, FST<long> fst, IComparer<long> minLongComparator, AtomicInteger rejectCount)
+            public TopNSearcherAnonymousInnerClassHelper(TestFSTs outerInstance, FST<long?> fst, IComparer<long?> minLongComparator, AtomicInteger rejectCount)
                 : base(fst, 2, 6, minLongComparator)
             {
                 this.OuterInstance = outerInstance;
                 this.RejectCount = rejectCount;
             }
 
-            protected override bool AcceptResult(IntsRef input, long output)
+            protected override bool AcceptResult(IntsRef input, long? output)
             {
                 bool accept = (int)output == 7;
                 if (!accept)
@@ -1545,20 +1545,20 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        private class TopNSearcherAnonymousInnerClassHelper2 : Util.TopNSearcher<long>
+        private class TopNSearcherAnonymousInnerClassHelper2 : Util.TopNSearcher<long?>
         {
             private readonly TestFSTs OuterInstance;
 
             private AtomicInteger RejectCount;
 
-            public TopNSearcherAnonymousInnerClassHelper2(TestFSTs outerInstance, FST<long> fst, IComparer<long> minLongComparator, AtomicInteger rejectCount)
+            public TopNSearcherAnonymousInnerClassHelper2(TestFSTs outerInstance, FST<long?> fst, IComparer<long?> minLongComparator, AtomicInteger rejectCount)
                 : base(fst, 2, 5, minLongComparator)
             {
                 this.OuterInstance = outerInstance;
                 this.RejectCount = rejectCount;
             }
 
-            protected override bool AcceptResult(IntsRef input, long output)
+            protected override bool AcceptResult(IntsRef input, long? output)
             {
                 bool accept = (int)output == 7;
                 if (!accept)
@@ -1580,7 +1580,7 @@ namespace Lucene.Net.Util.Fst
 
             public virtual int Compare(Pair left, Pair right)
             {
-                return left.Output1.CompareTo(right.Output1);
+                return left.Output1.GetValueOrDefault().CompareTo(right.Output1.GetValueOrDefault());
             }
         }
 
@@ -1590,7 +1590,7 @@ namespace Lucene.Net.Util.Fst
         public virtual void TestShortestPathsWFST()
         {
 
-            PairOutputs<long, long> outputs = new PairOutputs<long, long>(PositiveIntOutputs.Singleton, PositiveIntOutputs.Singleton); // output -  weight
+            PairOutputs<long?, long?> outputs = new PairOutputs<long?, long?>(PositiveIntOutputs.Singleton, PositiveIntOutputs.Singleton); // output -  weight
 
             Builder<Pair> builder = new Builder<Pair>(FST.INPUT_TYPE.BYTE1, outputs);
 
@@ -1603,21 +1603,21 @@ namespace Lucene.Net.Util.Fst
             //Util.toDot(fst, w, false, false);
             //w.Dispose();
 
-            Util.TopResults<Pair> res = Util.shortestPaths(fst, fst.GetFirstArc(new FST.Arc<Pair>()), outputs.NoOutput, minPairWeightComparator, 3, true);
+            Util.TopResults<Pair> res = Util.ShortestPaths(fst, fst.GetFirstArc(new FST.Arc<Pair>()), outputs.NoOutput, minPairWeightComparator, 3, true);
             Assert.IsTrue(res.IsComplete);
             Assert.AreEqual(3, res.TopN.Count);
 
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("aac"), scratch), res.TopN[0].Input);
-            Assert.AreEqual(7L, (long)res.TopN[0].Output.Output1); // weight
-            Assert.AreEqual(36L, (long)res.TopN[0].Output.Output2); // output
+            Assert.AreEqual(7L, res.TopN[0].Output.Output1); // weight
+            Assert.AreEqual(36L, res.TopN[0].Output.Output2); // output
 
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("ax"), scratch), res.TopN[1].Input);
-            Assert.AreEqual(17L, (long)res.TopN[1].Output.Output1); // weight
-            Assert.AreEqual(85L, (long)res.TopN[1].Output.Output2); // output
+            Assert.AreEqual(17L, res.TopN[1].Output.Output1); // weight
+            Assert.AreEqual(85L, res.TopN[1].Output.Output2); // output
 
             Assert.AreEqual(Util.ToIntsRef(new BytesRef("aab"), scratch), res.TopN[2].Input);
-            Assert.AreEqual(22L, (long)res.TopN[2].Output.Output1); // weight
-            Assert.AreEqual(57L, (long)res.TopN[2].Output.Output2); // output
+            Assert.AreEqual(22L, res.TopN[2].Output.Output1); // weight
+            Assert.AreEqual(57L, res.TopN[2].Output.Output2); // output
         }
 
         [Test]
@@ -1630,7 +1630,7 @@ namespace Lucene.Net.Util.Fst
             SortedSet<string> allPrefixes = new SortedSet<string>();
 
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
-            Builder<long> builder = new Builder<long>(FST.INPUT_TYPE.BYTE1, outputs);
+            Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1, outputs);
             IntsRef scratch = new IntsRef();
 
             for (int i = 0; i < numWords; i++)
@@ -1659,13 +1659,13 @@ namespace Lucene.Net.Util.Fst
                 builder.Add(Util.ToIntsRef(new BytesRef(e.Key), scratch), e.Value);
             }
 
-            FST<long> fst = builder.Finish();
+            FST<long?> fst = builder.Finish();
             //System.out.println("SAVE out.dot");
             //Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"));
             //Util.toDot(fst, w, false, false);
             //w.Dispose();
 
-            BytesReader reader = fst.GetBytesReader;
+            BytesReader reader = fst.BytesReader;
 
             //System.out.println("testing: " + allPrefixes.Size() + " prefixes");
             foreach (string prefix in allPrefixes)
@@ -1673,8 +1673,8 @@ namespace Lucene.Net.Util.Fst
                 // 1. run prefix against fst, then complete by value
                 //System.out.println("TEST: " + prefix);
 
-                long prefixOutput = 0;
-                FST.Arc<long> arc = fst.GetFirstArc(new FST.Arc<long>());
+                long? prefixOutput = 0;
+                FST.Arc<long?> arc = fst.GetFirstArc(new FST.Arc<long?>());
                 for (int idx = 0; idx < prefix.Length; idx++)
                 {
                     if (fst.FindTargetArc((int)prefix[idx], arc, arc, reader) == null)
@@ -1686,11 +1686,11 @@ namespace Lucene.Net.Util.Fst
 
                 int topN = TestUtil.NextInt(random, 1, 10);
 
-                Util.TopResults<long> r = Util.shortestPaths(fst, arc, fst.Outputs.NoOutput, minLongComparator, topN, true);
+                Util.TopResults<long?> r = Util.ShortestPaths(fst, arc, fst.Outputs.NoOutput, minLongComparator, topN, true);
                 Assert.IsTrue(r.IsComplete);
 
                 // 2. go thru whole treemap (slowCompletor) and check its actually the best suggestion
-                IList<ResultLong> matches = new List<ResultLong>();
+                List<Util.Result<long?>> matches = new List<Util.Result<long?>>();
 
                 // TODO: could be faster... but its slowCompletor for a reason
                 foreach (KeyValuePair<string, long> e in slowCompletor)
@@ -1698,12 +1698,12 @@ namespace Lucene.Net.Util.Fst
                     if (e.Key.StartsWith(prefix))
                     {
                         //System.out.println("  consider " + e.getKey());
-                        matches.Add(new ResultLong(Util.ToIntsRef(new BytesRef(e.Key.Substring(prefix.Length)), new IntsRef()), e.Value - prefixOutput));
+                        matches.Add(new Util.Result<long?>(Util.ToIntsRef(new BytesRef(e.Key.Substring(prefix.Length)), new IntsRef()), e.Value - prefixOutput));
                     }
                 }
 
                 Assert.IsTrue(matches.Count > 0);
-                matches.Sort(new TieBreakByInputComparator(minLongComparator));
+                matches.Sort(new TieBreakByInputComparator<long?>(minLongComparator));
                 if (matches.Count > topN)
                 {
                     matches.SubList(topN, matches.Count).Clear();
@@ -1720,15 +1720,15 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        private class TieBreakByInputComparator : IComparer<ResultLong>
+        private class TieBreakByInputComparator<T> : IComparer<Util.Result<T>>
         {
-            internal readonly IComparer<ResultLong> Comparator;
-            public TieBreakByInputComparator(IComparer<ResultLong> comparator)
+            internal readonly IComparer<T> Comparator;
+            public TieBreakByInputComparator(IComparer<T> comparator)
             {
                 this.Comparator = comparator;
             }
 
-            public virtual int Compare(ResultLong a, ResultLong b)
+            public virtual int Compare(Util.Result<T> a, Util.Result<T> b)
             {
                 int cmp = Comparator.Compare(a.Output, b.Output);
                 if (cmp == 0)
@@ -1768,7 +1768,7 @@ namespace Lucene.Net.Util.Fst
             SortedDictionary<string, TwoLongs> slowCompletor = new SortedDictionary<string, TwoLongs>();
             SortedSet<string> allPrefixes = new SortedSet<string>();
 
-            PairOutputs<long, long> outputs = new PairOutputs<long, long>(PositiveIntOutputs.Singleton, PositiveIntOutputs.Singleton); // output -  weight
+            PairOutputs<long?, long?> outputs = new PairOutputs<long?, long?>(PositiveIntOutputs.Singleton, PositiveIntOutputs.Singleton); // output -  weight
             Builder<Pair> builder = new Builder<Pair>(FST.INPUT_TYPE.BYTE1, outputs);
             IntsRef scratch = new IntsRef();
 
@@ -1808,7 +1808,7 @@ namespace Lucene.Net.Util.Fst
             //Util.toDot(fst, w, false, false);
             //w.Dispose();
 
-            BytesReader reader = fst.GetBytesReader;
+            BytesReader reader = fst.BytesReader;
 
             //System.out.println("testing: " + allPrefixes.Size() + " prefixes");
             foreach (string prefix in allPrefixes)
@@ -1829,10 +1829,10 @@ namespace Lucene.Net.Util.Fst
 
                 int topN = TestUtil.NextInt(random, 1, 10);
 
-                Util.TopResults<Pair> r = Util.shortestPaths(fst, arc, fst.Outputs.NoOutput, minPairWeightComparator, topN, true);
+                Util.TopResults<Pair> r = Util.ShortestPaths(fst, arc, fst.Outputs.NoOutput, minPairWeightComparator, topN, true);
                 Assert.IsTrue(r.IsComplete);
                 // 2. go thru whole treemap (slowCompletor) and check its actually the best suggestion
-                IList<ResultPair> matches = new List<ResultPair>();
+                List<Util.Result<Pair>> matches = new List<Util.Result<Pair>>();
 
                 // TODO: could be faster... but its slowCompletor for a reason
                 foreach (KeyValuePair<string, TwoLongs> e in slowCompletor)
@@ -1840,12 +1840,13 @@ namespace Lucene.Net.Util.Fst
                     if (e.Key.StartsWith(prefix))
                     {
                         //System.out.println("  consider " + e.getKey());
-                        matches.Add(new ResultPair(Util.ToIntsRef(new BytesRef(e.Key.Substring(prefix.Length)), new IntsRef()), outputs.NewPair(e.Value.a - prefixOutput.Output1, e.Value.b - prefixOutput.Output2)));
+                        matches.Add(new Util.Result<Pair>(Util.ToIntsRef(new BytesRef(e.Key.Substring(prefix.Length)), new IntsRef()),
+                            outputs.NewPair(e.Value.a - prefixOutput.Output1, e.Value.b - prefixOutput.Output2)));
                     }
                 }
 
                 Assert.IsTrue(matches.Count > 0);
-                matches.Sort(new TieBreakByInputComparator(minPairWeightComparator));
+                matches.Sort(new TieBreakByInputComparator<Pair>(minPairWeightComparator));
                 if (matches.Count > topN)
                 {
                     matches.SubList(topN, matches.Count).Clear();
@@ -1868,7 +1869,7 @@ namespace Lucene.Net.Util.Fst
             ByteSequenceOutputs outputs = ByteSequenceOutputs.Singleton;
             Builder<BytesRef> builder = new Builder<BytesRef>(FST.INPUT_TYPE.BYTE1, outputs);
 
-            sbyte[] bytes = new sbyte[300];
+            byte[] bytes = new byte[300];
             IntsRef input = new IntsRef();
             input.Grow(1);
             input.Length = 1;
@@ -1876,7 +1877,7 @@ namespace Lucene.Net.Util.Fst
             for (int arc = 0; arc < 6; arc++)
             {
                 input.Ints[0] = arc;
-                output.Bytes[0] = (sbyte)arc;
+                output.Bytes[0] = (byte)arc;
                 builder.Add(input, BytesRef.DeepCopyOf(output));
             }
 


[28/49] lucenenet git commit: Ported Core.TestExternalCodes + fixed bugs that were preventing it from running.

Posted by sy...@apache.org.
Ported Core.TestExternalCodes + fixed bugs that were preventing it from running.


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

Branch: refs/heads/master
Commit: f4819a3e4902fd7c257f70068e511145cbc031e4
Parents: 0e77936
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 03:59:31 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 04:19:45 2016 +0700

----------------------------------------------------------------------
 .../Pulsing/PulsingPostingsReader.cs            |   6 +-
 src/Lucene.Net.Core/Util/Attribute.cs           |   2 +-
 src/Lucene.Net.Core/Util/AttributeImpl.cs       | 276 +++++++++----------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |   1 +
 src/Lucene.Net.Tests/core/TestExternalCodecs.cs | 264 +++++++++---------
 5 files changed, 273 insertions(+), 276 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4819a3e/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
index 7ab59e9..46e4eb9 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
@@ -699,7 +699,7 @@ namespace Lucene.Net.Codecs.Pulsing
         /// 
         /// @lucene.internal
         /// </summary>
-        internal sealed class PulsingEnumAttributeImpl : AttributeImpl, IPulsingEnumAttribute
+        internal sealed class PulsingEnumAttribute : AttributeImpl, IPulsingEnumAttribute
         {
             // we could store 'other', but what if someone 'chained' multiple postings readers,
             // this could cause problems?
@@ -720,13 +720,11 @@ namespace Lucene.Net.Codecs.Pulsing
                 // and is calling clearAttributes(), so they don't nuke the reuse information!
             }
 
-            public override void CopyTo(AttributeImpl target)
+            public override void CopyTo(Util.Attribute target)
             {
                 // this makes no sense for us, because our state is per-docsenum.
                 // we don't want to copy any stuff over to another docsenum ever!
             }
-
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4819a3e/src/Lucene.Net.Core/Util/Attribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Attribute.cs b/src/Lucene.Net.Core/Util/Attribute.cs
index 6d00033..adb4277 100644
--- a/src/Lucene.Net.Core/Util/Attribute.cs
+++ b/src/Lucene.Net.Core/Util/Attribute.cs
@@ -72,7 +72,7 @@ namespace Lucene.Net.Util
             }
         }
 
-        public string ReflectAsString(bool prependAttClass)
+        public virtual string ReflectAsString(bool prependAttClass)
         {
             StringBuilder buffer = new StringBuilder();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4819a3e/src/Lucene.Net.Core/Util/AttributeImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/AttributeImpl.cs b/src/Lucene.Net.Core/Util/AttributeImpl.cs
index f14425b..20fc88a 100644
--- a/src/Lucene.Net.Core/Util/AttributeImpl.cs
+++ b/src/Lucene.Net.Core/Util/AttributeImpl.cs
@@ -5,8 +5,7 @@ using System.Text;
 
 namespace Lucene.Net.Util
 {
-
-	/*
+    /*
 	 * Licensed to the Apache Software Foundation (ASF) under one or more
 	 * contributor license agreements.  See the NOTICE file distributed with
 	 * this work for additional information regarding copyright ownership.
@@ -24,150 +23,149 @@ namespace Lucene.Net.Util
 	 */
 
 
-	/// <summary>
-	/// Base class for Attributes that can be added to a 
-	/// <seealso cref="Lucene.Net.Util.AttributeSource"/>.
-	/// <p>
-	/// Attributes are used to add data in a dynamic, yet type-safe way to a source
-	/// of usually streamed objects, e. g. a <seealso cref="Lucene.Net.Analysis.TokenStream"/>.
-	/// </summary>
-	public abstract class AttributeImpl : IAttribute, ICloneable 
-	{
-	  /// <summary>
-	  /// Clears the values in this AttributeImpl and resets it to its 
-	  /// default value. If this implementation implements more than one Attribute interface
-	  /// it clears all.
-	  /// </summary>
-	  public abstract void Clear();
-
-	  /// <summary>
-	  /// this method returns the current attribute values as a string in the following format
-	  /// by calling the <seealso cref="#reflectWith(AttributeReflector)"/> method:
-	  /// 
-	  /// <ul>
-	  /// <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
-	  /// <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
-	  /// </ul>
-	  /// </summary>
-	  /// <seealso cref= #reflectWith(AttributeReflector) </seealso>
-	  public string ReflectAsString(bool prependAttClass)
-	  {
-		StringBuilder buffer = new StringBuilder();
-		ReflectWith(new AttributeReflectorAnonymousInnerClassHelper(this, prependAttClass, buffer));
-		return buffer.ToString();
-	  }
+    /// <summary>
+    /// Base class for Attributes that can be added to a 
+    /// <seealso cref="Lucene.Net.Util.AttributeSource"/>.
+    /// <p>
+    /// Attributes are used to add data in a dynamic, yet type-safe way to a source
+    /// of usually streamed objects, e. g. a <seealso cref="Lucene.Net.Analysis.TokenStream"/>.
+    /// </summary>
+    public abstract class AttributeImpl : Attribute, IAttribute, ICloneable
+    {
+        /// <summary>
+        /// Clears the values in this AttributeImpl and resets it to its 
+        /// default value. If this implementation implements more than one Attribute interface
+        /// it clears all.
+        /// </summary>
+        public override abstract void Clear();
 
-	  private class AttributeReflectorAnonymousInnerClassHelper : IAttributeReflector
-	  {
-		  private readonly AttributeImpl OuterInstance;
+        /// <summary>
+        /// this method returns the current attribute values as a string in the following format
+        /// by calling the <seealso cref="#reflectWith(AttributeReflector)"/> method:
+        /// 
+        /// <ul>
+        /// <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
+        /// <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
+        /// </ul>
+        /// </summary>
+        /// <seealso cref= #reflectWith(AttributeReflector) </seealso>
+        public override string ReflectAsString(bool prependAttClass)
+        {
+            StringBuilder buffer = new StringBuilder();
+            ReflectWith(new AttributeReflectorAnonymousInnerClassHelper(this, prependAttClass, buffer));
+            return buffer.ToString();
+        }
 
-		  private bool PrependAttClass;
-		  private StringBuilder Buffer;
+        private class AttributeReflectorAnonymousInnerClassHelper : IAttributeReflector
+        {
+            private readonly AttributeImpl OuterInstance;
 
-		  public AttributeReflectorAnonymousInnerClassHelper(AttributeImpl outerInstance, bool prependAttClass, StringBuilder buffer)
-		  {
-			  this.OuterInstance = outerInstance;
-			  this.PrependAttClass = prependAttClass;
-			  this.Buffer = buffer;
-		  }
+            private bool PrependAttClass;
+            private StringBuilder Buffer;
 
-	      public void Reflect<T>(string key, object value) where T : IAttribute
-	      {
-	          throw new NotImplementedException();
-	      }
+            public AttributeReflectorAnonymousInnerClassHelper(AttributeImpl outerInstance, bool prependAttClass, StringBuilder buffer)
+            {
+                this.OuterInstance = outerInstance;
+                this.PrependAttClass = prependAttClass;
+                this.Buffer = buffer;
+            }
 
-	      public virtual void Reflect(Type attClass, string key, object value)
-		  {
-			if (Buffer.Length > 0)
-			{
-			  Buffer.Append(',');
-			}
-			if (PrependAttClass)
-			{
-			  Buffer.Append(attClass.Name).Append('#');
-			}
-			Buffer.Append(key).Append('=').Append((value == null) ? "null" : value);
-		  }
-	  }
+            public void Reflect<T>(string key, object value) where T : IAttribute
+            {
+                throw new NotImplementedException();
+            }
 
-	  /// <summary>
-	  /// this method is for introspection of attributes, it should simply
-	  /// add the key/values this attribute holds to the given <seealso cref="AttributeReflector"/>.
-	  /// 
-	  /// <p>The default implementation calls <seealso cref="AttributeReflector#reflect"/> for all
-	  /// non-static fields from the implementing class, using the field name as key
-	  /// and the field value as value. The Attribute class is also determined by reflection.
-	  /// Please note that the default implementation can only handle single-Attribute
-	  /// implementations.
-	  /// 
-	  /// <p>Custom implementations look like this (e.g. for a combined attribute implementation):
-	  /// <pre class="prettyprint">
-	  ///   public void reflectWith(AttributeReflector reflector) {
-	  ///     reflector.reflect(CharTermAttribute.class, "term", term());
-	  ///     reflector.reflect(PositionIncrementAttribute.class, "positionIncrement", getPositionIncrement());
-	  ///   }
-	  /// </pre>
-	  /// 
-	  /// <p>If you implement this method, make sure that for each invocation, the same set of <seealso cref="Attribute"/>
-	  /// interfaces and keys are passed to <seealso cref="AttributeReflector#reflect"/> in the same order, but possibly
-	  /// different values. So don't automatically exclude e.g. {@code null} properties!
-	  /// </summary>
-	  /// <seealso cref= #reflectAsString(boolean) </seealso>
-	  public virtual void ReflectWith(IAttributeReflector reflector)
-	  {
-		Type clazz = this.GetType();
-		LinkedList<WeakReference> interfaces = AttributeSource.GetAttributeInterfaces(clazz);
-		if (interfaces.Count != 1)
-		{
-		  throw new System.NotSupportedException(clazz.Name + " implements more than one Attribute interface, the default reflectWith() implementation cannot handle this.");
-		}
-        //LUCENE-TODO unsure about GetType()
-        Type interf = (Type)interfaces.First.Value.GetType();
-        FieldInfo[] fields = clazz.GetFields(BindingFlags.Instance | BindingFlags.Public);
-		try
-		{
-		  for (int i = 0; i < fields.Length; i++)
-		  {
-			FieldInfo f = fields[i];
-			if (f.IsStatic)
-			{
-				continue;
-			}
-			reflector.Reflect(interf, f.Name, f.GetValue(this));
-		  }
-		}
-		catch (Exception)
-		{
-		  // this should never happen, because we're just accessing fields
-		  // from 'this'
-		  throw new Exception("Unknown Error");
-		}
-	  }
+            public virtual void Reflect(Type attClass, string key, object value)
+            {
+                if (Buffer.Length > 0)
+                {
+                    Buffer.Append(',');
+                }
+                if (PrependAttClass)
+                {
+                    Buffer.Append(attClass.Name).Append('#');
+                }
+                Buffer.Append(key).Append('=').Append((value == null) ? "null" : value);
+            }
+        }
 
-	  /// <summary>
-	  /// Copies the values from this Attribute into the passed-in
-	  /// target attribute. The target implementation must support all the
-	  /// Attributes this implementation supports.
-	  /// </summary>
-	  public abstract void CopyTo(AttributeImpl target);
+        /// <summary>
+        /// this method is for introspection of attributes, it should simply
+        /// add the key/values this attribute holds to the given <seealso cref="AttributeReflector"/>.
+        /// 
+        /// <p>The default implementation calls <seealso cref="AttributeReflector#reflect"/> for all
+        /// non-static fields from the implementing class, using the field name as key
+        /// and the field value as value. The Attribute class is also determined by reflection.
+        /// Please note that the default implementation can only handle single-Attribute
+        /// implementations.
+        /// 
+        /// <p>Custom implementations look like this (e.g. for a combined attribute implementation):
+        /// <pre class="prettyprint">
+        ///   public void reflectWith(AttributeReflector reflector) {
+        ///     reflector.reflect(CharTermAttribute.class, "term", term());
+        ///     reflector.reflect(PositionIncrementAttribute.class, "positionIncrement", getPositionIncrement());
+        ///   }
+        /// </pre>
+        /// 
+        /// <p>If you implement this method, make sure that for each invocation, the same set of <seealso cref="Attribute"/>
+        /// interfaces and keys are passed to <seealso cref="AttributeReflector#reflect"/> in the same order, but possibly
+        /// different values. So don't automatically exclude e.g. {@code null} properties!
+        /// </summary>
+        /// <seealso cref= #reflectAsString(boolean) </seealso>
+        public override void ReflectWith(IAttributeReflector reflector)
+        {
+            Type clazz = this.GetType();
+            LinkedList<WeakReference> interfaces = AttributeSource.GetAttributeInterfaces(clazz);
+            if (interfaces.Count != 1)
+            {
+                throw new System.NotSupportedException(clazz.Name + " implements more than one Attribute interface, the default reflectWith() implementation cannot handle this.");
+            }
+            //LUCENE-TODO unsure about GetType()
+            Type interf = (Type)interfaces.First.Value.GetType();
+            FieldInfo[] fields = clazz.GetFields(BindingFlags.Instance | BindingFlags.Public);
+            try
+            {
+                for (int i = 0; i < fields.Length; i++)
+                {
+                    FieldInfo f = fields[i];
+                    if (f.IsStatic)
+                    {
+                        continue;
+                    }
+                    reflector.Reflect(interf, f.Name, f.GetValue(this));
+                }
+            }
+            catch (Exception)
+            {
+                // this should never happen, because we're just accessing fields
+                // from 'this'
+                throw new Exception("Unknown Error");
+            }
+        }
 
-	  /// <summary>
-	  /// Shallow clone. Subclasses must override this if they 
-	  /// need to clone any members deeply,
-	  /// </summary>
-	  public object Clone()
-	  {
-		AttributeImpl clone = null;
-		try
-		{
-		  clone = (AttributeImpl)base.MemberwiseClone();
-		}
-		catch (Exception)
-		{
-		  throw new Exception("Clone not supported"); // shouldn't happen
-		}
-		return clone;
-	  }
-	}
+        /// <summary>
+        /// Copies the values from this Attribute into the passed-in
+        /// target attribute. The target implementation must support all the
+        /// Attributes this implementation supports.
+        /// </summary>
+        public override abstract void CopyTo(Attribute target);
 
+        /// <summary>
+        /// Shallow clone. Subclasses must override this if they 
+        /// need to clone any members deeply,
+        /// </summary>
+        public override object Clone()
+        {
+            AttributeImpl clone = null;
+            try
+            {
+                clone = (AttributeImpl)base.MemberwiseClone();
+            }
+            catch (Exception)
+            {
+                throw new Exception("Clone not supported"); // shouldn't happen
+            }
+            return clone;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4819a3e/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index a20ba5c..1eab117 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -429,6 +429,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="core\TestDemo.cs" />
+    <Compile Include="core\TestExternalCodecs.cs" />
     <Compile Include="core\TestMergeSchedulerExternal.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4819a3e/src/Lucene.Net.Tests/core/TestExternalCodecs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestExternalCodecs.cs b/src/Lucene.Net.Tests/core/TestExternalCodecs.cs
index 6a6a80a..b8a6683 100644
--- a/src/Lucene.Net.Tests/core/TestExternalCodecs.cs
+++ b/src/Lucene.Net.Tests/core/TestExternalCodecs.cs
@@ -1,9 +1,9 @@
 using System;
+using NUnit.Framework;
 
-namespace org.apache.lucene
+namespace Lucene.Net
 {
-
-	/*
+    /*
 	 * Licensed to the Apache Software Foundation (ASF) under one or more
 	 * contributor license agreements.  See the NOTICE file distributed with
 	 * this work for additional information regarding copyright ownership.
@@ -20,135 +20,135 @@ namespace org.apache.lucene
 	 * limitations under the License.
 	 */
 
-	using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
-	using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
-	using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec;
-	using Document = Lucene.Net.Document.Document;
-	using Field = Lucene.Net.Document.Field;
-	using DirectoryReader = Lucene.Net.Index.DirectoryReader;
-	using IndexReader = Lucene.Net.Index.IndexReader;
-	using IndexWriter = Lucene.Net.Index.IndexWriter;
-	using Term = Lucene.Net.Index.Term;
-	using IndexSearcher = Lucene.Net.Search.IndexSearcher;
-	using TermQuery = Lucene.Net.Search.TermQuery;
-	using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
-	using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-    using NUnit.Framework;
-
-
-	/* Intentionally outside of oal.index to verify fully
+    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
+    using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
+    using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec;
+    using Document = Lucene.Net.Documents.Document;
+    using Field = Lucene.Net.Documents.Field;
+    using DirectoryReader = Lucene.Net.Index.DirectoryReader;
+    using IndexReader = Lucene.Net.Index.IndexReader;
+    using IndexWriter = Lucene.Net.Index.IndexWriter;
+    using Term = Lucene.Net.Index.Term;
+    using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+    using TermQuery = Lucene.Net.Search.TermQuery;
+    using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+
+    /* Intentionally outside of oal.index to verify fully
 	   external codecs work fine */
 
-	public class TestExternalCodecs : LuceneTestCase
-	{
-
-	  private sealed class CustomPerFieldCodec : Lucene46Codec
-	  {
-
-		internal readonly PostingsFormat RamFormat = PostingsFormat.ForName("RAMOnly");
-		internal readonly PostingsFormat DefaultFormat = PostingsFormat.ForName("Lucene41");
-		internal readonly PostingsFormat PulsingFormat = PostingsFormat.ForName("Pulsing41");
-
-		public override PostingsFormat GetPostingsFormatForField(string field)
-		{
-		  if (field.Equals("field2") || field.Equals("id"))
-		  {
-			return PulsingFormat;
-		  }
-		  else if (field.Equals("field1"))
-		  {
-			return DefaultFormat;
-		  }
-		  else
-		  {
-			return RamFormat;
-		  }
-		}
-	  }
-
-	  // tests storing "id" and "field2" fields as pulsing codec,
-	  // whose term sort is backwards unicode code point, and
-	  // storing "field1" as a custom entirely-in-RAM codec
-	  public virtual void TestPerFieldCodec()
-	  {
-
-		int NUM_DOCS = atLeast(173);
-		if (VERBOSE)
-		{
-		  Console.WriteLine("TEST: NUM_DOCS=" + NUM_DOCS);
-		}
-
-		BaseDirectoryWrapper dir = newDirectory();
-		dir.CheckIndexOnClose = false; // we use a custom codec provider
-		IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setCodec(new CustomPerFieldCodec()).setMergePolicy(newLogMergePolicy(3)));
-		Document doc = new Document();
-		// uses default codec:
-		doc.Add(newTextField("field1", "this field uses the standard codec as the test", Field.Store.NO));
-		// uses pulsing codec:
-		Field field2 = newTextField("field2", "this field uses the pulsing codec as the test", Field.Store.NO);
-		doc.Add(field2);
-
-		Field idField = newStringField("id", "", Field.Store.NO);
-
-		doc.Add(idField);
-		for (int i = 0;i < NUM_DOCS;i++)
-		{
-		  idField.StringValue = "" + i;
-		  w.addDocument(doc);
-		  if ((i + 1) % 10 == 0)
-		  {
-			w.commit();
-		  }
-		}
-		if (VERBOSE)
-		{
-		  Console.WriteLine("TEST: now delete id=77");
-		}
-		w.deleteDocuments(new Term("id", "77"));
-
-		IndexReader r = DirectoryReader.Open(w, true);
-
-		Assert.AreEqual(NUM_DOCS - 1, r.NumDocs());
-		IndexSearcher s = newSearcher(r);
-		Assert.AreEqual(NUM_DOCS - 1, s.Search(new TermQuery(new Term("field1", "standard")), 1).TotalHits);
-		Assert.AreEqual(NUM_DOCS - 1, s.Search(new TermQuery(new Term("field2", "pulsing")), 1).TotalHits);
-		r.Close();
-
-		if (VERBOSE)
-		{
-		  Console.WriteLine("\nTEST: now delete 2nd doc");
-		}
-		w.deleteDocuments(new Term("id", "44"));
-
-		if (VERBOSE)
-		{
-		  Console.WriteLine("\nTEST: now force merge");
-		}
-		w.forceMerge(1);
-		if (VERBOSE)
-		{
-		  Console.WriteLine("\nTEST: now open reader");
-		}
-		r = DirectoryReader.Open(w, true);
-		Assert.AreEqual(NUM_DOCS - 2, r.MaxDoc());
-		Assert.AreEqual(NUM_DOCS - 2, r.NumDocs());
-		s = newSearcher(r);
-		Assert.AreEqual(NUM_DOCS - 2, s.Search(new TermQuery(new Term("field1", "standard")), 1).TotalHits);
-		Assert.AreEqual(NUM_DOCS - 2, s.Search(new TermQuery(new Term("field2", "pulsing")), 1).TotalHits);
-		Assert.AreEqual(1, s.Search(new TermQuery(new Term("id", "76")), 1).TotalHits);
-		Assert.AreEqual(0, s.Search(new TermQuery(new Term("id", "77")), 1).TotalHits);
-		Assert.AreEqual(0, s.Search(new TermQuery(new Term("id", "44")), 1).TotalHits);
-
-		if (VERBOSE)
-		{
-		  Console.WriteLine("\nTEST: now close NRT reader");
-		}
-		r.Close();
-
-		w.Dispose();
-
-		dir.Dispose();
-	  }
-	}
-
+    public class TestExternalCodecs : LuceneTestCase
+    {
+
+        private sealed class CustomPerFieldCodec : Lucene46Codec
+        {
+
+            internal readonly PostingsFormat RamFormat = Codecs.PostingsFormat.ForName("RAMOnly");
+            internal readonly PostingsFormat DefaultFormat = Codecs.PostingsFormat.ForName("Lucene41");
+            internal readonly PostingsFormat PulsingFormat = Codecs.PostingsFormat.ForName("Pulsing41");
+
+            public override PostingsFormat GetPostingsFormatForField(string field)
+            {
+                if (field.Equals("field2") || field.Equals("id"))
+                {
+                    return PulsingFormat;
+                }
+                else if (field.Equals("field1"))
+                {
+                    return DefaultFormat;
+                }
+                else
+                {
+                    return RamFormat;
+                }
+            }
+        }
+
+        // tests storing "id" and "field2" fields as pulsing codec,
+        // whose term sort is backwards unicode code point, and
+        // storing "field1" as a custom entirely-in-RAM codec
+        [Test]
+        public virtual void TestPerFieldCodec()
+        {
+
+            int NUM_DOCS = AtLeast(173);
+            if (VERBOSE)
+            {
+                Console.WriteLine("TEST: NUM_DOCS=" + NUM_DOCS);
+            }
+
+            using (BaseDirectoryWrapper dir = NewDirectory())
+            {
+                dir.CheckIndexOnClose = false; // we use a custom codec provider
+                using (IndexWriter w = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetCodec(new CustomPerFieldCodec()).SetMergePolicy(NewLogMergePolicy(3))))
+                {
+                    Documents.Document doc = new Documents.Document();
+                    // uses default codec:
+                    doc.Add(NewTextField("field1", "this field uses the standard codec as the test", Field.Store.NO));
+                    // uses pulsing codec:
+                    Field field2 = NewTextField("field2", "this field uses the pulsing codec as the test", Field.Store.NO);
+                    doc.Add(field2);
+
+                    Field idField = NewStringField("id", "", Field.Store.NO);
+
+                    doc.Add(idField);
+                    for (int i = 0; i < NUM_DOCS; i++)
+                    {
+                        idField.StringValue = "" + i;
+                        w.AddDocument(doc);
+                        if ((i + 1) % 10 == 0)
+                        {
+                            w.Commit();
+                        }
+                    }
+                    if (VERBOSE)
+                    {
+                        Console.WriteLine("TEST: now delete id=77");
+                    }
+                    w.DeleteDocuments(new Term("id", "77"));
+
+                    using (IndexReader r = DirectoryReader.Open(w, true))
+                    {
+                        Assert.AreEqual(NUM_DOCS - 1, r.NumDocs);
+                        IndexSearcher s = NewSearcher(r);
+                        Assert.AreEqual(NUM_DOCS - 1, s.Search(new TermQuery(new Term("field1", "standard")), 1).TotalHits);
+                        Assert.AreEqual(NUM_DOCS - 1, s.Search(new TermQuery(new Term("field2", "pulsing")), 1).TotalHits);
+                    }
+
+                    if (VERBOSE)
+                    {
+                        Console.WriteLine("\nTEST: now delete 2nd doc");
+                    }
+                    w.DeleteDocuments(new Term("id", "44"));
+
+                    if (VERBOSE)
+                    {
+                        Console.WriteLine("\nTEST: now force merge");
+                    }
+                    w.ForceMerge(1);
+                    if (VERBOSE)
+                    {
+                        Console.WriteLine("\nTEST: now open reader");
+                    }
+                    using (IndexReader r = DirectoryReader.Open(w, true))
+                    {
+                        Assert.AreEqual(NUM_DOCS - 2, r.MaxDoc);
+                        Assert.AreEqual(NUM_DOCS - 2, r.NumDocs);
+                        IndexSearcher s = NewSearcher(r);
+                        Assert.AreEqual(NUM_DOCS - 2, s.Search(new TermQuery(new Term("field1", "standard")), 1).TotalHits);
+                        Assert.AreEqual(NUM_DOCS - 2, s.Search(new TermQuery(new Term("field2", "pulsing")), 1).TotalHits);
+                        Assert.AreEqual(1, s.Search(new TermQuery(new Term("id", "76")), 1).TotalHits);
+                        Assert.AreEqual(0, s.Search(new TermQuery(new Term("id", "77")), 1).TotalHits);
+                        Assert.AreEqual(0, s.Search(new TermQuery(new Term("id", "44")), 1).TotalHits);
+
+                        if (VERBOSE)
+                        {
+                            Console.WriteLine("\nTEST: now close NRT reader");
+                        }
+                    }
+                }
+            }
+        }
+    }
 }
\ No newline at end of file


[36/49] lucenenet git commit: Updated ignore flag on Index.Test2BBinaryDocValues with the message from the Java version that it takes 45 minutes.

Posted by sy...@apache.org.
Updated ignore flag on Index.Test2BBinaryDocValues with the message from the Java version that it takes 45 minutes.


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

Branch: refs/heads/master
Commit: c7e8c86a7d0aa7ae0eb57980588aa7c47b32079e
Parents: 9530d75
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 06:19:04 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 06:19:04 2016 +0700

----------------------------------------------------------------------
 .../core/Index/Test2BBinaryDocValues.cs         | 43 +++++++++-----------
 1 file changed, 19 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c7e8c86a/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs b/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
index 5719833..4e137b3 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
@@ -1,13 +1,26 @@
-using System;
 using Lucene.Net.Documents;
+using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Index
 {
-    /*using Ignore = org.junit.Ignore;
-
-    using TimeoutSuite = com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;*/
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
 
-    using NUnit.Framework;
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using BinaryDocValuesField = BinaryDocValuesField;
     using ByteArrayDataInput = Lucene.Net.Store.ByteArrayDataInput;
@@ -15,28 +28,10 @@ namespace Lucene.Net.Index
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Document = Documents.Document;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
-    /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
-
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
 
-    [Ignore]
+    [Ignore("takes ~ 45 minutes")]
     [TestFixture]
     public class Test2BBinaryDocValues : LuceneTestCase
     {


[25/49] lucenenet git commit: Ported Core.TestDemo

Posted by sy...@apache.org.
Ported Core.TestDemo


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

Branch: refs/heads/master
Commit: e9e4425adbf39d70153c4888929820b4468d8dda
Parents: e659c99
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 02:43:25 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 02:43:25 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj |   1 +
 src/Lucene.Net.Tests/core/TestDemo.cs        | 121 +++++++++++-----------
 2 files changed, 64 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9e4425a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 32dea94..31b2666 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -428,6 +428,7 @@
     <Compile Include="core\TestAssertions.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\TestDemo.cs" />
     <Compile Include="core\TestMergeSchedulerExternal.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9e4425a/src/Lucene.Net.Tests/core/TestDemo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestDemo.cs b/src/Lucene.Net.Tests/core/TestDemo.cs
index 0156fd4..341026e 100644
--- a/src/Lucene.Net.Tests/core/TestDemo.cs
+++ b/src/Lucene.Net.Tests/core/TestDemo.cs
@@ -1,7 +1,8 @@
-namespace org.apache.lucene
-{
+using NUnit.Framework;
 
-	/*
+namespace Lucene.Net
+{
+    /*
 	 * Licensed to the Apache Software Foundation (ASF) under one or more
 	 * contributor license agreements.  See the NOTICE file distributed with
 	 * this work for additional information regarding copyright ownership.
@@ -18,67 +19,71 @@ namespace org.apache.lucene
 	 * limitations under the License.
 	 */
 
-	using Analyzer = Lucene.Net.Analysis.Analyzer;
-	using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
-	using Document = Lucene.Net.Document.Document;
-	using Field = Lucene.Net.Document.Field;
-	using DirectoryReader = Lucene.Net.Index.DirectoryReader;
-	using IndexReader = Lucene.Net.Index.IndexReader;
-	using Term = Lucene.Net.Index.Term;
-	using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
-	using Lucene.Net.Search;
-	using Directory = Lucene.Net.Store.Directory;
-	using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+    using Analyzer = Lucene.Net.Analysis.Analyzer;
+    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
+    using Document = Lucene.Net.Documents.Document;
+    using Field = Lucene.Net.Documents.Field;
+    using DirectoryReader = Lucene.Net.Index.DirectoryReader;
+    using IndexReader = Lucene.Net.Index.IndexReader;
+    using Term = Lucene.Net.Index.Term;
+    using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
+    using Lucene.Net.Search;
+    using Directory = Lucene.Net.Store.Directory;
+    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
-	/// <summary>
-	/// A very simple demo used in the API documentation (src/java/overview.html).
-	/// 
-	/// Please try to keep src/java/overview.html up-to-date when making changes
-	/// to this class.
-	/// </summary>
-	public class TestDemo : LuceneTestCase
-	{
+    /// <summary>
+    /// A very simple demo used in the API documentation (src/java/overview.html).
+    /// 
+    /// Please try to keep src/java/overview.html up-to-date when making changes
+    /// to this class.
+    /// </summary>
+    public class TestDemo_ : LuceneTestCase
+    {
 
-	  public virtual void TestDemo()
-	  {
-		Analyzer analyzer = new MockAnalyzer(random());
+        [Test]
+        public virtual void TestDemo()
+        {
+            Analyzer analyzer = new MockAnalyzer(Random());
 
-		// Store the index in memory:
-		Directory directory = newDirectory();
-		// To store an index on disk, use this instead:
-		// Directory directory = FSDirectory.open(new File("/tmp/testindex"));
-		RandomIndexWriter iwriter = new RandomIndexWriter(random(), directory, analyzer);
-		Document doc = new Document();
-		string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
-		string text = "this is the text to be indexed. " + longTerm;
-		doc.add(newTextField("fieldname", text, Field.Store.YES));
-		iwriter.addDocument(doc);
-		iwriter.close();
+            // Store the index in memory:
+            using (Directory directory = NewDirectory())
+            {
+                string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
+                string text = "this is the text to be indexed. " + longTerm;
 
-		// Now search the index:
-		IndexReader ireader = DirectoryReader.open(directory); // read-only=true
-		IndexSearcher isearcher = newSearcher(ireader);
+                // To store an index on disk, use this instead:
+                // Directory directory = FSDirectory.open(new File("/tmp/testindex"));
+                using (RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, NewIndexWriterConfig(Random(), TEST_VERSION_CURRENT, analyzer)))
+                {
+                    Documents.Document doc = new Documents.Document();
+                    doc.Add(NewTextField("fieldname", text, Field.Store.YES));
+                    iwriter.AddDocument(doc);
+                }
 
-		Assert.AreEqual(1, isearcher.search(new TermQuery(new Term("fieldname", longTerm)), 1).totalHits);
-		Query query = new TermQuery(new Term("fieldname", "text"));
-		TopDocs hits = isearcher.search(query, null, 1);
-		Assert.AreEqual(1, hits.totalHits);
-		// Iterate through the results:
-		for (int i = 0; i < hits.scoreDocs.length; i++)
-		{
-		  Document hitDoc = isearcher.doc(hits.scoreDocs[i].doc);
-		  Assert.AreEqual(text, hitDoc.get("fieldname"));
-		}
+                // Now search the index:
+                using (IndexReader ireader = DirectoryReader.Open(directory)) // read-only=true
+                {
+                    IndexSearcher isearcher = NewSearcher(ireader);
 
-		// Test simple phrase query
-		PhraseQuery phraseQuery = new PhraseQuery();
-		phraseQuery.add(new Term("fieldname", "to"));
-		phraseQuery.add(new Term("fieldname", "be"));
-		Assert.AreEqual(1, isearcher.search(phraseQuery, null, 1).totalHits);
+                    Assert.AreEqual(1, isearcher.Search(new TermQuery(new Term("fieldname", longTerm)), 1).TotalHits);
+                    Query query = new TermQuery(new Term("fieldname", "text"));
+                    TopDocs hits = isearcher.Search(query, null, 1);
+                    Assert.AreEqual(1, hits.TotalHits);
+                    // Iterate through the results:
+                    for (int i = 0; i < hits.ScoreDocs.Length; i++)
+                    {
+                        Documents.Document hitDoc = isearcher.Doc(hits.ScoreDocs[i].Doc);
+                        Assert.AreEqual(text, hitDoc.Get("fieldname"));
+                    }
 
-		ireader.close();
-		directory.close();
-	  }
-	}
+                    // Test simple phrase query
+                    PhraseQuery phraseQuery = new PhraseQuery();
+                    phraseQuery.Add(new Term("fieldname", "to"));
+                    phraseQuery.Add(new Term("fieldname", "be"));
+                    Assert.AreEqual(1, isearcher.Search(phraseQuery, null, 1).TotalHits);
 
+                }
+            }
+        }
+    }
 }
\ No newline at end of file


[19/49] lucenenet git commit: Fixed issue with SortedSet not being emptied in Core.Util.Fst.Util, and added thread safety, since SortedSet doesn't have the necessary atomic operations.

Posted by sy...@apache.org.
Fixed issue with SortedSet not being emptied in Core.Util.Fst.Util, and added thread safety, since SortedSet doesn't have the necessary atomic operations.


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

Branch: refs/heads/master
Commit: ef889cebdeaa180d0bb232afd8e5ab3865cd41bc
Parents: 32e2105
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 8 05:23:58 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:41:02 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/Util.cs | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ef889ceb/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 15a80b7..0419b78 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -363,6 +363,8 @@ namespace Lucene.Net.Util.Fst
 
             internal SortedSet<FSTPath<T>> Queue = null;
 
+            private object syncLock = new object();
+
             /// <summary>
             /// Creates an unbounded TopNSearcher </summary>
             /// <param name="fst"> the <seealso cref="Lucene.Net.Util.Fst.FST"/> to search on </param>
@@ -433,7 +435,14 @@ namespace Lucene.Net.Util.Fst
 
                 if (Queue.Count == maxQueueDepth + 1)
                 {
-                    Queue.Last();
+                    // LUCENENET NOTE: SortedSet doesn't have atomic operations,
+                    // so we need to add some thread safety just in case.
+                    // Perhaps it might make sense to wrap SortedSet into a type
+                    // that provides thread safety.
+                    lock (syncLock)
+                    {
+                        Queue.Remove(Queue.Max);
+                    }
                 }
             }
 
@@ -502,7 +511,19 @@ namespace Lucene.Net.Util.Fst
 
                     // Remove top path since we are now going to
                     // pursue it:
-                    path = Queue.First();
+
+                    // LUCENENET NOTE: SortedSet doesn't have atomic operations,
+                    // so we need to add some thread safety just in case.
+                    // Perhaps it might make sense to wrap SortedSet into a type
+                    // that provides thread safety.
+                    lock (syncLock)
+                    {
+                        path = Queue.Min;
+                        if (path != null)
+                        {
+                            Queue.Remove(path);
+                        }
+                    }
 
                     if (path == null)
                     {


[48/49] lucenenet git commit: Removed commented code from Core.Util.Fst.NodeHash

Posted by sy...@apache.org.
Removed commented code from Core.Util.Fst.NodeHash


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

Branch: refs/heads/master
Commit: c7cf589a8835fdb7b730181fc58e3a9a84c34e75
Parents: e8b44e7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 22 10:25:14 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 22 10:25:14 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs | 23 -----------------------
 1 file changed, 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c7cf589a/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 5198fe7..3a928f1 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -113,29 +113,6 @@ namespace Lucene.Net.Util.Fst
                 h = PRIME * h + (int)(scratchArc.Target ^ (scratchArc.Target >> 32));
                 h = PRIME * h + scratchArc.Output.GetHashCode();
                 h = PRIME * h + scratchArc.NextFinalOutput.GetValueHashCode();
-                //// 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)
-                //{
-                //    h = PRIME * h + scratchArc.NextFinalOutput.GetType().GetHashCode();
-                //    foreach (object value in scratchArc.NextFinalOutput as IEnumerable)
-                //    {
-                //        if (value != null)
-                //        {
-                //            h = PRIME * h + value.GetHashCode();
-                //        }
-                //        else
-                //        {
-                //            h = PRIME * h + 0; // 0 for null
-                //        }
-                //    }
-                //}
-                //else
-                //{
-                //    h = PRIME * h + scratchArc.NextFinalOutput.GetHashCode();
-                //}
-
                 if (scratchArc.IsFinal)
                 {
                     h += 17;


[31/49] lucenenet git commit: Finished implementing ignored Classification.SimpleNaiveBayesClassifierTest.TestNGramUsage()

Posted by sy...@apache.org.
Finished implementing ignored Classification.SimpleNaiveBayesClassifierTest.TestNGramUsage()


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

Branch: refs/heads/master
Commit: 202c06875743cdec1ba2d8903ee3337479f65354
Parents: c031b60
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 05:28:54 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 05:28:54 2016 +0700

----------------------------------------------------------------------
 .../Lucene.Net.Tests.Classification.csproj      |  4 ++
 .../SimpleNaiveBayesClassifierTest.cs           | 57 ++++++++++----------
 2 files changed, 34 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/202c0687/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj b/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj
index 2d618e0..4ccf2dc 100644
--- a/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj
+++ b/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj
@@ -50,6 +50,10 @@
     <Compile Include="Utils\DataSplitterTest.cs" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\Lucene.Net.Analysis.Common\Lucene.Net.Analysis.Common.csproj">
+      <Project>{4add0bbc-b900-4715-9526-d871de8eea64}</Project>
+      <Name>Lucene.Net.Analysis.Common</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Lucene.Net.Classification\Lucene.Net.Classification.csproj">
       <Project>{E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}</Project>
       <Name>Lucene.Net.Classification</Name>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/202c0687/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs b/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
index 7f6d3a0..96ff25b 100644
--- a/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
+++ b/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
@@ -1,28 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 using Lucene.Net.Analysis;
+using Lucene.Net.Analysis.Core;
+using Lucene.Net.Analysis.Ngram;
+using Lucene.Net.Analysis.Reverse;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 using NUnit.Framework;
+using System.IO;
 
 namespace Lucene.Net.Classification
 {
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
     /**
      * Testcase for {@link SimpleNaiveBayesClassifier}
      */
@@ -45,20 +49,19 @@ namespace Lucene.Net.Classification
         }
 
         [Test]
-        [Ignore("Need to figure out what to do with NGramAnalyzer, issues with things in Analysis.Common project")]
         public void TestNGramUsage()
         {
-            //CheckCorrectClassification(new SimpleNaiveBayesClassifier(), TECHNOLOGY_INPUT, TECHNOLOGY_RESULT, new NGramAnalyzer(), textFieldName, categoryFieldName);
+            CheckCorrectClassification(new SimpleNaiveBayesClassifier(), TECHNOLOGY_INPUT, TECHNOLOGY_RESULT, new NGramAnalyzer(), textFieldName, categoryFieldName);
         }
 
-        //private class NGramAnalyzer : Analyzer
-        //{
-        //    public override TokenStreamComponents CreateComponents(String fieldName, TextReader reader)
-        //    {
-        //        Tokenizer tokenizer = new KeywordTokenizer(reader);
-        //        return new TokenStreamComponents(tokenizer, new ReverseStringFilter(TEST_VERSION_CURRENT, new EdgeNGramTokenFilter(TEST_VERSION_CURRENT, new ReverseStringFilter(TEST_VERSION_CURRENT, tokenizer), 10, 20)));
-        //    }
-        //}
+        private class NGramAnalyzer : Analyzer
+        {
+            public override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
+            {
+                Tokenizer tokenizer = new KeywordTokenizer(reader);
+                return new TokenStreamComponents(tokenizer, new ReverseStringFilter(TEST_VERSION_CURRENT, new EdgeNGramTokenFilter(TEST_VERSION_CURRENT, new ReverseStringFilter(TEST_VERSION_CURRENT, tokenizer), 10, 20)));
+            }
+        }
 
         [Test]
         public void TestPerformance()


[47/49] lucenenet git commit: Finished implementation of Core.Util.TestWeakIdenityMap and fixed some bugs with the enumerator logic of WeakIdenityMap (test still failing).

Posted by sy...@apache.org.
Finished implementation of Core.Util.TestWeakIdenityMap and fixed some bugs with the enumerator logic of WeakIdenityMap (test still failing).


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

Branch: refs/heads/master
Commit: e8b44e751130bfe1e01489a7879e13eaf1090061
Parents: 44a5cb5
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 18 05:25:09 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 18 07:28:41 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/WeakIdentityMap.cs     | 175 ++++++++++---------
 .../core/Util/TestWeakIdentityMap.cs            | 146 +++++++++-------
 2 files changed, 179 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8b44e75/src/Lucene.Net.Core/Util/WeakIdentityMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/WeakIdentityMap.cs b/src/Lucene.Net.Core/Util/WeakIdentityMap.cs
index aa4e1a8..7d2ce1c 100644
--- a/src/Lucene.Net.Core/Util/WeakIdentityMap.cs
+++ b/src/Lucene.Net.Core/Util/WeakIdentityMap.cs
@@ -2,7 +2,9 @@ using Lucene.Net.Support;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.Linq;
 using System.Runtime.CompilerServices;
+using System.Collections;
 
 namespace Lucene.Net.Util
 {
@@ -72,7 +74,7 @@ namespace Lucene.Net.Util
         /// Creates a new {@code WeakIdentityMap} based on a non-synchronized <seealso cref="HashMap"/>.
         /// The map <a href="#reapInfo">cleans up the reference queue on every read operation</a>.
         /// </summary>
-        public static WeakIdentityMap<K, V> newHashMap()
+        public static WeakIdentityMap<K, V> NewHashMap()
         {
             return NewHashMap(false);
         }
@@ -162,20 +164,37 @@ namespace Lucene.Net.Util
 
         public IEnumerable<K> Keys
         {
-            // .NET port: using this method which mimics IDictionary instead of KeyIterator()
             get
             {
-                foreach (var key in BackingStore.Keys)
-                {
-                    var target = key.Target;
+                return new KeyWrapper(this);
+            }
+        }
 
-                    if (target == null)
-                        continue;
-                    else if (target == NULL)
-                        yield return null;
-                    else
-                        yield return (K)target;
-                }
+        /// <summary>
+        /// LUCENENET specific class to allow the 
+        /// GetEnumerator() method to be overridden
+        /// for the keys so we can return an enumerator
+        /// that is smart enough to clean up the dead keys
+        /// and also so that MoveNext() returns false in the
+        /// event there are no more values left (instead of returning
+        /// a null value in an extra enumeration).
+        /// </summary>
+        private class KeyWrapper : IEnumerable<K>
+        {
+            private readonly WeakIdentityMap<K, V> outerInstance;
+            public KeyWrapper(WeakIdentityMap<K, V> outerInstance)
+            {
+                this.outerInstance = outerInstance;
+            }
+            public IEnumerator<K> GetEnumerator()
+            {
+                outerInstance.Reap();
+                return new IteratorAnonymousInnerClassHelper(outerInstance);
+            }
+
+            IEnumerator IEnumerable.GetEnumerator()
+            {
+                return GetEnumerator();
             }
         }
 
@@ -229,93 +248,87 @@ namespace Lucene.Net.Util
             return BackingStore.Count;
         }
 
-        /*LUCENE TO-DO I don't think necessary
-        /// <summary>
-        /// Returns an iterator over all weak keys of this map.
-        /// Keys already garbage collected will not be returned.
-        /// this Iterator does not support removals.
-        /// </summary>
-        public IEnumerator<K> KeyIterator()
-        {
-          Reap();
-          IEnumerator<IdentityWeakReference> iterator = BackingStore.Keys.GetEnumerator();
-          // IMPORTANT: Don't use oal.util.FilterIterator here:
-          // We need *strong* reference to current key after setNext()!!!
-          return new IteratorAnonymousInnerClassHelper(this, iterator);
-        }
-
-        private class IteratorAnonymousInnerClassHelper : Iterator<K>
+        private class IteratorAnonymousInnerClassHelper : IEnumerator<K>
         {
-            private readonly WeakIdentityMap<K,V> OuterInstance;
-
-            private IEnumerator<IdentityWeakReference> Iterator;
+            private readonly WeakIdentityMap<K,V> outerInstance;
 
-            public IteratorAnonymousInnerClassHelper(WeakIdentityMap<K,V> outerInstance, IEnumerator<IdentityWeakReference> iterator)
+            public IteratorAnonymousInnerClassHelper(WeakIdentityMap<K,V> outerInstance)
             {
-                this.OuterInstance = outerInstance;
-                this.Iterator = iterator;
-                next = null;
-                nextIsSet = false;
+                this.outerInstance = outerInstance;
             }
 
-              // holds strong reference to next element in backing iterator:
-            private object next;
-            // the backing iterator was already consumed:
-            private bool nextIsSet;
-            /
-            public virtual bool HasNext()
+            // holds strong reference to next element in backing iterator:
+            private object next = null;
+            private int position = -1; // start before the beginning of the set
+
+            public K Current
             {
-              return nextIsSet || SetNext();
+                get
+                {
+                    return (K)next;
+                }
             }
 
-            public virtual K Next()
+            object IEnumerator.Current
             {
-              if (!HasNext())
-              {
-                throw new Exception();
-              }
-              Debug.Assert(nextIsSet);
-              try
-              {
-                return (K) next;
-              }
-              finally
-              {
-                 // release strong reference and invalidate current value:
-                nextIsSet = false;
-                next = null;
-              }
+                get
+                {
+                    return Current;
+                }
             }
 
-            public virtual void Remove()
+            public void Dispose()
             {
-              throw new System.NotSupportedException();
+                // Nothing to do
             }
 
-            private bool SetNext()
+            
+            public bool MoveNext()
             {
-              Debug.Assert(!nextIsSet);
-              while (Iterator.MoveNext())
-              {
-                next = Iterator.Current;
-                if (next == null)
-                {
-                  // the key was already GCed, we can remove it from backing map:
-                  Iterator.remove();
-                }
-                else
+                while (true)
                 {
-                  // unfold "null" special value:
-                  if (next == NULL)
-                  {
-                    next = null;
-                  }
-                  return nextIsSet = true;
+                    IdentityWeakReference key;
+
+                    // If the next position doesn't exist, exit
+                    if (++position >= outerInstance.BackingStore.Count)
+                    {
+                        position--;
+                        return false;
+                    }
+                    try
+                    {
+                        key = outerInstance.BackingStore.Keys.ElementAt(position);
+                    }
+                    catch (ArgumentOutOfRangeException)
+                    {
+                        // some other thread beat us to the last element (or removed a prior element) - fail gracefully.
+                        position--;
+                        return false;
+                    }
+                    if (!key.IsAlive)
+                    {
+                        outerInstance.BackingStore.Remove(key);
+                        position--;
+                        continue;
+                    }
+                    // unfold "null" special value:
+                    if (key.Target == NULL)
+                    {
+                        next = null;
+                    }
+                    else
+                    {
+                        next = key.Target;
+                    }
+                    return true;
                 }
-              }
-              return false;
             }
-        }*/
+
+            public void Reset()
+            {
+                throw new NotSupportedException();
+            }
+        }
 
         /// <summary>
         /// Returns an iterator over all values of this map.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8b44e75/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs b/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
index 82c5c4c..3eff002 100644
--- a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
@@ -2,7 +2,9 @@ using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Support;
 using NUnit.Framework;
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Threading;
 
 namespace Lucene.Net.Util
@@ -103,12 +105,12 @@ namespace Lucene.Net.Util
             Assert.AreEqual(3, map.Size());
 
             int c = 0, keysAssigned = 0;
-            for (IEnumerator<string> iter = map.Keys.GetEnumerator(); iter.MoveNext(); )
+            for (IEnumerator<string> iter = map.Keys.GetEnumerator(); iter.MoveNext();)
             {
                 //Assert.IsTrue(iter.hasNext()); // try again, should return same result!
                 string k = iter.Current;
-                Assert.IsTrue(k == key1 || k == key2 | k == key3);
                 // LUCENENET NOTE: Need object.ReferenceEquals here because the == operator does more than check reference equality
+                Assert.IsTrue(object.ReferenceEquals(k, key1) || object.ReferenceEquals(k, key2) | object.ReferenceEquals(k, key3));
                 keysAssigned += object.ReferenceEquals(k, key1) ? 1 : (object.ReferenceEquals(k, key2) ? 2 : 4);
                 c++;
             }
@@ -116,7 +118,7 @@ namespace Lucene.Net.Util
             Assert.AreEqual(1 + 2 + 4, keysAssigned, "all keys must have been seen");
 
             c = 0;
-            for (IEnumerator<string> iter = map.Values.GetEnumerator(); iter.MoveNext(); )
+            for (IEnumerator<string> iter = map.Values.GetEnumerator(); iter.MoveNext();)
             {
                 string v = iter.Current;
                 Assert.IsTrue(v.StartsWith("bar"));
@@ -133,15 +135,13 @@ namespace Lucene.Net.Util
             {
                 try
                 {
-                    //System.RunFinalization();
-                    //System.gc();
                     GC.Collect();
                     int newSize = map.Size();
                     Assert.IsTrue(size >= newSize, "previousSize(" + size + ")>=newSize(" + newSize + ")");
                     size = newSize;
-                    Thread.Sleep(new TimeSpan(0, 0, 1));
+                    Thread.Sleep(TimeSpan.FromSeconds(1));
                     c = 0;
-                    for (IEnumerator<string> iter = map.Keys.GetEnumerator(); iter.MoveNext(); )
+                    for (IEnumerator<string> iter = map.Keys.GetEnumerator(); iter.MoveNext();)
                     {
                         Assert.IsNotNull(iter.Current);
                         c++;
@@ -188,22 +188,20 @@ namespace Lucene.Net.Util
             Assert.IsTrue(map.Empty);
         }
 
-        /* LUCENENET TODO: Compile issues
         [Test]
         public virtual void TestConcurrentHashMap()
         {
             // don't make threadCount and keyCount random, otherwise easily OOMs or fails otherwise:
             const int threadCount = 8, keyCount = 1024;
 
-            System.Threading.ThreadPool.QueueUserWorkItem(;
-            //ExecutorService exec = Executors.newFixedThreadPool(threadCount, new NamedThreadFactory("testConcurrentHashMap"));
+            RunnableAnonymousInnerClassHelper[] workers = new RunnableAnonymousInnerClassHelper[threadCount];
             WeakIdentityMap<object, int?> map = WeakIdentityMap<object, int?>.NewConcurrentHashMap(Random().NextBoolean());
             // we keep strong references to the keys,
             // so WeakIdentityMap will not forget about them:
             AtomicReferenceArray<object> keys = new AtomicReferenceArray<object>(keyCount);
             for (int j = 0; j < keyCount; j++)
             {
-                keys.Set(j, new object());
+                keys[j] = new object();
             }
 
             try
@@ -211,19 +209,33 @@ namespace Lucene.Net.Util
                 for (int t = 0; t < threadCount; t++)
                 {
                     Random rnd = new Random(Random().Next());
-                    exec.execute(new RunnableAnonymousInnerClassHelper(this, keyCount, map, keys, rnd));
+                    var worker = new RunnableAnonymousInnerClassHelper(this, keyCount, map, keys, rnd);
+                    workers[t] = worker;
+                    worker.Start();
                 }
             }
             finally
             {
-                exec.shutdown();
-                while (!exec.awaitTermination(1000L, TimeUnit.MILLISECONDS)) ;
+                foreach (var w in workers)
+                {
+                    w.Join(1000L);
+                }
             }
 
+            // LUCENENET: Since assertions were done on the other threads, we need to check the
+            // results here.
+            for (int i = 0; i < workers.Length; i++)
+            {
+                assertTrue(string.Format(CultureInfo.InvariantCulture,
+                    "worker thread {0} of {1} failed \n" + workers[i].Error, i, workers.Length),
+                    workers[i].Error == null);
+            }
+
+
             // clear strong refs
             for (int j = 0; j < keyCount; j++)
             {
-                keys.Set(j, null);
+                keys[j] = null;
             }
 
             // check that GC does not cause problems in reap() method:
@@ -232,8 +244,6 @@ namespace Lucene.Net.Util
             {
                 try
                 {
-                    //System.runFinalization();
-                    //System.gc();
                     GC.Collect();
                     int newSize = map.Size();
                     Assert.IsTrue(size >= newSize, "previousSize(" + size + ")>=newSize(" + newSize + ")");
@@ -256,63 +266,77 @@ namespace Lucene.Net.Util
             }
         }
 
-        private class RunnableAnonymousInnerClassHelper : IThreadRunnable
+        private class RunnableAnonymousInnerClassHelper : ThreadClass
         {
-            private readonly TestWeakIdentityMap OuterInstance;
+            private readonly TestWeakIdentityMap outerInstance;
 
-            private int KeyCount;
-            private WeakIdentityMap<object, int?> Map;
-            private AtomicReferenceArray<object> Keys;
-            private Random Rnd;
+            private readonly int keyCount;
+            private readonly WeakIdentityMap<object, int?> map;
+            private AtomicReferenceArray<object> keys;
+            private readonly Random rnd;
+            private volatile Exception error;
 
             public RunnableAnonymousInnerClassHelper(TestWeakIdentityMap outerInstance, int keyCount, WeakIdentityMap<object, int?> map, AtomicReferenceArray<object> keys, Random rnd)
             {
-                this.OuterInstance = outerInstance;
-                this.KeyCount = keyCount;
-                this.Map = map;
-                this.Keys = keys;
-                this.Rnd = rnd;
+                this.outerInstance = outerInstance;
+                this.keyCount = keyCount;
+                this.map = map;
+                this.keys = keys;
+                this.rnd = rnd;
             }
 
-            public void Run()
+            public Exception Error
             {
-                int count = AtLeast(Rnd, 10000);
-                for (int i = 0; i < count; i++)
+                get { return error; }
+            }
+
+
+            public override void Run()
+            {
+                int count = AtLeast(rnd, 10000);
+                try
                 {
-                    int j = Rnd.Next(KeyCount);
-                    switch (Rnd.Next(5))
+                    for (int i = 0; i < count; i++)
                     {
-                        case 0:
-                            Map.Put(Keys.Get(j), Convert.ToInt32(j));
-                            break;
-                        case 1:
-                            int? v = Map.Get(Keys.Get(j));
-                            if (v != null)
-                            {
-                                Assert.AreEqual(j, (int)v);
-                            }
-                            break;
-                        case 2:
-                            Map.Remove(Keys.Get(j));
-                            break;
-                        case 3:
-                            // renew key, the old one will be GCed at some time:
-                            Keys.Set(j, new object());
-                            break;
-                        case 4:
-                            // check iterator still working
-                            for (IEnumerator<object> it = Map.Keys.GetEnumerator(); it.MoveNext();)
-                            {
-                                Assert.IsNotNull(it.Current);
-                            }
-                            break;
-                        default:
-                            Assert.Fail("Should not get here.");
-                            break;
+                        int j = rnd.Next(keyCount);
+                        switch (rnd.Next(5))
+                        {
+                            case 0:
+                                map.Put(keys[j], Convert.ToInt32(j));
+                                break;
+                            case 1:
+                                int? v = map.Get(keys[j]);
+                                if (v != null)
+                                {
+                                    Assert.AreEqual(j, (int)v);
+                                }
+                                break;
+                            case 2:
+                                map.Remove(keys[j]);
+                                break;
+                            case 3:
+                                // renew key, the old one will be GCed at some time:
+                                keys[j] = new object();
+                                break;
+                            case 4:
+                                // check iterator still working
+                                for (IEnumerator<object> it = map.Keys.GetEnumerator(); it.MoveNext();)
+                                {
+                                    Assert.IsNotNull(it.Current);
+                                }
+                                break;
+                            default:
+                                Assert.Fail("Should not get here.");
+                                break;
+                        }
                     }
                 }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                    this.error = e;
+                }
             }
         }
-        */
     }
 }
\ No newline at end of file


[21/49] lucenenet git commit: Added timeout to long running test (~45 sec) in Core.Util.Packed.TestPackedInts

Posted by sy...@apache.org.
Added timeout to long running test (~45 sec) in Core.Util.Packed.TestPackedInts


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

Branch: refs/heads/master
Commit: 878080dcd9d7aa5d705e8fce6d3d6cdad20dfeff
Parents: b1203e6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Sep 10 17:55:00 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Sep 10 17:55:00 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/878080dc/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
index 3294f82..d1057a9 100644
--- a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
+++ b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
@@ -1472,7 +1472,7 @@ namespace Lucene.Net.Util.Packed
             }
         }
 
-        [Test]        
+        [Test, Timeout(180000)]
         public virtual void TestBlockReaderOverflow()
         {
             long valueCount = TestUtil.NextLong(Random(), 1L + int.MaxValue, (long)int.MaxValue * 2);


[42/49] lucenenet git commit: Enabled ignored Search.TestBoolean2.TestRandomQueries()

Posted by sy...@apache.org.
Enabled ignored Search.TestBoolean2.TestRandomQueries()


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

Branch: refs/heads/master
Commit: 751db38b6aca8331fa41f2a8a92c80629bce7574
Parents: 35bf447
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 16:37:06 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 16:37:06 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Search/TestBoolean2.cs | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/751db38b/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
index bf571a5..e8f2e87 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
@@ -284,7 +284,6 @@ namespace Lucene.Net.Search
             }
         }
 
-        [Ignore]
         [Test]
         public virtual void TestRandomQueries()
         {


[49/49] lucenenet git commit: Merge remote-tracking branch '888/core-fst'

Posted by sy...@apache.org.
Merge remote-tracking branch '888/core-fst'


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

Branch: refs/heads/master
Commit: e6012b5a77c670a770f693d9f911e74686b6dca8
Parents: 1946bf8 c7cf589
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Sun Oct 2 13:16:00 2016 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Sun Oct 2 13:16:00 2016 +0300

----------------------------------------------------------------------
 .../Analysis/CharFilter/MappingCharFilter.cs    |   4 +-
 .../Analysis/CharFilter/NormalizeCharMap.cs     |   4 +-
 .../Analysis/Hunspell/Dictionary.cs             |   4 +-
 .../Miscellaneous/StemmerOverrideFilter.cs      |   2 +-
 .../Analysis/Synonym/SynonymFilter.cs           |   2 +-
 .../BlockTerms/VariableGapTermsIndexReader.cs   |   4 +-
 .../Memory/FSTOrdTermsReader.cs                 |  12 +-
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs  |  14 +-
 .../Memory/MemoryPostingsFormat.cs              |   2 +-
 .../Pulsing/PulsingPostingsReader.cs            |   6 +-
 src/Lucene.Net.Core/AssemblyInfo.cs             |  22 +-
 .../Codecs/BlockTreeTermsReader.cs              |  80 +--
 .../Codecs/BlockTreeTermsWriter.cs              |   6 +-
 .../Lucene42/Lucene42DocValuesProducer.cs       |  32 +-
 src/Lucene.Net.Core/Lucene.Net.csproj           |   2 +
 .../Support/AtomicReferenceArray.cs             |  35 +
 .../Support/Compatibility/Collections.cs        | 195 +++++-
 src/Lucene.Net.Core/Support/HashCodeMerge.cs    |  37 ++
 src/Lucene.Net.Core/Support/ObjectExtensions.cs |  56 ++
 src/Lucene.Net.Core/Util/Attribute.cs           |   2 +-
 src/Lucene.Net.Core/Util/AttributeImpl.cs       | 276 ++++----
 src/Lucene.Net.Core/Util/Fst/Builder.cs         | 193 +++---
 .../Util/Fst/ByteSequenceOutputs.cs             |   4 +-
 src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs |  85 ++-
 src/Lucene.Net.Core/Util/Fst/BytesStore.cs      | 198 +++---
 .../Util/Fst/CharSequenceOutputs.cs             |   4 +-
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 650 +++++++++----------
 src/Lucene.Net.Core/Util/Fst/FSTEnum.cs         | 218 +++----
 .../Util/Fst/ForwardBytesReader.cs              |  22 +-
 .../Util/Fst/IntSequenceOutputs.cs              |   4 +-
 src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs  |  85 ++-
 src/Lucene.Net.Core/Util/Fst/NoOutputs.cs       |   4 +-
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        | 110 ++--
 src/Lucene.Net.Core/Util/Fst/PairOutputs.cs     |  44 +-
 .../Util/Fst/ReverseBytesReader.cs              |  20 +-
 src/Lucene.Net.Core/Util/Fst/Util.cs            | 165 ++---
 src/Lucene.Net.Core/Util/NamedThreadFactory.cs  |   2 +-
 src/Lucene.Net.Core/Util/RamUsageEstimator.cs   |  62 +-
 src/Lucene.Net.Core/Util/WeakIdentityMap.cs     | 175 ++---
 .../Lucene.Net.TestFramework.csproj             |   2 +-
 .../Properties/AssemblyInfo.cs                  |  13 +
 .../Util/LuceneTestCase.cs                      |   2 +-
 .../Util/fst/FSTTester.cs                       |  84 ++-
 .../Lucene.Net.Tests.Classification.csproj      |   4 +
 .../SimpleNaiveBayesClassifierTest.cs           |  57 +-
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |  11 +
 .../core/Analysis/TestLookaheadTokenFilter.cs   |   2 +-
 .../core/Analysis/TrivialLookaheadFilter.cs     |   4 +-
 .../Lucene40/TestLucene40DocValuesFormat.cs     |   2 +-
 .../Lucene42/TestLucene42DocValuesFormat.cs     |   2 +-
 .../Perfield/TestPerFieldDocValuesFormat.cs     |   2 +-
 .../core/Document/TestBinaryDocument.cs         |  21 +-
 .../core/Document/TestDateTools.cs              |  14 +-
 .../core/Document/TestDocument.cs               |  42 +-
 src/Lucene.Net.Tests/core/Document/TestField.cs |  44 +-
 .../core/Index/Test2BBinaryDocValues.cs         |  43 +-
 src/Lucene.Net.Tests/core/Index/Test2BDocs.cs   |  39 +-
 .../core/Index/Test2BNumericDocValues.cs        |  48 +-
 .../core/Index/Test2BSortedDocValues.cs         |  44 +-
 .../core/Index/TestAddIndexes.cs                |  89 +--
 .../core/Index/TestBinaryTerms.cs               |  38 +-
 .../core/Index/TestConcurrentMergeScheduler.cs  |   4 +-
 .../core/Index/TestDocValuesFormat.cs           |   2 +-
 .../core/Index/TestFieldsReader.cs              |   2 +-
 .../core/Index/TestIndexReaderClose.cs          |   2 +-
 .../core/Index/TestIndexWriter.cs               |   4 +-
 .../core/Index/TestIndexWriterDelete.cs         |   2 +-
 .../core/Index/TestIndexWriterExceptions.cs     |   2 +-
 .../core/Index/TestLogMergePolicy.cs            |   2 +-
 .../core/Index/TestNRTThreads.cs                |  12 +-
 .../core/Index/TestStressIndexing2.cs           |  45 +-
 .../core/Index/TestTieredMergePolicy.cs         |   2 +-
 .../core/Search/JustCompileSearch.cs            |   4 +-
 .../core/Search/Spans/JustCompileSearchSpans.cs |   2 +-
 .../core/Search/TestBoolean2.cs                 |   1 -
 .../core/Search/TestBooleanQuery.cs             |   2 +-
 .../core/Search/TestDocIdSet.cs                 |   4 +-
 .../core/Search/TestFilteredQuery.cs            |   2 +-
 .../core/Search/TestLiveFieldValues.cs          |   2 +-
 .../core/Search/TestMultiTermConstantScore.cs   |   1 -
 .../core/Search/TestMultiTermQueryRewrites.cs   |   2 +-
 .../core/Search/TestPhraseQuery.cs              |   1 -
 .../core/Search/TestPrefixRandom.cs             |   2 +-
 .../core/Search/TestQueryRescorer.cs            |   6 +-
 .../core/Search/TestRegexpRandom2.cs            |   2 +-
 .../core/Search/TestSearcherManager.cs          |  12 +-
 .../core/Search/TestTopDocsCollector.cs         |   2 +-
 .../core/Store/TestBufferedIndexInput.cs        |   2 +-
 .../core/Store/TestHugeRamFile.cs               |   2 +-
 src/Lucene.Net.Tests/core/TestDemo.cs           | 121 ++--
 src/Lucene.Net.Tests/core/TestExternalCodecs.cs | 264 ++++----
 .../core/TestMergeSchedulerExternal.cs          |  10 +-
 src/Lucene.Net.Tests/core/TestSearch.cs         | 369 ++++++-----
 .../core/TestSearchForDuplicates.cs             | 275 ++++----
 src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs |   6 +-
 .../core/Util/Fst/TestBytesStore.cs             |  74 +--
 src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs  | 384 ++++++-----
 .../core/Util/Packed/TestPackedInts.cs          |  68 +-
 .../core/Util/StressRamUsageEstimator.cs        |  62 +-
 src/Lucene.Net.Tests/core/Util/TestBroadWord.cs |   1 -
 .../core/Util/TestCloseableThreadLocal.cs       |   2 +-
 .../core/Util/TestFilterIterator.cs             |  16 +-
 .../core/Util/TestIdentityHashSet.cs            |  10 +-
 .../core/Util/TestPriorityQueue.cs              |   2 +-
 .../core/Util/TestRamUsageEstimator.cs          |  85 ++-
 .../core/Util/TestRollingBuffer.cs              |   2 +-
 .../core/Util/TestWAH8DocIdSet.cs               |  19 +-
 .../core/Util/TestWeakIdentityMap.cs            | 209 +++---
 108 files changed, 2969 insertions(+), 2587 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e6012b5a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------


[37/49] lucenenet git commit: Updated ignore flag on Index.Test2BSortedDocValues with the message from the Java version that it is very slow.

Posted by sy...@apache.org.
Updated ignore flag on Index.Test2BSortedDocValues with the message from the Java version that it is very slow.


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

Branch: refs/heads/master
Commit: abfe82ce8157b8f813fabe30a672f566daa9027a
Parents: c7e8c86
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 06:21:28 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 06:21:28 2016 +0700

----------------------------------------------------------------------
 .../core/Index/Test2BSortedDocValues.cs         | 44 +++++++++-----------
 1 file changed, 20 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/abfe82ce/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs b/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
index bce3d5b..55e0218 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
@@ -1,39 +1,35 @@
-using System;
 using Lucene.Net.Documents;
+using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Index
 {
-    using NUnit.Framework;
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Document = Documents.Document;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
-    /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
-
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
     using SortedDocValuesField = SortedDocValuesField;
 
-    /*using Ignore = org.junit.Ignore;
-    using TimeoutSuite = com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;*/
-
-    [Ignore]
+    [Ignore("very slow")]
     [TestFixture]
     public class Test2BSortedDocValues : LuceneTestCase
     {


[16/49] lucenenet git commit: Fixed infinite recursion issue and key not found bugs in the FSTTester

Posted by sy...@apache.org.
Fixed infinite recursion issue and key not found bugs in the FSTTester


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

Branch: refs/heads/master
Commit: 8617aa9997568d9fc72743f68784b60f9d2ddbd2
Parents: 01e903b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 8 00:06:47 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:59 2016 +0700

----------------------------------------------------------------------
 .../Util/fst/FSTTester.cs                       | 107 ++++++++++++++++---
 1 file changed, 93 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8617aa99/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 492dca4..ccd2379 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -1,15 +1,15 @@
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
+using NUnit.Framework;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
+using System.Linq;
 
 namespace Lucene.Net.Util.Fst
 {
-    using Lucene.Net.Randomized.Generators;
-    using Lucene.Net.Support;
-    using NUnit.Framework;
-    using System.IO;
-
     /*
          * Licensed to the Apache Software Foundation (ASF) under one or more
          * contributor license agreements.  See the NOTICE file distributed with
@@ -312,7 +312,17 @@ namespace Lucene.Net.Util.Fst
 
             bool willRewrite = Random.NextBoolean();
 
-            Builder<T> builder = new Builder<T>(InputMode == 0 ? FST.INPUT_TYPE.BYTE1 : FST.INPUT_TYPE.BYTE4, prune1, prune2, prune1 == 0 && prune2 == 0, allowRandomSuffixSharing ? Random.NextBoolean() : true, allowRandomSuffixSharing ? TestUtil.NextInt(Random, 1, 10) : int.MaxValue, Outputs, null, willRewrite, PackedInts.DEFAULT, true, 15);
+            Builder<T> builder = new Builder<T>(InputMode == 0 ? FST.INPUT_TYPE.BYTE1 : FST.INPUT_TYPE.BYTE4, 
+                                                prune1, prune2, 
+                                                prune1 == 0 && prune2 == 0, 
+                                                allowRandomSuffixSharing ? Random.NextBoolean() : true, 
+                                                allowRandomSuffixSharing ? TestUtil.NextInt(Random, 1, 10) : int.MaxValue, 
+                                                Outputs, 
+                                                null, 
+                                                willRewrite, 
+                                                PackedInts.DEFAULT, 
+                                                true, 
+                                                15);
             if (LuceneTestCase.VERBOSE)
             {
                 if (willRewrite)
@@ -823,7 +833,7 @@ namespace Lucene.Net.Util.Fst
             //System.out.println("TEST: tally prefixes");
 
             // build all prefixes
-            IDictionary<IntsRef, CountMinOutput<T>> prefixes = new Dictionary<IntsRef, CountMinOutput<T>>();
+            IDictionary<IntsRef, CountMinOutput<T>> prefixes = new HashMap<IntsRef, CountMinOutput<T>>();
             IntsRef scratch = new IntsRef(10);
             foreach (InputOutput<T> pair in Pairs)
             {
@@ -867,11 +877,13 @@ namespace Lucene.Net.Util.Fst
                 Console.WriteLine("TEST: now prune");
             }
 
+
             // prune 'em
-            IEnumerator<KeyValuePair<IntsRef, CountMinOutput<T>>> it = prefixes.GetEnumerator();
-            while (it.MoveNext())
+            // LUCENENET NOTE: Altered this a bit to go in reverse rather than use an enumerator since
+            // in .NET you cannot delete records while enumerating forward through a dictionary.
+            for (int i = prefixes.Count - 1; i >= 0; i--)
             {
-                KeyValuePair<IntsRef, CountMinOutput<T>> ent = it.Current;
+                KeyValuePair<IntsRef, CountMinOutput<T>> ent = prefixes.ElementAt(i);
                 IntsRef prefix = ent.Key;
                 CountMinOutput<T> cmo = ent.Value;
                 if (LuceneTestCase.VERBOSE)
@@ -895,7 +907,7 @@ namespace Lucene.Net.Util.Fst
                         // consult our parent
                         scratch.Length = prefix.Length - 1;
                         Array.Copy(prefix.Ints, prefix.Offset, scratch.Ints, 0, scratch.Length);
-                        CountMinOutput<T> cmo2 = prefixes[scratch];
+                        CountMinOutput<T> cmo2 = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
                         //System.out.println("    parent count = " + (cmo2 == null ? -1 : cmo2.count));
                         keep = cmo2 != null && ((prune2 > 1 && cmo2.Count >= prune2) || (prune2 == 1 && (cmo2.Count >= 2 || prefix.Length <= 1)));
                     }
@@ -911,7 +923,7 @@ namespace Lucene.Net.Util.Fst
 
                 if (!keep)
                 {
-                    it.Reset();
+                    prefixes.Remove(prefix);
                     //System.out.println("    remove");
                 }
                 else
@@ -922,7 +934,7 @@ namespace Lucene.Net.Util.Fst
                     scratch.Length--;
                     while (scratch.Length >= 0)
                     {
-                        CountMinOutput<T> cmo2 = prefixes[scratch];
+                        CountMinOutput<T> cmo2 = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
                         if (cmo2 != null)
                         {
                             //System.out.println("    clear isLeaf " + inputToString(inputMode, scratch));
@@ -933,6 +945,73 @@ namespace Lucene.Net.Util.Fst
                 }
             }
 
+
+            //// prune 'em
+            //IEnumerator<KeyValuePair<IntsRef, CountMinOutput<T>>> it = prefixes.GetEnumerator();
+            //while (it.MoveNext())
+            //{
+            //    KeyValuePair<IntsRef, CountMinOutput<T>> ent = it.Current;
+            //    IntsRef prefix = ent.Key;
+            //    CountMinOutput<T> cmo = ent.Value;
+            //    if (LuceneTestCase.VERBOSE)
+            //    {
+            //        Console.WriteLine("  term prefix=" + InputToString(inputMode, prefix, false) + " count=" + cmo.Count + " isLeaf=" + cmo.IsLeaf + " output=" + Outputs.OutputToString(cmo.Output) + " isFinal=" + cmo.IsFinal);
+            //    }
+            //    bool keep;
+            //    if (prune1 > 0)
+            //    {
+            //        keep = cmo.Count >= prune1;
+            //    }
+            //    else
+            //    {
+            //        Debug.Assert(prune2 > 0);
+            //        if (prune2 > 1 && cmo.Count >= prune2)
+            //        {
+            //            keep = true;
+            //        }
+            //        else if (prefix.Length > 0)
+            //        {
+            //            // consult our parent
+            //            scratch.Length = prefix.Length - 1;
+            //            Array.Copy(prefix.Ints, prefix.Offset, scratch.Ints, 0, scratch.Length);
+            //            CountMinOutput<T> cmo2 = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
+            //            //System.out.println("    parent count = " + (cmo2 == null ? -1 : cmo2.count));
+            //            keep = cmo2 != null && ((prune2 > 1 && cmo2.Count >= prune2) || (prune2 == 1 && (cmo2.Count >= 2 || prefix.Length <= 1)));
+            //        }
+            //        else if (cmo.Count >= prune2)
+            //        {
+            //            keep = true;
+            //        }
+            //        else
+            //        {
+            //            keep = false;
+            //        }
+            //    }
+
+            //    if (!keep)
+            //    {
+            //        it.Reset();
+            //        //System.out.println("    remove");
+            //    }
+            //    else
+            //    {
+            //        // clear isLeaf for all ancestors
+            //        //System.out.println("    keep");
+            //        scratch.CopyInts(prefix);
+            //        scratch.Length--;
+            //        while (scratch.Length >= 0)
+            //        {
+            //            CountMinOutput<T> cmo2 = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
+            //            if (cmo2 != null)
+            //            {
+            //                //System.out.println("    clear isLeaf " + inputToString(inputMode, scratch));
+            //                cmo2.IsLeaf = false;
+            //            }
+            //            scratch.Length--;
+            //        }
+            //    }
+            //}
+
             if (LuceneTestCase.VERBOSE)
             {
                 Console.WriteLine("TEST: after prune");
@@ -967,7 +1046,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     Console.WriteLine("  fstEnum.next prefix=" + InputToString(inputMode, current.Input, false) + " output=" + Outputs.OutputToString(current.Output));
                 }
-                CountMinOutput<T> cmo = prefixes[current.Input];
+                CountMinOutput<T> cmo = prefixes.ContainsKey(current.Input) ? prefixes[current.Input] : null;
                 Assert.IsNotNull(cmo);
                 Assert.IsTrue(cmo.IsLeaf || cmo.IsFinal);
                 //if (cmo.isFinal && !cmo.isLeaf) {


[13/49] lucenenet git commit: Moved BytesRefFSTEnum.InputOutput and IntsRefFSTEnum.InputOutput classes into non-generic classes with the same name so we don't need to specify the generic type twice.

Posted by sy...@apache.org.
Moved BytesRefFSTEnum<T>.InputOutput<T> and IntsRefFSTEnum<T>.InputOutput<T> classes into non-generic classes with the same name so we don't need to specify the generic type twice.


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

Branch: refs/heads/master
Commit: 3994051b243f9e4a39cdda107ac8c6d1d68a78e2
Parents: 18f8443
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 18:07:43 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:55 2016 +0700

----------------------------------------------------------------------
 .../BlockTerms/VariableGapTermsIndexReader.cs   |  4 +-
 .../Memory/FSTOrdTermsReader.cs                 |  2 +-
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs  |  2 +-
 .../Memory/MemoryPostingsFormat.cs              |  2 +-
 .../Codecs/BlockTreeTermsWriter.cs              |  2 +-
 .../Lucene42/Lucene42DocValuesProducer.cs       |  2 +-
 src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs | 41 +++++++++++++-------
 src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs  | 41 +++++++++++++-------
 .../Util/fst/FSTTester.cs                       |  8 ++--
 src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs |  6 +--
 src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs  |  6 +--
 11 files changed, 71 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
index 654ad34..17b808f 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
@@ -202,7 +202,7 @@ namespace Lucene.Net.Codecs.BlockTerms
                     var fstEnum = new BytesRefFSTEnum<long?>(Fst);
                     var count = _vgtir._indexDivisor;
                         
-                    BytesRefFSTEnum<long?>.InputOutput<long?> result;
+                    BytesRefFSTEnum.InputOutput<long?> result;
                     while ((result = fstEnum.Next()) != null)
                     {
                         if (count == _vgtir._indexDivisor)
@@ -226,7 +226,7 @@ namespace Lucene.Net.Codecs.BlockTerms
         protected class IndexEnum : FieldIndexEnum
         {
             private readonly BytesRefFSTEnum<long?> _fstEnum;
-            private BytesRefFSTEnum<long?>.InputOutput<long?> _current;
+            private BytesRefFSTEnum.InputOutput<long?> _current;
 
             public IndexEnum(FST<long?> fst)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
index 7f3f35b..86afc3e 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -531,7 +531,7 @@ namespace Lucene.Net.Codecs.Memory
                 }
 
                 // Update current enum according to FSTEnum
-                private void UpdateEnum(BytesRefFSTEnum<long?>.InputOutput<long?> pair)
+                private void UpdateEnum(BytesRefFSTEnum.InputOutput<long?> pair)
                 {
                     if (pair == null)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
index 79e0365..0077054 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -396,7 +396,7 @@ namespace Lucene.Net.Codecs.Memory
                 }
 
                 // Update current enum according to FSTEnum
-                internal void UpdateEnum(BytesRefFSTEnum<FSTTermOutputs.TermData>.InputOutput<FSTTermOutputs.TermData> pair)
+                internal void UpdateEnum(BytesRefFSTEnum.InputOutput<FSTTermOutputs.TermData> pair)
                 {
                     if (pair == null)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
index ebf7456..88aea52 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
@@ -788,7 +788,7 @@ namespace Lucene.Net.Codecs.Memory
 
             internal int docFreq_Renamed;
             internal long totalTermFreq_Renamed;
-            internal BytesRefFSTEnum<BytesRef>.InputOutput<BytesRef> current;
+            internal BytesRefFSTEnum.InputOutput<BytesRef> current;
             internal BytesRef postingsSpare = new BytesRef();
 
             public FSTTermsEnum(FieldInfo field, FST<BytesRef> fst)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/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 e339aa3..0c32f3b 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
@@ -501,7 +501,7 @@ namespace Lucene.Net.Codecs
             internal void Append(Builder<BytesRef> builder, FST<BytesRef> subIndex)
             {
                 BytesRefFSTEnum<BytesRef> subIndexEnum = new BytesRefFSTEnum<BytesRef>(subIndex);
-                BytesRefFSTEnum<BytesRef>.InputOutput<BytesRef> indexEnt;
+                BytesRefFSTEnum.InputOutput<BytesRef> indexEnt;
                 while ((indexEnt = subIndexEnum.Next()) != null)
                 {
                     //if (DEBUG) {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/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 802ed53..5977d18 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
@@ -489,7 +489,7 @@ namespace Lucene.Net.Codecs.Lucene42
             {
                 try
                 {
-                    BytesRefFSTEnum<long?>.InputOutput<long?> o = FstEnum.SeekCeil(key);
+                    BytesRefFSTEnum.InputOutput<long?> o = FstEnum.SeekCeil(key);
                     if (o == null)
                     {
                         return -ValueCount - 1;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/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 6774b21..8bd5028 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
@@ -29,16 +29,10 @@ namespace Lucene.Net.Util.Fst
     public sealed class BytesRefFSTEnum<T> : FSTEnum<T>
     {
         private readonly BytesRef current = new BytesRef(10);
-        private readonly InputOutput<T> result = new InputOutput<T>();
+        private readonly BytesRefFSTEnum.InputOutput<T> result = new BytesRefFSTEnum.InputOutput<T>();
         private BytesRef target;
 
-        /// <summary>
-        /// Holds a single input (BytesRef) + output pair. </summary>
-        public class InputOutput<T>
-        {
-            public BytesRef Input;
-            public T Output;
-        }
+        // LUCENENET NOTE: InputOutput<T> was moved to the BytesRefFSTEnum class
 
         /// <summary>
         /// doFloor controls the behavior of advance: if it's true
@@ -52,12 +46,12 @@ namespace Lucene.Net.Util.Fst
             current.Offset = 1;
         }
 
-        public InputOutput<T> Current()
+        public BytesRefFSTEnum.InputOutput<T> Current()
         {
             return result;
         }
 
-        public InputOutput<T> Next()
+        public BytesRefFSTEnum.InputOutput<T> Next()
         {
             //System.out.println("  enum.next");
             DoNext();
@@ -66,7 +60,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Seeks to smallest term that's >= target. </summary>
-        public InputOutput<T> SeekCeil(BytesRef target)
+        public BytesRefFSTEnum.InputOutput<T> SeekCeil(BytesRef target)
         {
             this.target = target;
             targetLength = target.Length;
@@ -76,7 +70,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Seeks to biggest term that's <= target. </summary>
-        public InputOutput<T> SeekFloor(BytesRef target)
+        public BytesRefFSTEnum.InputOutput<T> SeekFloor(BytesRef target)
         {
             this.target = target;
             targetLength = target.Length;
@@ -90,7 +84,7 @@ namespace Lucene.Net.Util.Fst
         ///  #seekFloor} or <seealso cref="#seekCeil"/> because it
         ///  short-circuits as soon the match is not found.
         /// </summary>
-        public InputOutput<T> SeekExact(BytesRef target)
+        public BytesRefFSTEnum.InputOutput<T> SeekExact(BytesRef target)
         {
             this.target = target;
             targetLength = target.Length;
@@ -138,7 +132,7 @@ namespace Lucene.Net.Util.Fst
             current.Bytes = ArrayUtil.Grow(current.Bytes, upto + 1);
         }
 
-        private InputOutput<T> SetResult()
+        private BytesRefFSTEnum.InputOutput<T> SetResult()
         {
             if (upto == 0)
             {
@@ -152,4 +146,23 @@ namespace Lucene.Net.Util.Fst
             }
         }
     }
+
+    /// <summary>
+    /// LUCENENET specific. This class is to mimic Java's ability to specify
+    /// nested classes of Generics without having to specify the generic type
+    /// (i.e. BytesRefFSTEnum.InputOutput{T} rather than BytesRefFSTEnum{T}.InputOutput{T})
+    /// </summary>
+    public sealed class BytesRefFSTEnum
+    {
+        private BytesRefFSTEnum()
+        { }
+
+        /// <summary>
+        /// Holds a single input (BytesRef) + output pair. </summary>
+        public class InputOutput<T>
+        {
+            public BytesRef Input;
+            public T Output;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/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 b70d8c4..f679a6f 100644
--- a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
@@ -29,16 +29,10 @@ namespace Lucene.Net.Util.Fst
     public sealed class IntsRefFSTEnum<T> : FSTEnum<T>
     {
         private readonly IntsRef current = new IntsRef(10);
-        private readonly InputOutput<T> result = new InputOutput<T>();
+        private readonly IntsRefFSTEnum.InputOutput<T> result = new IntsRefFSTEnum.InputOutput<T>();
         private IntsRef target;
 
-        /// <summary>
-        /// Holds a single input (IntsRef) + output pair. </summary>
-        public class InputOutput<T>
-        {
-            public IntsRef Input;
-            public T Output;
-        }
+        // LUCENENET NOTE: The InputOutput<T> class was moved into the IntsRefFSTEnum class
 
         /// <summary>
         /// doFloor controls the behavior of advance: if it's true
@@ -52,12 +46,12 @@ namespace Lucene.Net.Util.Fst
             current.Offset = 1;
         }
 
-        public InputOutput<T> Current()
+        public IntsRefFSTEnum.InputOutput<T> Current()
         {
             return result;
         }
 
-        public InputOutput<T> Next()
+        public IntsRefFSTEnum.InputOutput<T> Next()
         {
             //System.out.println("  enum.next");
             DoNext();
@@ -66,7 +60,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Seeks to smallest term that's >= target. </summary>
-        public InputOutput<T> SeekCeil(IntsRef target)
+        public IntsRefFSTEnum.InputOutput<T> SeekCeil(IntsRef target)
         {
             this.target = target;
             targetLength = target.Length;
@@ -76,7 +70,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Seeks to biggest term that's <= target. </summary>
-        public InputOutput<T> SeekFloor(IntsRef target)
+        public IntsRefFSTEnum.InputOutput<T> SeekFloor(IntsRef target)
         {
             this.target = target;
             targetLength = target.Length;
@@ -90,7 +84,7 @@ namespace Lucene.Net.Util.Fst
         ///  #seekFloor} or <seealso cref="#seekCeil"/> because it
         ///  short-circuits as soon the match is not found.
         /// </summary>
-        public InputOutput<T> SeekExact(IntsRef target)
+        public IntsRefFSTEnum.InputOutput<T> SeekExact(IntsRef target)
         {
             this.target = target;
             targetLength = target.Length;
@@ -138,7 +132,7 @@ namespace Lucene.Net.Util.Fst
             current.Ints = ArrayUtil.Grow(current.Ints, upto + 1);
         }
 
-        private InputOutput<T> SetResult()
+        private IntsRefFSTEnum.InputOutput<T> SetResult()
         {
             if (upto == 0)
             {
@@ -152,4 +146,23 @@ namespace Lucene.Net.Util.Fst
             }
         }
     }
+
+    /// <summary>
+    /// LUCENENET specific. This class is to mimic Java's ability to specify
+    /// nested classes of Generics without having to specify the generic type
+    /// (i.e. IntsRefFSTEnum.InputOutput{T} rather than IntsRefFSTEnum{T}.InputOutput{T})
+    /// </summary>
+    public sealed class IntsRefFSTEnum
+    {
+        private IntsRefFSTEnum()
+        { }
+
+        /// <summary>
+        /// Holds a single input (IntsRef) + output pair. </summary>
+        public class InputOutput<T>
+        {
+            public IntsRef Input;
+            public T Output;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/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 e5d6f84..cb5f44d 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -486,7 +486,7 @@ namespace Lucene.Net.Util.Fst
                     Assert.IsTrue(OutputsEqual(pair.Output, output));
 
                     // verify enum's next
-                    IntsRefFSTEnum<T>.InputOutput<T> t = fstEnum.Next();
+                    IntsRefFSTEnum.InputOutput<T> t = fstEnum.Next();
                     Assert.IsNotNull(t);
                     Assert.AreEqual(term, t.Input, "expected input=" + InputToString(inputMode, term) + " but fstEnum returned " + InputToString(inputMode, t.Input));
                     Assert.IsTrue(OutputsEqual(pair.Output, t.Output));
@@ -564,7 +564,7 @@ namespace Lucene.Net.Util.Fst
                             pos = -(pos + 1);
                             // ok doesn't exist
                             //System.out.println("  seek " + inputToString(inputMode, term));
-                            IntsRefFSTEnum<T>.InputOutput<T> seekResult;
+                            IntsRefFSTEnum.InputOutput<T> seekResult;
                             if (Random.Next(3) == 0)
                             {
                                 if (LuceneTestCase.VERBOSE)
@@ -622,7 +622,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     // seek to term that does exist:
                     InputOutput<T> pair = Pairs[Random.Next(Pairs.Count)];
-                    IntsRefFSTEnum<T>.InputOutput<T> seekResult;
+                    IntsRefFSTEnum.InputOutput<T> seekResult;
                     if (Random.Next(3) == 2)
                     {
                         if (LuceneTestCase.VERBOSE)
@@ -960,7 +960,7 @@ namespace Lucene.Net.Util.Fst
                 Console.WriteLine("TEST: check pruned enum");
             }
             IntsRefFSTEnum<T> fstEnum = new IntsRefFSTEnum<T>(fst);
-            IntsRefFSTEnum<T>.InputOutput<T> current;
+            IntsRefFSTEnum.InputOutput<T> current;
             while ((current = fstEnum.Next()) != null)
             {
                 if (LuceneTestCase.VERBOSE)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs b/src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs
index ad2f968..7127487 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/Test2BFST.cs
@@ -111,7 +111,7 @@ namespace Lucene.Net.Util.Fst
                         int upto = 0;
                         while (true)
                         {
-                            IntsRefFSTEnum<object>.InputOutput<object> pair = fstEnum.Next();
+                            IntsRefFSTEnum.InputOutput<object> pair = fstEnum.Next();
                             if (pair == null)
                             {
                                 break;
@@ -200,7 +200,7 @@ namespace Lucene.Net.Util.Fst
                         int upto = 0;
                         while (true)
                         {
-                            IntsRefFSTEnum<BytesRef>.InputOutput<BytesRef> pair = fstEnum.Next();
+                            IntsRefFSTEnum.InputOutput<BytesRef> pair = fstEnum.Next();
                             if (pair == null)
                             {
                                 break;
@@ -293,7 +293,7 @@ namespace Lucene.Net.Util.Fst
                         output = 1;
                         while (true)
                         {
-                            IntsRefFSTEnum<long?>.InputOutput<long?> pair = fstEnum.Next();
+                            IntsRefFSTEnum.InputOutput<long?> pair = fstEnum.Next();
                             if (pair == null)
                             {
                                 break;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3994051b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
index 2e972ad..bb4d206 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
@@ -438,7 +438,7 @@ namespace Lucene.Net.Util.Fst
                         }
 
                         TermsEnum.SeekStatus seekResult = termsEnum.SeekCeil(randomTerm);
-                        BytesRefFSTEnum<long?>.InputOutput<long?> fstSeekResult = fstEnum.SeekCeil(randomTerm);
+                        BytesRefFSTEnum.InputOutput<long?> fstSeekResult = fstEnum.SeekCeil(randomTerm);
 
                         if (seekResult == TermsEnum.SeekStatus.END)
                         {
@@ -472,7 +472,7 @@ namespace Lucene.Net.Util.Fst
                                     {
                                         Console.WriteLine("  end!");
                                     }
-                                    BytesRefFSTEnum<long?>.InputOutput<long?> nextResult = fstEnum.Next();
+                                    BytesRefFSTEnum.InputOutput<long?> nextResult = fstEnum.Next();
                                     if (nextResult != null)
                                     {
                                         Console.WriteLine("expected null but got: input=" + nextResult.Input.Utf8ToString() + " output=" + outputs.OutputToString(nextResult.Output));
@@ -985,7 +985,7 @@ namespace Lucene.Net.Util.Fst
             Assert.AreEqual(17, Util.Get(fst, a));
 
             BytesRefFSTEnum<long?> fstEnum = new BytesRefFSTEnum<long?>(fst);
-            BytesRefFSTEnum<long?>.InputOutput<long?> seekResult;
+            BytesRefFSTEnum.InputOutput<long?> seekResult;
             seekResult = fstEnum.SeekFloor(a);
             Assert.IsNotNull(seekResult);
             Assert.AreEqual(17, seekResult.Output);


[04/49] lucenenet git commit: Ported Core.Util.Fst.TestBytesStore

Posted by sy...@apache.org.
Ported Core.Util.Fst.TestBytesStore


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

Branch: refs/heads/master
Commit: 9a562204f973b8380ead3ed89fc3ee527fa904a9
Parents: 243ada7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Sep 5 19:21:45 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:37 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |  1 +
 .../core/Util/Fst/TestBytesStore.cs             | 74 ++++++++++----------
 2 files changed, 38 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9a562204/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 5c148a2..582a278 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -461,6 +461,7 @@
     <Compile Include="core\Util\Fst\Test2BFST.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\Util\Fst\TestBytesStore.cs" />
     <Compile Include="core\Util\Packed\TestEliasFanoDocIdSet.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9a562204/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
index 52757e3..ec5b8e6 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestBytesStore.cs
@@ -4,7 +4,6 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Util.Fst
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -26,12 +25,14 @@ namespace Lucene.Net.Util.Fst
     using IOContext = Lucene.Net.Store.IOContext;
     using IndexInput = Lucene.Net.Store.IndexInput;
     using IndexOutput = Lucene.Net.Store.IndexOutput;
+    using Support;
+    using Attributes;
 
     [TestFixture]
     public class TestBytesStore : LuceneTestCase
     {
 
-        [Test]
+        [Test, LongRunningTest, Timeout(720000)]
         public virtual void TestRandom()
         {
 
@@ -39,7 +40,7 @@ namespace Lucene.Net.Util.Fst
             for (int iter = 0; iter < iters; iter++)
             {
                 int numBytes = TestUtil.NextInt(Random(), 1, 200000);
-                sbyte[] expected = new sbyte[numBytes];
+                byte[] expected = new byte[numBytes];
                 int blockBits = TestUtil.NextInt(Random(), 8, 15);
                 BytesStore bytes = new BytesStore(blockBits);
                 if (VERBOSE)
@@ -61,7 +62,7 @@ namespace Lucene.Net.Util.Fst
                         case 0:
                             {
                                 // write random byte
-                                sbyte b = (sbyte)Random().Next(256);
+                                byte b = (byte)Random().Next(256);
                                 if (VERBOSE)
                                 {
                                     Console.WriteLine("    writeByte b=" + b);
@@ -76,7 +77,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 // write random byte[]
                                 int len = Random().Next(Math.Min(numBytes - pos, 100));
-                                sbyte[] temp = new sbyte[len];
+                                byte[] temp = new byte[len];
                                 Random().NextBytes(temp);
                                 if (VERBOSE)
                                 {
@@ -99,11 +100,11 @@ namespace Lucene.Net.Util.Fst
                                     {
                                         Console.WriteLine("    abs writeInt pos=" + randomPos + " x=" + x);
                                     }
-                                    bytes.writeInt(randomPos, x);
-                                    expected[randomPos++] = (sbyte)(x >> 24);
-                                    expected[randomPos++] = (sbyte)(x >> 16);
-                                    expected[randomPos++] = (sbyte)(x >> 8);
-                                    expected[randomPos++] = (sbyte)x;
+                                    bytes.WriteInt(randomPos, x);
+                                    expected[randomPos++] = (byte)(x >> 24);
+                                    expected[randomPos++] = (byte)(x >> 16);
+                                    expected[randomPos++] = (byte)(x >> 8);
+                                    expected[randomPos++] = (byte)x;
                                 }
                             }
                             break;
@@ -128,11 +129,11 @@ namespace Lucene.Net.Util.Fst
                                     {
                                         Console.WriteLine("    reverse start=" + start + " end=" + end + " len=" + len + " pos=" + pos);
                                     }
-                                    bytes.reverse(start, end);
+                                    bytes.Reverse(start, end);
 
                                     while (start <= end)
                                     {
-                                        sbyte b = expected[end];
+                                        byte b = expected[end];
                                         expected[end] = expected[start];
                                         expected[start] = b;
                                         start++;
@@ -149,7 +150,7 @@ namespace Lucene.Net.Util.Fst
                                 {
                                     int randomPos = Random().Next(pos - 1);
                                     int len = TestUtil.NextInt(Random(), 1, Math.Min(pos - randomPos - 1, 100));
-                                    sbyte[] temp = new sbyte[len];
+                                    byte[] temp = new byte[len];
                                     Random().NextBytes(temp);
                                     if (VERBOSE)
                                     {
@@ -174,7 +175,7 @@ namespace Lucene.Net.Util.Fst
                                         Console.WriteLine("    copyBytes src=" + src + " dest=" + dest + " len=" + len);
                                     }
                                     Array.Copy(expected, src, expected, dest, len);
-                                    bytes.copyBytes(src, dest, len);
+                                    bytes.CopyBytes(src, dest, len);
                                 }
                             }
                             break;
@@ -190,13 +191,13 @@ namespace Lucene.Net.Util.Fst
                                 }
 
                                 pos += len;
-                                bytes.skipBytes(len);
+                                bytes.SkipBytes(len);
 
                                 // NOTE: must fill in zeros in case truncate was
                                 // used, else we get false fails:
                                 if (len > 0)
                                 {
-                                    sbyte[] zeros = new sbyte[len];
+                                    byte[] zeros = new byte[len];
                                     bytes.WriteBytes(pos - len, zeros, 0, len);
                                 }
                             }
@@ -208,7 +209,7 @@ namespace Lucene.Net.Util.Fst
                                 if (pos > 0)
                                 {
                                     int dest = Random().Next(pos);
-                                    sbyte b = (sbyte)Random().Next(256);
+                                    byte b = (byte)Random().Next(256);
                                     expected[dest] = b;
                                     bytes.WriteByte(dest, b);
                                 }
@@ -222,9 +223,9 @@ namespace Lucene.Net.Util.Fst
                     {
                         // truncate
                         int len = TestUtil.NextInt(Random(), 1, Math.Min(pos, 100));
-                        bytes.truncate(pos - len);
+                        bytes.Truncate(pos - len);
                         pos -= len;
-                        Arrays.fill(expected, pos, pos + len, (sbyte)0);
+                        Arrays.Fill(expected, pos, pos + len, (byte)0);
                         if (VERBOSE)
                         {
                             Console.WriteLine("    truncate len=" + len + " newPos=" + pos);
@@ -247,7 +248,7 @@ namespace Lucene.Net.Util.Fst
                     }
                     Directory dir = NewDirectory();
                     IndexOutput @out = dir.CreateOutput("bytes", IOContext.DEFAULT);
-                    bytes.writeTo(@out);
+                    bytes.WriteTo(@out);
                     @out.Dispose();
                     IndexInput @in = dir.OpenInput("bytes", IOContext.DEFAULT);
                     bytesToVerify = new BytesStore(@in, numBytes, TestUtil.NextInt(Random(), 256, int.MaxValue));
@@ -263,7 +264,7 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        private void Verify(BytesStore bytes, sbyte[] expected, int totalLength)
+        private void Verify(BytesStore bytes, byte[] expected, int totalLength)
         {
             Assert.AreEqual(totalLength, bytes.Position);
             if (totalLength == 0)
@@ -276,7 +277,7 @@ namespace Lucene.Net.Util.Fst
             }
 
             // First verify whole thing in one blast:
-            sbyte[] actual = new sbyte[totalLength];
+            byte[] actual = new byte[totalLength];
             if (Random().NextBoolean())
             {
                 if (VERBOSE)
@@ -284,15 +285,15 @@ namespace Lucene.Net.Util.Fst
                     Console.WriteLine("    bulk: reversed");
                 }
                 // reversed
-                FST.BytesReader r = bytes.ReverseReader;
-                Assert.IsTrue(r.reversed());
-                r.Position = totalLength - 1;
-                r.ReadBytes(actual, 0, actual.Length);
+                FST.BytesReader r2 = bytes.ReverseReader;
+                Assert.IsTrue(r2.Reversed());
+                r2.Position = totalLength - 1;
+                r2.ReadBytes(actual, 0, actual.Length);
                 int start = 0;
                 int end = totalLength - 1;
                 while (start < end)
                 {
-                    sbyte b = actual[start];
+                    byte b = actual[start];
                     actual[start] = actual[end];
                     actual[end] = b;
                     start++;
@@ -306,14 +307,14 @@ namespace Lucene.Net.Util.Fst
                 {
                     Console.WriteLine("    bulk: forward");
                 }
-                FST.BytesReader r = bytes.ForwardReader;
-                Assert.IsFalse(r.reversed());
-                r.ReadBytes(actual, 0, actual.Length);
+                FST.BytesReader r3 = bytes.ForwardReader;
+                Assert.IsFalse(r3.Reversed());
+                r3.ReadBytes(actual, 0, actual.Length);
             }
 
             for (int i = 0; i < totalLength; i++)
             {
-                Assert.AreEqual("byte @ index=" + i, expected[i], actual[i]);
+                assertEquals("byte @ index=" + i, expected[i], actual[i]);
             }
 
             FST.BytesReader r;
@@ -357,13 +358,13 @@ namespace Lucene.Net.Util.Fst
                     {
                         Console.WriteLine("    op iter=" + op + " reversed=" + reversed + " numBytes=" + numBytes + " pos=" + pos);
                     }
-                    sbyte[] temp = new sbyte[numBytes];
+                    byte[] temp = new byte[numBytes];
                     r.Position = pos;
                     Assert.AreEqual(pos, r.Position);
                     r.ReadBytes(temp, 0, temp.Length);
                     for (int i = 0; i < numBytes; i++)
                     {
-                        sbyte expectedByte;
+                        byte expectedByte;
                         if (reversed)
                         {
                             expectedByte = expected[pos - i];
@@ -372,7 +373,7 @@ namespace Lucene.Net.Util.Fst
                         {
                             expectedByte = expected[pos + i];
                         }
-                        Assert.AreEqual("byte @ index=" + i, expectedByte, temp[i]);
+                        assertEquals("byte @ index=" + i, expectedByte, temp[i]);
                     }
 
                     int left;
@@ -418,12 +419,11 @@ namespace Lucene.Net.Util.Fst
                             Console.WriteLine("    readInt");
                         }
 
-                        r.skipBytes(skipBytes);
-                        Assert.AreEqual(expectedInt, r.readInt());
+                        r.SkipBytes(skipBytes);
+                        Assert.AreEqual(expectedInt, r.ReadInt());
                     }
                 }
             }
         }
     }
-
 }
\ No newline at end of file


[22/49] lucenenet git commit: Ported Core.Util.TestIdentityHashSet + fixed bugs in RamUsageEstimator.IdentityHashSet.

Posted by sy...@apache.org.
Ported Core.Util.TestIdentityHashSet + fixed bugs in RamUsageEstimator.IdentityHashSet.


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

Branch: refs/heads/master
Commit: 0c2f5ae9a89eb29ce35835773e308235a5a91579
Parents: 878080d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 00:02:22 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 00:02:22 2016 +0700

----------------------------------------------------------------------
 .../Support/Compatibility/Collections.cs        | 195 ++++++++++++++++++-
 src/Lucene.Net.Core/Util/RamUsageEstimator.cs   |   9 +-
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |   1 +
 .../core/Util/TestIdentityHashSet.cs            |  10 +-
 4 files changed, 205 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c2f5ae9/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Compatibility/Collections.cs b/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
index 8421b39..6165173 100644
--- a/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
+++ b/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
@@ -1,6 +1,9 @@
-\ufeffusing System.Collections.Generic;
+\ufeffusing System;
+using System.Collections;
+using System.Collections.Generic;
 using System.Collections.Immutable;
 using System.Linq;
+using System.Runtime.Serialization;
 
 namespace Lucene.Net
 {
@@ -42,5 +45,195 @@ namespace Lucene.Net
         {
             return new Dictionary<T, S> {{key, value}};
         }
+
+        public static ISet<T> NewSetFromMap<T, S>(IDictionary<T, bool?> map)
+        {
+            return new SetFromMap<T>(map);
+        }
+
+        internal class SetFromMap<T> : ICollection<T>, IEnumerable<T>, IEnumerable, ISerializable, IDeserializationCallback, ISet<T>, IReadOnlyCollection<T>
+        {
+            private readonly IDictionary<T, bool?> m; // The backing map
+            [NonSerialized]
+            private ICollection<T> s;
+
+            internal SetFromMap(IDictionary<T, bool?> map)
+            {
+                if (map.Any())
+                    throw new ArgumentException("Map is not empty");
+                m = map;
+                s = map.Keys;
+            }
+
+            public void Clear()
+            {
+                m.Clear();
+            }
+
+            public int Count
+            {
+                get
+                {
+                    return m.Count;
+                }
+            }
+
+            // LUCENENET: IsEmpty doesn't exist here
+
+            public bool Contains(T item)
+            {
+                return m.ContainsKey(item);
+            }
+
+            public bool Remove(T item)
+            {
+                return m.Remove(item);
+            }
+
+            public bool Add(T item)
+            {
+                m.Add(item, true);
+                return m.ContainsKey(item);
+            }
+
+            void ICollection<T>.Add(T item)
+            {
+                m.Add(item, true);
+            }
+
+            public IEnumerator<T> GetEnumerator()
+            {
+                return s.GetEnumerator();
+            }
+
+            IEnumerator IEnumerable.GetEnumerator()
+            {
+                return s.GetEnumerator();
+            }
+
+            // LUCENENET: ToArray() is part of LINQ
+
+            public override string ToString()
+            {
+                return s.ToString();
+            }
+
+            public override int GetHashCode()
+            {
+                return s.GetHashCode();
+            }
+
+            public override bool Equals(object obj)
+            {
+                return obj == this || s.Equals(obj);
+            }
+
+            public virtual bool ContainsAll(IEnumerable<T> other)
+            {
+                // we don't care about order, so sort both sequences before comparing
+                return this.OrderBy(x => x).SequenceEqual(other.OrderBy(x => x));
+            }
+
+            public void CopyTo(T[] array, int arrayIndex)
+            {
+                m.Keys.CopyTo(array, arrayIndex);
+            }
+
+
+            public bool IsReadOnly
+            {
+                get
+                {
+                    return false;
+                }
+            }
+
+            public bool SetEquals(IEnumerable<T> other)
+            {
+                if (other == null)
+                {
+                    throw new ArgumentNullException("other");
+                }
+                SetFromMap<T> set = other as SetFromMap<T>;
+                if (set != null)
+                {
+                    if (this.m.Count != set.Count)
+                    {
+                        return false;
+                    }
+                    return this.ContainsAll(set);
+                }
+                ICollection<T> is2 = other as ICollection<T>;
+                if (((is2 != null) && (this.m.Count == 0)) && (is2.Count > 0))
+                {
+                    return false;
+                }
+                foreach (var item in this)
+                {
+                    if (!is2.Contains(item))
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+
+            #region Not Implemented Members
+            public void ExceptWith(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void IntersectWith(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public bool IsProperSubsetOf(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public bool IsProperSupersetOf(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public bool IsSubsetOf(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public bool IsSupersetOf(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public bool Overlaps(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void SymmetricExceptWith(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void UnionWith(IEnumerable<T> other)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void OnDeserialization(object sender)
+            {
+                throw new NotImplementedException();
+            }
+            #endregion
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c2f5ae9/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
index 07f6037..de039bf 100644
--- a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
+++ b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Globalization;
 using System.Reflection;
+using System.Runtime.CompilerServices;
 
 namespace Lucene.Net.Util
 {
@@ -717,7 +718,7 @@ namespace Lucene.Net.Util
                 object existing;
                 while ((existing = Keys[slot]) != null)
                 {
-                    if (Object.ReferenceEquals(e, existing))
+                    if (object.ReferenceEquals(e, existing))
                     {
                         return false; // already found.
                     }
@@ -738,7 +739,7 @@ namespace Lucene.Net.Util
                 object existing;
                 while ((existing = Keys[slot]) != null)
                 {
-                    if (Object.ReferenceEquals(e, existing))
+                    if (object.ReferenceEquals(e, existing))
                     {
                         return true;
                     }
@@ -757,7 +758,7 @@ namespace Lucene.Net.Util
             /// <seealso cref= "http://sites.google.com/site/murmurhash/" </seealso>
             internal static int Rehash(object o)
             {
-                int k = o.GetHashCode();
+                int k = RuntimeHelpers.GetHashCode(o);
                 k ^= (int)((uint)k >> 16);
                 k *= unchecked((int)0x85ebca6b);
                 k ^= (int)((uint)k >> 13);
@@ -811,7 +812,7 @@ namespace Lucene.Net.Util
             /// <summary>
             /// Return the next possible capacity, counting from the current buffers' size.
             /// </summary>
-            protected internal int NextCapacity(int current)
+            internal int NextCapacity(int current)
             {
                 Debug.Assert(current > 0 && ((current & (current - 1)) == 0), "Capacity must be a power of two.");
                 Debug.Assert((current << 1) > 0, "Maximum capacity exceeded (" + ((int)((uint)0x80000000 >> 1)) + ").");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c2f5ae9/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 03f336c..dc54705 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -520,6 +520,7 @@
     <Compile Include="core\Util\TestFixedBitSet.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\Util\TestIdentityHashSet.cs" />
     <Compile Include="core\Util\TestIndexableBinaryStringTools.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c2f5ae9/src/Lucene.Net.Tests/core/Util/TestIdentityHashSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestIdentityHashSet.cs b/src/Lucene.Net.Tests/core/Util/TestIdentityHashSet.cs
index b3e420e..bc3fee4 100644
--- a/src/Lucene.Net.Tests/core/Util/TestIdentityHashSet.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestIdentityHashSet.cs
@@ -2,10 +2,10 @@ using System;
 using System.Collections.Generic;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System.Linq;
 
 namespace Lucene.Net.Util
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -31,7 +31,8 @@ namespace Lucene.Net.Util
         public virtual void TestCheck()
         {
             Random rnd = Random();
-            ISet<object> jdk = CollectionsHelper.NewSetFromMap(new IdentityHashMap<object, bool?>());
+
+            ISet<object> jdk = Collections.NewSetFromMap<object, bool?>(new IdentityHashMap<object, bool?>());
             RamUsageEstimator.IdentityHashSet<object> us = new RamUsageEstimator.IdentityHashSet<object>();
 
             int max = 100000;
@@ -50,14 +51,13 @@ namespace Lucene.Net.Util
                 Assert.AreEqual(e1, e2);
             }
 
-            ISet<object> collected = CollectionsHelper.NewSetFromMap(new IdentityHashMap<object, bool?>());
+            ISet<object> collected = Collections.NewSetFromMap<object, bool?>(new IdentityHashMap<object, bool?>());
             foreach (object o in us)
             {
                 collected.Add(o);
             }
 
-            Assert.AreEqual(collected, jdk);
+            assertEquals(collected, jdk);
         }
     }
-
 }
\ No newline at end of file


[27/49] lucenenet git commit: Ported Core.TestSearchForDuplicates

Posted by sy...@apache.org.
Ported Core.TestSearchForDuplicates


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

Branch: refs/heads/master
Commit: 0e77936c82232bbcea94dcc1f59e98fc7961fa6a
Parents: 2c3dbc6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 03:19:31 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 04:19:43 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |   1 +
 .../core/TestSearchForDuplicates.cs             | 275 +++++++++----------
 2 files changed, 138 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e77936c/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 289905b..a20ba5c 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -433,6 +433,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="core\TestSearch.cs" />
+    <Compile Include="core\TestSearchForDuplicates.cs" />
     <Compile Include="core\Util\Automaton\TestBasicOperations.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e77936c/src/Lucene.Net.Tests/core/TestSearchForDuplicates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestSearchForDuplicates.cs b/src/Lucene.Net.Tests/core/TestSearchForDuplicates.cs
index 7b4f114..ec97868 100644
--- a/src/Lucene.Net.Tests/core/TestSearchForDuplicates.cs
+++ b/src/Lucene.Net.Tests/core/TestSearchForDuplicates.cs
@@ -1,9 +1,15 @@
+using Lucene.Net.Analysis;
+using Lucene.Net.Documents;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using NUnit.Framework;
 using System;
+using System.IO;
 
-namespace org.apache.lucene
+namespace Lucene.Net
 {
-
-	/*
+    /*
 	 * Licensed to the Apache Software Foundation (ASF) under one or more
 	 * contributor license agreements.  See the NOTICE file distributed with
 	 * this work for additional information regarding copyright ownership.
@@ -20,139 +26,132 @@ namespace org.apache.lucene
 	 * limitations under the License.
 	 */
 
-
-	using Lucene.Net.Store;
-	using Lucene.Net.Document;
-	using Lucene.Net.Analysis;
-	using Lucene.Net.Index;
-	using Lucene.Net.Search;
-	using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-    using NUnit.Framework;
-
-	public class TestSearchForDuplicates : LuceneTestCase
-	{
-
-	  internal const string PRIORITY_FIELD = "priority";
-	  internal const string ID_FIELD = "id";
-	  internal const string HIGH_PRIORITY = "high";
-	  internal const string MED_PRIORITY = "medium";
-	  internal const string LOW_PRIORITY = "low";
-
-
-	  /// <summary>
-	  /// this test compares search results when using and not using compound
-	  ///  files.
-	  /// 
-	  ///  TODO: There is rudimentary search result validation as well, but it is
-	  ///        simply based on asserting the output observed in the old test case,
-	  ///        without really knowing if the output is correct. Someone needs to
-	  ///        validate this output and make any changes to the checkHits method.
-	  /// </summary>
-	  public virtual void TestRun()
-	  {
-		  StringWriter sw = new StringWriter();
-		  PrintWriter pw = new PrintWriter(sw, true);
-		  int MAX_DOCS = atLeast(225);
-		  DoTest(random(), pw, false, MAX_DOCS);
-		  pw.close();
-		  sw.close();
-		  string multiFileOutput = sw.ToString();
-		  //System.out.println(multiFileOutput);
-
-		  sw = new StringWriter();
-		  pw = new PrintWriter(sw, true);
-		  DoTest(random(), pw, true, MAX_DOCS);
-		  pw.close();
-		  sw.close();
-		  string singleFileOutput = sw.ToString();
-
-		  Assert.AreEqual(multiFileOutput, singleFileOutput);
-	  }
-
-
-	  private void DoTest(Random random, PrintWriter @out, bool useCompoundFiles, int MAX_DOCS)
-	  {
-		  Directory directory = newDirectory();
-		  Analyzer analyzer = new MockAnalyzer(random);
-		  IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
-		  MergePolicy mp = conf.MergePolicy;
-		  mp.NoCFSRatio = useCompoundFiles ? 1.0 : 0.0;
-		  IndexWriter writer = new IndexWriter(directory, conf);
-		  if (VERBOSE)
-		  {
-			Console.WriteLine("TEST: now build index MAX_DOCS=" + MAX_DOCS);
-		  }
-
-		  for (int j = 0; j < MAX_DOCS; j++)
-		  {
-			Document d = new Document();
-			d.Add(newTextField(PRIORITY_FIELD, HIGH_PRIORITY, Field.Store.YES));
-			d.Add(newTextField(ID_FIELD, Convert.ToString(j), Field.Store.YES));
-			writer.addDocument(d);
-		  }
-		  writer.Dispose();
-
-		  // try a search without OR
-		  IndexReader reader = DirectoryReader.Open(directory);
-		  IndexSearcher searcher = newSearcher(reader);
-
-		  Query query = new TermQuery(new Term(PRIORITY_FIELD, HIGH_PRIORITY));
-		  @out.println("Query: " + query.ToString(PRIORITY_FIELD));
-		  if (VERBOSE)
-		  {
-			Console.WriteLine("TEST: search query=" + query);
-		  }
-
-		  Sort sort = new Sort(SortField.FIELD_SCORE, new SortField(ID_FIELD, SortField.Type.INT));
-
-		  ScoreDoc[] hits = searcher.Search(query, null, MAX_DOCS, sort).scoreDocs;
-		  PrintHits(@out, hits, searcher);
-		  CheckHits(hits, MAX_DOCS, searcher);
-
-		  // try a new search with OR
-		  searcher = newSearcher(reader);
-		  hits = null;
-
-		  BooleanQuery booleanQuery = new BooleanQuery();
-		  booleanQuery.Add(new TermQuery(new Term(PRIORITY_FIELD, HIGH_PRIORITY)), BooleanClause.Occur_e.SHOULD);
-		  booleanQuery.Add(new TermQuery(new Term(PRIORITY_FIELD, MED_PRIORITY)), BooleanClause.Occur_e.SHOULD);
-		  @out.println("Query: " + booleanQuery.ToString(PRIORITY_FIELD));
-
-		  hits = searcher.search(booleanQuery, null, MAX_DOCS, sort).scoreDocs;
-		  PrintHits(@out, hits, searcher);
-		  CheckHits(hits, MAX_DOCS, searcher);
-
-		  reader.Close();
-		  directory.Close();
-	  }
-
-
-	  private void PrintHits(PrintWriter @out, ScoreDoc[] hits, IndexSearcher searcher)
-	  {
-		@out.println(hits.Length + " total results\n");
-		for (int i = 0 ; i < hits.Length; i++)
-		{
-		  if (i < 10 || (i > 94 && i < 105))
-		  {
-			Document d = searcher.Doc(hits[i].Doc);
-			@out.println(i + " " + d.Get(ID_FIELD));
-		  }
-		}
-	  }
-
-	  private void CheckHits(ScoreDoc[] hits, int expectedCount, IndexSearcher searcher)
-	  {
-		Assert.AreEqual(expectedCount, hits.Length, "total results");
-		for (int i = 0 ; i < hits.Length; i++)
-		{
-		  if (i < 10 || (i > 94 && i < 105))
-		  {
-			Document d = searcher.Doc(hits[i].Doc);
-			Assert.AreEqual(Convert.ToString(i), d.Get(ID_FIELD), "check " + i);
-		  }
-		}
-	  }
-
-	}
-
+    public class TestSearchForDuplicates : LuceneTestCase
+    {
+
+        internal const string PRIORITY_FIELD = "priority";
+        internal const string ID_FIELD = "id";
+        internal const string HIGH_PRIORITY = "high";
+        internal const string MED_PRIORITY = "medium";
+        internal const string LOW_PRIORITY = "low";
+
+
+        /// <summary>
+        /// this test compares search results when using and not using compound
+        ///  files.
+        /// 
+        ///  TODO: There is rudimentary search result validation as well, but it is
+        ///        simply based on asserting the output observed in the old test case,
+        ///        without really knowing if the output is correct. Someone needs to
+        ///        validate this output and make any changes to the checkHits method.
+        /// </summary>
+        [Test]
+        public void TestRun()
+        {
+            StringWriter sw;
+            string multiFileOutput;
+            string singleFileOutput;
+            int MAX_DOCS = AtLeast(225);
+
+            using (sw = new StringWriter())
+            {
+                DoTest(Random(), sw, false, MAX_DOCS);
+                multiFileOutput = sw.ToString();
+            }
+
+            //System.out.println(multiFileOutput);
+
+            using (sw = new StringWriter())
+            {
+                DoTest(Random(), sw, true, MAX_DOCS);
+                singleFileOutput = sw.ToString();
+            }
+
+            Assert.AreEqual(multiFileOutput, singleFileOutput);
+        }
+
+
+        private void DoTest(Random random, TextWriter @out, bool useCompoundFiles, int MAX_DOCS)
+        {
+            Store.Directory directory = NewDirectory();
+            Analyzer analyzer = new MockAnalyzer(random);
+            IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
+            MergePolicy mp = conf.MergePolicy;
+            mp.NoCFSRatio = useCompoundFiles ? 1.0 : 0.0;
+            IndexWriter writer = new IndexWriter(directory, conf);
+            if (VERBOSE)
+            {
+                Console.WriteLine("TEST: now build index MAX_DOCS=" + MAX_DOCS);
+            }
+
+            for (int j = 0; j < MAX_DOCS; j++)
+            {
+                Documents.Document d = new Documents.Document();
+                d.Add(NewTextField(PRIORITY_FIELD, HIGH_PRIORITY, Field.Store.YES));
+                d.Add(NewTextField(ID_FIELD, Convert.ToString(j), Field.Store.YES));
+                writer.AddDocument(d);
+            }
+            writer.Dispose();
+
+            // try a search without OR
+            IndexReader reader = DirectoryReader.Open(directory);
+            IndexSearcher searcher = NewSearcher(reader);
+
+            Query query = new TermQuery(new Term(PRIORITY_FIELD, HIGH_PRIORITY));
+            @out.WriteLine("Query: " + query.ToString(PRIORITY_FIELD));
+            if (VERBOSE)
+            {
+                Console.WriteLine("TEST: search query=" + query);
+            }
+
+            Sort sort = new Sort(SortField.FIELD_SCORE, new SortField(ID_FIELD, SortField.Type_e.INT));
+
+            ScoreDoc[] hits = searcher.Search(query, null, MAX_DOCS, sort).ScoreDocs;
+            PrintHits(@out, hits, searcher);
+            CheckHits(hits, MAX_DOCS, searcher);
+
+            // try a new search with OR
+            searcher = NewSearcher(reader);
+            hits = null;
+
+            BooleanQuery booleanQuery = new BooleanQuery();
+            booleanQuery.Add(new TermQuery(new Term(PRIORITY_FIELD, HIGH_PRIORITY)), BooleanClause.Occur.SHOULD);
+            booleanQuery.Add(new TermQuery(new Term(PRIORITY_FIELD, MED_PRIORITY)), BooleanClause.Occur.SHOULD);
+            @out.WriteLine("Query: " + booleanQuery.ToString(PRIORITY_FIELD));
+
+            hits = searcher.Search(booleanQuery, null, MAX_DOCS, sort).ScoreDocs;
+            PrintHits(@out, hits, searcher);
+            CheckHits(hits, MAX_DOCS, searcher);
+
+            reader.Dispose();
+            directory.Dispose();
+        }
+
+
+        private void PrintHits(TextWriter @out, ScoreDoc[] hits, IndexSearcher searcher)
+        {
+            @out.WriteLine(hits.Length + " total results\n");
+            for (int i = 0; i < hits.Length; i++)
+            {
+                if (i < 10 || (i > 94 && i < 105))
+                {
+                    Documents.Document d = searcher.Doc(hits[i].Doc);
+                    @out.WriteLine(i + " " + d.Get(ID_FIELD));
+                }
+            }
+        }
+
+        private void CheckHits(ScoreDoc[] hits, int expectedCount, IndexSearcher searcher)
+        {
+            Assert.AreEqual(expectedCount, hits.Length, "total results");
+            for (int i = 0; i < hits.Length; i++)
+            {
+                if (i < 10 || (i > 94 && i < 105))
+                {
+                    Documents.Document d = searcher.Doc(hits[i].Doc);
+                    Assert.AreEqual(Convert.ToString(i), d.Get(ID_FIELD), "check " + i);
+                }
+            }
+        }
+    }
 }
\ No newline at end of file


[41/49] lucenenet git commit: Enabled ignored Search.TestPhraseQuery.TestRandomPhrases()

Posted by sy...@apache.org.
Enabled ignored Search.TestPhraseQuery.TestRandomPhrases()


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

Branch: refs/heads/master
Commit: 35bf447083ffb7e32ba38e0d8500d217b31597bc
Parents: 74ee08c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 16:33:01 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 16:33:01 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/35bf4470/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs b/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
index 9c037e8..d4710e2 100644
--- a/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
@@ -618,7 +618,6 @@ namespace Lucene.Net.Search
             Assert.IsTrue(rewritten is TermQuery);
         }
 
-        [Ignore]
         [Test]
         public virtual void TestRandomPhrases()
         {


[32/49] lucenenet git commit: Finished implementing ignored Core.Index.TestAddIndexes.TestAddIndexMissingCodec()

Posted by sy...@apache.org.
Finished implementing ignored Core.Index.TestAddIndexes.TestAddIndexMissingCodec()


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

Branch: refs/heads/master
Commit: c344d0d210d342ea023a7d5fe972f5ca7d0b6155
Parents: 202c068
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 05:41:50 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 05:41:50 2016 +0700

----------------------------------------------------------------------
 .../core/Index/TestAddIndexes.cs                | 89 ++++++++++----------
 1 file changed, 45 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c344d0d2/src/Lucene.Net.Tests/core/Index/TestAddIndexes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/core/Index/TestAddIndexes.cs
index b3bf19f..1bb045b 100644
--- a/src/Lucene.Net.Tests/core/Index/TestAddIndexes.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestAddIndexes.cs
@@ -1,21 +1,36 @@
+using Lucene.Net.Documents;
+using Lucene.Net.Support;
+using NUnit.Framework;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Threading;
-using Lucene.Net.Documents;
 
 namespace Lucene.Net.Index
 {
-    using Lucene.Net.Support;
-    using NUnit.Framework;
-    using System.IO;
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using Codec = Lucene.Net.Codecs.Codec;
     using Directory = Lucene.Net.Store.Directory;
     using DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator;
-
-    //using Pulsing41PostingsFormat = Lucene.Net.Codecs.pulsing.Pulsing41PostingsFormat;
     using Document = Documents.Document;
     using Field = Field;
     using FieldType = FieldType;
@@ -24,29 +39,12 @@ namespace Lucene.Net.Index
     using LockObtainFailedException = Lucene.Net.Store.LockObtainFailedException;
     using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
-    /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
-
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
     using OpenMode_e = Lucene.Net.Index.IndexWriterConfig.OpenMode_e;
     using PhraseQuery = Lucene.Net.Search.PhraseQuery;
     using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
+    using Pulsing41PostingsFormat = Lucene.Net.Codecs.Pulsing.Pulsing41PostingsFormat;
     using RAMDirectory = Lucene.Net.Store.RAMDirectory;
     using StringField = StringField;
     using TestUtil = Lucene.Net.Util.TestUtil;
@@ -1208,7 +1206,6 @@ namespace Lucene.Net.Index
          * simple test that ensures we getting expected exceptions
          */
         [Test]
-        [Ignore("We don't have all the codecs in place to run this.")]
         public virtual void TestAddIndexMissingCodec()
         {
             BaseDirectoryWrapper toAdd = NewDirectory();
@@ -1228,27 +1225,31 @@ namespace Lucene.Net.Index
                 }
             }
 
-            // LUCENENET TODO: Pulsing41Codec is not in core
-            /*{
-                Directory dir = NewDirectory();
-                IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
-                conf.SetCodec(TestUtil.AlwaysPostingsFormat(new Pulsing41PostingsFormat(1 + Random().Next(20))));
-                IndexWriter w = new IndexWriter(dir, conf);
-                try
-                {
-                    w.AddIndexes(toAdd);
-                    Assert.Fail("no such codec");
-                }
-                catch (System.ArgumentException ex)
+            {
+                using (Directory dir = NewDirectory())
                 {
-                    // expected
+                    IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
+                    conf.SetCodec(TestUtil.AlwaysPostingsFormat(new Pulsing41PostingsFormat(1 + Random().Next(20))));
+                    IndexWriter w = new IndexWriter(dir, conf);
+                    try
+                    {
+                        w.AddIndexes(toAdd);
+                        Assert.Fail("no such codec");
+                    }
+                    catch (System.ArgumentException ex)
+                    {
+                        // expected
+                    }
+                    finally
+                    {
+                        w.Dispose();
+                    }
+                    using (IndexReader open = DirectoryReader.Open(dir))
+                    {
+                        Assert.AreEqual(0, open.NumDocs);
+                    }
                 }
-                w.Dispose();
-                IndexReader open = DirectoryReader.Open(dir);
-                Assert.AreEqual(0, open.NumDocs);
-                open.Dispose();
-                dir.Dispose();
-            }*/
+            }
 
             try
             {


[33/49] lucenenet git commit: Enabled ignored Core.Search.TestMultiTermConstantScore.TestBasics()

Posted by sy...@apache.org.
Enabled ignored Core.Search.TestMultiTermConstantScore.TestBasics()


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

Branch: refs/heads/master
Commit: 72ef18564a463342db09a782b6bb9aae430d6be1
Parents: c344d0d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 05:49:39 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 05:49:39 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Search/TestMultiTermConstantScore.cs | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/72ef1856/src/Lucene.Net.Tests/core/Search/TestMultiTermConstantScore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestMultiTermConstantScore.cs b/src/Lucene.Net.Tests/core/Search/TestMultiTermConstantScore.cs
index 5ae1761..f52d360 100644
--- a/src/Lucene.Net.Tests/core/Search/TestMultiTermConstantScore.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestMultiTermConstantScore.cs
@@ -131,7 +131,6 @@ namespace Lucene.Net.Search
             return query;
         }
 
-        [Ignore]
         [Test]
         public virtual void TestBasics()
         {


[24/49] lucenenet git commit: Fixed String.Format bug in Core.Util.NamedThreadFactory

Posted by sy...@apache.org.
Fixed String.Format bug in Core.Util.NamedThreadFactory


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

Branch: refs/heads/master
Commit: e659c99328f5cfd7089166ec6ed30fd98294905e
Parents: 3b18a74
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 02:23:03 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 02:23:03 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/NamedThreadFactory.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e659c993/src/Lucene.Net.Core/Util/NamedThreadFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/NamedThreadFactory.cs b/src/Lucene.Net.Core/Util/NamedThreadFactory.cs
index 08cc319..7e9b27a 100644
--- a/src/Lucene.Net.Core/Util/NamedThreadFactory.cs
+++ b/src/Lucene.Net.Core/Util/NamedThreadFactory.cs
@@ -31,7 +31,7 @@ namespace Lucene.Net.Util
     {
         private static int ThreadPoolNumber = 1;
         private int ThreadNumber = 1;
-        private const string NAME_PATTERN = "%s-%d-thread";
+        private const string NAME_PATTERN = "{0}-{1}-thread";
         private readonly string ThreadNamePrefix;
 
         /// <summary>


[26/49] lucenenet git commit: Ported Core.TestSearch

Posted by sy...@apache.org.
Ported Core.TestSearch


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

Branch: refs/heads/master
Commit: 2c3dbc639d30c39807ffdcbf0edc1689bd64b19f
Parents: e9e4425
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 03:09:02 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 04:19:27 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj |   1 +
 src/Lucene.Net.Tests/core/TestSearch.cs      | 369 +++++++++++-----------
 2 files changed, 184 insertions(+), 186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2c3dbc63/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 31b2666..289905b 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -432,6 +432,7 @@
     <Compile Include="core\TestMergeSchedulerExternal.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\TestSearch.cs" />
     <Compile Include="core\Util\Automaton\TestBasicOperations.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2c3dbc63/src/Lucene.Net.Tests/core/TestSearch.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestSearch.cs b/src/Lucene.Net.Tests/core/TestSearch.cs
index 236bd7d..d6ab030 100644
--- a/src/Lucene.Net.Tests/core/TestSearch.cs
+++ b/src/Lucene.Net.Tests/core/TestSearch.cs
@@ -1,12 +1,16 @@
+using Lucene.Net.Analysis;
+using Lucene.Net.Documents;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using NUnit.Framework;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using NUnit.Framework;
 
-namespace org.apache.lucene
+namespace Lucene.Net
 {
-
-	/*
+    /*
 	 * Licensed to the Apache Software Foundation (ASF) under one or more
 	 * contributor license agreements.  See the NOTICE file distributed with
 	 * this work for additional information regarding copyright ownership.
@@ -23,186 +27,179 @@ namespace org.apache.lucene
 	 * limitations under the License.
 	 */
 
-
-	using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
-	using Lucene.Net.Store;
-	using Lucene.Net.Document;
-	using Lucene.Net.Analysis;
-	using Lucene.Net.Index;
-	using Lucene.Net.Search;
-
-	/// <summary>
-	/// JUnit adaptation of an older test case SearchTest. </summary>
-	public class TestSearch : LuceneTestCase
-	{
-
-	  public virtual void TestNegativeQueryBoost()
-	  {
-		Query q = new TermQuery(new Term("foo", "bar"));
-		q.Boost = -42f;
-		Assert.AreEqual(-42f, q.Boost, 0.0f);
-
-		Directory directory = newDirectory();
-		try
-		{
-		  Analyzer analyzer = new MockAnalyzer(random());
-		  IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
-
-		  IndexWriter writer = new IndexWriter(directory, conf);
-		  try
-		  {
-			Document d = new Document();
-			d.add(newTextField("foo", "bar", Field.Store.YES));
-			writer.addDocument(d);
-		  }
-		  finally
-		  {
-			writer.close();
-		  }
-
-		  IndexReader reader = DirectoryReader.open(directory);
-		  try
-		  {
-			IndexSearcher searcher = newSearcher(reader);
-
-			ScoreDoc[] hits = searcher.search(q, null, 1000).scoreDocs;
-			Assert.AreEqual(1, hits.Length);
-			Assert.IsTrue("score is not negative: " + hits[0].score, hits[0].score < 0);
-
-			Explanation explain = searcher.explain(q, hits[0].doc);
-			Assert.AreEqual("score doesn't match explanation", hits[0].score, explain.Value, 0.001f);
-			Assert.IsTrue("explain doesn't think doc is a match", explain.Match);
-
-		  }
-		  finally
-		  {
-			reader.close();
-		  }
-		}
-		finally
-		{
-		  directory.close();
-		}
-
-	  }
-
-		/// <summary>
-		/// this test performs a number of searches. It also compares output
-		///  of searches using multi-file index segments with single-file
-		///  index segments.
-		/// 
-		///  TODO: someone should check that the results of the searches are
-		///        still correct by adding assert statements. Right now, the test
-		///        passes if the results are the same between multi-file and
-		///        single-file formats, even if the results are wrong.
-		/// </summary>
-		public virtual void TestSearch()
-		{
-		  StringWriter sw = new StringWriter();
-		  PrintWriter pw = new PrintWriter(sw, true);
-		  DoTestSearch(random(), pw, false);
-		  pw.close();
-		  sw.close();
-		  string multiFileOutput = sw.ToString();
-		  //System.out.println(multiFileOutput);
-
-		  sw = new StringWriter();
-		  pw = new PrintWriter(sw, true);
-		  DoTestSearch(random(), pw, true);
-		  pw.close();
-		  sw.close();
-		  string singleFileOutput = sw.ToString();
-
-		  Assert.AreEqual(multiFileOutput, singleFileOutput);
-		}
-
-
-		private void DoTestSearch(Random random, PrintWriter @out, bool useCompoundFile)
-		{
-		  Directory directory = newDirectory();
-		  Analyzer analyzer = new MockAnalyzer(random);
-		  IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
-		  MergePolicy mp = conf.MergePolicy;
-		  mp.NoCFSRatio = useCompoundFile ? 1.0 : 0.0;
-		  IndexWriter writer = new IndexWriter(directory, conf);
-
-		  string[] docs = new string[] {"a b c d e", "a b c d e a b c d e", "a b c d e f g h i j", "a c e", "e c a", "a c e a c e", "a c e a b c"};
-		  for (int j = 0; j < docs.Length; j++)
-		  {
-			Document d = new Document();
-			d.add(newTextField("contents", docs[j], Field.Store.YES));
-			d.add(newStringField("id", "" + j, Field.Store.NO));
-			writer.addDocument(d);
-		  }
-		  writer.close();
-
-		  IndexReader reader = DirectoryReader.open(directory);
-		  IndexSearcher searcher = newSearcher(reader);
-
-		  ScoreDoc[] hits = null;
-
-		  Sort sort = new Sort(SortField.FIELD_SCORE, new SortField("id", SortField.Type.INT));
-
-		  foreach (Query query in BuildQueries())
-		  {
-			@out.println("Query: " + query.ToString("contents"));
-			if (VERBOSE)
-			{
-			  Console.WriteLine("TEST: query=" + query);
-			}
-
-			hits = searcher.search(query, null, 1000, sort).scoreDocs;
-
-			@out.println(hits.Length + " total results");
-			for (int i = 0 ; i < hits.Length && i < 10; i++)
-			{
-			  Document d = searcher.doc(hits[i].doc);
-			  @out.println(i + " " + hits[i].score + " " + d.get("contents"));
-			}
-		  }
-		  reader.close();
-		  directory.close();
-		}
-
-	  private IList<Query> BuildQueries()
-	  {
-		IList<Query> queries = new List<Query>();
-
-		BooleanQuery booleanAB = new BooleanQuery();
-		booleanAB.add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur_e.SHOULD);
-		booleanAB.add(new TermQuery(new Term("contents", "b")), BooleanClause.Occur_e.SHOULD);
-		queries.Add(booleanAB);
-
-		PhraseQuery phraseAB = new PhraseQuery();
-		phraseAB.add(new Term("contents", "a"));
-		phraseAB.add(new Term("contents", "b"));
-		queries.Add(phraseAB);
-
-		PhraseQuery phraseABC = new PhraseQuery();
-		phraseABC.add(new Term("contents", "a"));
-		phraseABC.add(new Term("contents", "b"));
-		phraseABC.add(new Term("contents", "c"));
-		queries.Add(phraseABC);
-
-		BooleanQuery booleanAC = new BooleanQuery();
-		booleanAC.add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur_e.SHOULD);
-		booleanAC.add(new TermQuery(new Term("contents", "c")), BooleanClause.Occur_e.SHOULD);
-		queries.Add(booleanAC);
-
-		PhraseQuery phraseAC = new PhraseQuery();
-		phraseAC.add(new Term("contents", "a"));
-		phraseAC.add(new Term("contents", "c"));
-		queries.Add(phraseAC);
-
-		PhraseQuery phraseACE = new PhraseQuery();
-		phraseACE.add(new Term("contents", "a"));
-		phraseACE.add(new Term("contents", "c"));
-		phraseACE.add(new Term("contents", "e"));
-		queries.Add(phraseACE);
-
-		return queries;
-	  }
-	}
-
+    /// <summary>
+    /// JUnit adaptation of an older test case SearchTest. </summary>
+    public class TestSearch_ : LuceneTestCase
+    {
+        [Test]
+        public virtual void TestNegativeQueryBoost()
+        {
+            Query q = new TermQuery(new Term("foo", "bar"));
+            q.Boost = -42f;
+            Assert.AreEqual(-42f, q.Boost, 0.0f);
+
+            Store.Directory directory = NewDirectory();
+            try
+            {
+                Analyzer analyzer = new MockAnalyzer(Random());
+                IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
+
+                IndexWriter writer = new IndexWriter(directory, conf);
+                try
+                {
+                    Documents.Document d = new Documents.Document();
+                    d.Add(NewTextField("foo", "bar", Field.Store.YES));
+                    writer.AddDocument(d);
+                }
+                finally
+                {
+                    writer.Dispose();
+                }
+
+                IndexReader reader = DirectoryReader.Open(directory);
+                try
+                {
+                    IndexSearcher searcher = NewSearcher(reader);
+
+                    ScoreDoc[] hits = searcher.Search(q, null, 1000).ScoreDocs;
+                    Assert.AreEqual(1, hits.Length);
+                    Assert.IsTrue(hits[0].Score < 0, "score is not negative: " + hits[0].Score);
+
+                    Explanation explain = searcher.Explain(q, hits[0].Doc);
+                    Assert.AreEqual(hits[0].Score, explain.Value, 0.001f, "score doesn't match explanation");
+                    Assert.IsTrue(explain.IsMatch, "explain doesn't think doc is a match");
+
+                }
+                finally
+                {
+                    reader.Dispose();
+                }
+            }
+            finally
+            {
+                directory.Dispose();
+            }
+
+        }
+
+        /// <summary>
+        /// this test performs a number of searches. It also compares output
+        ///  of searches using multi-file index segments with single-file
+        ///  index segments.
+        /// 
+        ///  TODO: someone should check that the results of the searches are
+        ///        still correct by adding assert statements. Right now, the test
+        ///        passes if the results are the same between multi-file and
+        ///        single-file formats, even if the results are wrong.
+        /// </summary>
+        [Test]
+        public virtual void TestSearch()
+        {
+            StringWriter sw;
+            string multiFileOutput;
+            string singleFileOutput;
+            using (sw = new StringWriter())
+            {
+                DoTestSearch(Random(), sw, false);
+                multiFileOutput = sw.ToString();
+            }
+
+            //System.out.println(multiFileOutput);
+
+            using (sw = new StringWriter())
+            {
+                DoTestSearch(Random(), sw, true);
+                singleFileOutput = sw.ToString();
+            }
+
+            Assert.AreEqual(multiFileOutput, singleFileOutput);
+        }
+
+
+        private void DoTestSearch(Random random, StringWriter @out, bool useCompoundFile)
+        {
+            Store.Directory directory = NewDirectory();
+            Analyzer analyzer = new MockAnalyzer(random);
+            IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
+            MergePolicy mp = conf.MergePolicy;
+            mp.NoCFSRatio = useCompoundFile ? 1.0 : 0.0;
+            IndexWriter writer = new IndexWriter(directory, conf);
+
+            string[] docs = new string[] { "a b c d e", "a b c d e a b c d e", "a b c d e f g h i j", "a c e", "e c a", "a c e a c e", "a c e a b c" };
+            for (int j = 0; j < docs.Length; j++)
+            {
+                Documents.Document d = new Documents.Document();
+                d.Add(NewTextField("contents", docs[j], Field.Store.YES));
+                d.Add(NewStringField("id", "" + j, Field.Store.NO));
+                writer.AddDocument(d);
+            }
+            writer.Dispose();
+
+            IndexReader reader = DirectoryReader.Open(directory);
+            IndexSearcher searcher = NewSearcher(reader);
+
+            ScoreDoc[] hits = null;
+
+            Sort sort = new Sort(SortField.FIELD_SCORE, new SortField("id", SortField.Type_e.INT));
+
+            foreach (Query query in BuildQueries())
+            {
+                @out.WriteLine("Query: " + query.ToString("contents"));
+                if (VERBOSE)
+                {
+                    Console.WriteLine("TEST: query=" + query);
+                }
+
+                hits = searcher.Search(query, null, 1000, sort).ScoreDocs;
+
+                @out.WriteLine(hits.Length + " total results");
+                for (int i = 0; i < hits.Length && i < 10; i++)
+                {
+                    Documents.Document d = searcher.Doc(hits[i].Doc);
+                    @out.WriteLine(i + " " + hits[i].Score + " " + d.Get("contents"));
+                }
+            }
+            reader.Dispose();
+            directory.Dispose();
+        }
+
+        private IList<Query> BuildQueries()
+        {
+            IList<Query> queries = new List<Query>();
+
+            BooleanQuery booleanAB = new BooleanQuery();
+            booleanAB.Add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur.SHOULD);
+            booleanAB.Add(new TermQuery(new Term("contents", "b")), BooleanClause.Occur.SHOULD);
+            queries.Add(booleanAB);
+
+            PhraseQuery phraseAB = new PhraseQuery();
+            phraseAB.Add(new Term("contents", "a"));
+            phraseAB.Add(new Term("contents", "b"));
+            queries.Add(phraseAB);
+
+            PhraseQuery phraseABC = new PhraseQuery();
+            phraseABC.Add(new Term("contents", "a"));
+            phraseABC.Add(new Term("contents", "b"));
+            phraseABC.Add(new Term("contents", "c"));
+            queries.Add(phraseABC);
+
+            BooleanQuery booleanAC = new BooleanQuery();
+            booleanAC.Add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur.SHOULD);
+            booleanAC.Add(new TermQuery(new Term("contents", "c")), BooleanClause.Occur.SHOULD);
+            queries.Add(booleanAC);
+
+            PhraseQuery phraseAC = new PhraseQuery();
+            phraseAC.Add(new Term("contents", "a"));
+            phraseAC.Add(new Term("contents", "c"));
+            queries.Add(phraseAC);
+
+            PhraseQuery phraseACE = new PhraseQuery();
+            phraseACE.Add(new Term("contents", "a"));
+            phraseACE.Add(new Term("contents", "c"));
+            phraseACE.Add(new Term("contents", "e"));
+            queries.Add(phraseACE);
+
+            return queries;
+        }
+    }
 }
\ No newline at end of file


[07/49] lucenenet git commit: Ported Core.Util.Packed.TestPackedInts

Posted by sy...@apache.org.
Ported Core.Util.Packed.TestPackedInts


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

Branch: refs/heads/master
Commit: 5effb005955f357825cb9447f186b221a8d63cb7
Parents: 3da18fb
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 02:01:26 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:48 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |  1 +
 .../core/Util/Packed/TestPackedInts.cs          | 66 ++++++++++----------
 2 files changed, 35 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5effb005/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index f030b0d..955d5bc 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -469,6 +469,7 @@
     <Compile Include="core\Util\Packed\TestEliasFanoSequence.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\Util\Packed\TestPackedInts.cs" />
     <Compile Include="core\Util\Test2BPagedBytes.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5effb005/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
index 0807aa5..3294f82 100644
--- a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
+++ b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
@@ -8,7 +8,6 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Util.Packed
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -26,7 +25,6 @@ namespace Lucene.Net.Util.Packed
      * limitations under the License.
      */
 
-
     using CodecUtil = Lucene.Net.Codecs.CodecUtil;
     using ByteArrayDataInput = Lucene.Net.Store.ByteArrayDataInput;
     using DataInput = Lucene.Net.Store.DataInput;
@@ -984,6 +982,7 @@ namespace Lucene.Net.Util.Packed
         }
 
         [Test]
+        [Ignore("LUCENENET TODO: LongBuffer and the method AsLongBuffer are not yet ported, so we cannot currently run this test without porting or finding an alternative way to compare the data.")]
         public virtual void TestEncodeDecode()
         {
             foreach (PackedInts.Format format in PackedInts.Format.Values())
@@ -1060,35 +1059,38 @@ namespace Lucene.Net.Util.Packed
                         Assert.AreEqual(blocks2, blocks3, msg);
                     }
 
-                    // 4. byte[] decoding
-                    sbyte[] byteBlocks = new sbyte[8 * blocks.Length];
-                    ByteBuffer.Wrap((byte[])(Array)byteBlocks).AsLongBuffer().Put(blocks);
-                    long[] values2 = new long[valuesOffset + longIterations * longValueCount];
-                    decoder.Decode(byteBlocks, blocksOffset * 8, values2, valuesOffset, byteIterations);
-                    foreach (long value in values2)
-                    {
-                        Assert.IsTrue(value <= PackedInts.MaxValue(bpv), msg);
-                    }
-                    Assert.AreEqual(values, values2, msg);
-                    // test decoding to int[]
-                    if (bpv <= 32)
-                    {
-                        int[] intValues2 = new int[values2.Length];
-                        decoder.Decode(byteBlocks, blocksOffset * 8, intValues2, valuesOffset, byteIterations);
-                        Assert.IsTrue(Equals(intValues2, values2), msg);
-                    }
-
-                    // 5. byte[] encoding
-                    sbyte[] blocks3_ = new sbyte[8 * (blocksOffset2 + blocksLen)];
-                    encoder.Encode(values, valuesOffset, blocks3_, 8 * blocksOffset2, byteIterations);
-                    Assert.AreEqual(msg, LongBuffer.Wrap(blocks2), ByteBuffer.Wrap((byte[])(Array)blocks3_).AsLongBuffer());
-                    // test encoding from int[]
-                    if (bpv <= 32)
-                    {
-                        sbyte[] blocks4 = new sbyte[blocks3_.Length];
-                        encoder.Encode(intValues, valuesOffset, blocks4, 8 * blocksOffset2, byteIterations);
-                        Assert.AreEqual(blocks3_, blocks4, msg);
-                    }
+                    // LUCENENET TODO: LongBuffer and the method AsLongBuffer are not yet ported, so we
+                    // cannot currently run the following tests.
+
+                    //// 4. byte[] decoding
+                    //byte[] byteBlocks = new byte[8 * blocks.Length];
+                    //ByteBuffer.Wrap(byteBlocks).AsLongBuffer().Put(blocks);
+                    //long[] values2 = new long[valuesOffset + longIterations * longValueCount];
+                    //decoder.Decode(byteBlocks, blocksOffset * 8, values2, valuesOffset, byteIterations);
+                    //foreach (long value in values2)
+                    //{
+                    //    Assert.IsTrue(value <= PackedInts.MaxValue(bpv), msg);
+                    //}
+                    //Assert.AreEqual(values, values2, msg);
+                    //// test decoding to int[]
+                    //if (bpv <= 32)
+                    //{
+                    //    int[] intValues2 = new int[values2.Length];
+                    //    decoder.Decode(byteBlocks, blocksOffset * 8, intValues2, valuesOffset, byteIterations);
+                    //    Assert.IsTrue(Equals(intValues2, values2), msg);
+                    //}
+
+                    //// 5. byte[] encoding
+                    //byte[] blocks3_ = new byte[8 * (blocksOffset2 + blocksLen)];
+                    //encoder.Encode(values, valuesOffset, blocks3_, 8 * blocksOffset2, byteIterations);
+                    //assertEquals(msg, LongBuffer.Wrap(blocks2), ByteBuffer.Wrap(blocks3_).AsLongBuffer());
+                    //// test encoding from int[]
+                    //if (bpv <= 32)
+                    //{
+                    //    byte[] blocks4 = new byte[blocks3_.Length];
+                    //    encoder.Encode(intValues, valuesOffset, blocks4, 8 * blocksOffset2, byteIterations);
+                    //    Assert.AreEqual(blocks3_, blocks4, msg);
+                    //}
                 }
             }
         }
@@ -1337,7 +1339,7 @@ namespace Lucene.Net.Util.Packed
                 @out.Dispose();
 
                 IndexInput in1 = dir.OpenInput("out.bin", IOContext.DEFAULT);
-                sbyte[] buf = new sbyte[(int)fp];
+                byte[] buf = new byte[(int)fp];
                 in1.ReadBytes(buf, 0, (int)fp);
                 in1.Seek(0L);
                 ByteArrayDataInput in2 = new ByteArrayDataInput((byte[])(Array)buf);


[20/49] lucenenet git commit: Ported StressRamUsageEstimator & TestRamUsageEstimator + fixed bugs in RamUsageEstimator

Posted by sy...@apache.org.
Ported StressRamUsageEstimator & TestRamUsageEstimator + fixed bugs in RamUsageEstimator


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

Branch: refs/heads/master
Commit: b1203e6b4cb9551fe09999114890e74e77cb6937
Parents: ef889ce
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Sep 10 17:53:32 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Sep 10 17:53:32 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/RamUsageEstimator.cs   | 53 +++++++-----
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |  2 +
 .../core/Util/StressRamUsageEstimator.cs        | 62 +++++---------
 .../core/Util/TestRamUsageEstimator.cs          | 85 ++++++++++----------
 4 files changed, 98 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1203e6b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
index d3f289b..07f6037 100644
--- a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
+++ b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
@@ -111,7 +111,8 @@ namespace Lucene.Net.Util
             int arrayHeader = Constants.JRE_IS_64BIT ? 24 : 12;
             int objectAlignment = Constants.JRE_IS_64BIT ? 8 : 4;
 
-            /* LUCENE-TODO
+
+            /* LUCENENET TODO
 
 		    Type unsafeClass = null;
 		    object tempTheUnsafe = null;
@@ -138,12 +139,15 @@ namespace Lucene.Net.Util
 		    {
 		      // ignore.
 		    }
+            */
 
-		    // "best guess" based on reference size. We will attempt to modify
-		    // these to exact values if there is supported infrastructure.
-		    objectHeader = Constants.JRE_IS_64BIT ? (8 + referenceSize) : 8;
+            // "best guess" based on reference size. We will attempt to modify
+            // these to exact values if there is supported infrastructure.
+            objectHeader = Constants.JRE_IS_64BIT ? (8 + referenceSize) : 8;
 		    arrayHeader = Constants.JRE_IS_64BIT ? (8 + 2 * referenceSize) : 12;
 
+            /* LUCENENET TODO
+             
 		    // get the object header size:
 		    // - first try out if the field offsets are not scaled (see warning in Unsafe docs)
 		    // - get the object header size by getting the field offset of the first field of a dummy object
@@ -187,7 +191,7 @@ namespace Lucene.Net.Util
             NUM_BYTES_OBJECT_HEADER = objectHeader;
             NUM_BYTES_ARRAY_HEADER = arrayHeader;
 
-            /* LUCENE-TODO
+            /* LUCENENET TODO
           // Try to get the object alignment (the default seems to be 8 on Hotspot,
           // regardless of the architecture).
           int objectAlignment = 8;
@@ -207,6 +211,7 @@ namespace Lucene.Net.Util
             // Ignore.
           }
             */
+
             NUM_BYTES_OBJECT_ALIGNMENT = objectAlignment;
 
             JVM_INFO_STRING = "[JVM: " + Constants.JVM_NAME + ", " + Constants.JVM_VERSION + ", " + Constants.JVM_VENDOR + ", " + Constants.JAVA_VENDOR + ", " + Constants.JAVA_VERSION + "]";
@@ -215,7 +220,7 @@ namespace Lucene.Net.Util
         /// <summary>
         /// A handle to <code>sun.misc.Unsafe</code>.
         /// </summary>
-        private static readonly object TheUnsafe;
+        //private static readonly object TheUnsafe;
 
         /// <summary>
         /// A handle to <code>sun.misc.Unsafe#fieldOffset(Field)</code>.
@@ -237,18 +242,18 @@ namespace Lucene.Net.Util
             }
         }
 
-        // Object with just one field to determine the object header size by getting the offset of the dummy field:
-        private sealed class DummyOneFieldObject
-        {
-            public sbyte @base;
-        }
+        //// Object with just one field to determine the object header size by getting the offset of the dummy field:
+        //private sealed class DummyOneFieldObject
+        //{
+        //    public sbyte @base;
+        //}
 
-        // Another test object for checking, if the difference in offsets of dummy1 and dummy2 is 8 bytes.
-        // Only then we can be sure that those are real, unscaled offsets:
-        private sealed class DummyTwoLongObject
-        {
-            public long Dummy1, Dummy2;
-        }
+        //// Another test object for checking, if the difference in offsets of dummy1 and dummy2 is 8 bytes.
+        //// Only then we can be sure that those are real, unscaled offsets:
+        //private sealed class DummyTwoLongObject
+        //{
+        //    public long Dummy1, Dummy2;
+        //}
 
         /// <summary>
         /// Aligns an object size to be the next multiple of <seealso cref="#NUM_BYTES_OBJECT_ALIGNMENT"/>.
@@ -376,7 +381,12 @@ namespace Lucene.Net.Util
             // Walk type hierarchy
             for (; clazz != null; clazz = clazz.BaseType)
             {
-                FieldInfo[] fields = clazz.GetFields(BindingFlags.Public);
+                FieldInfo[] fields = clazz.GetFields(
+                    BindingFlags.Instance | 
+                    BindingFlags.NonPublic | 
+                    BindingFlags.Public | 
+                    BindingFlags.DeclaredOnly | 
+                    BindingFlags.Static);
                 foreach (FieldInfo f in fields)
                 {
                     if (!f.IsStatic)
@@ -525,7 +535,12 @@ namespace Lucene.Net.Util
             List<FieldInfo> referenceFields = new List<FieldInfo>(32);
             for (Type c = clazz; c != null; c = c.BaseType)
             {
-                FieldInfo[] fields = c.GetFields(BindingFlags.Public | BindingFlags.Instance);
+                FieldInfo[] fields = c.GetFields(
+                    BindingFlags.Instance | 
+                    BindingFlags.NonPublic | 
+                    BindingFlags.Public | 
+                    BindingFlags.DeclaredOnly | 
+                    BindingFlags.Static);
                 foreach (FieldInfo f in fields)
                 {
                     if (!f.IsStatic)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1203e6b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 955d5bc..03f336c 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -470,6 +470,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="core\Util\Packed\TestPackedInts.cs" />
+    <Compile Include="core\Util\StressRamUsageEstimator.cs" />
     <Compile Include="core\Util\Test2BPagedBytes.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -562,6 +563,7 @@
     <Compile Include="core\Util\TestQueryBuilder.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\Util\TestRamUsageEstimator.cs" />
     <Compile Include="core\Util\TestRamUsageEstimatorOnWildAnimals.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1203e6b/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs b/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
index 0bc9f75..c0b8533 100644
--- a/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
+++ b/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
+using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
+using System.Globalization;
 
 namespace Lucene.Net.Util
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -50,8 +50,6 @@ namespace Lucene.Net.Util
         [Test]
         public virtual void TestChainedEstimation()
         {
-            MemoryMXBean memoryMXBean = ManagementFactory.MemoryMXBean;
-
             Random rnd = Random();
             Entry first = new Entry();
             try
@@ -59,9 +57,9 @@ namespace Lucene.Net.Util
                 while (true)
                 {
                     // Check the current memory consumption and provide the estimate.
-                    long jvmUsed = memoryMXBean.HeapMemoryUsage.Used;
-                    long estimated = RamUsageEstimator.sizeOf(first);
-                    Console.WriteLine(string.format(Locale.ROOT, "%10d, %10d", jvmUsed, estimated));
+                    long jvmUsed = GC.GetTotalMemory(false);
+                    long estimated = RamUsageEstimator.SizeOf(first);
+                    Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:0000000000}, {1:0000000000}", jvmUsed, estimated));
 
                     // Make a batch of objects.
                     for (int i = 0; i < 5000; i++)
@@ -82,52 +80,48 @@ namespace Lucene.Net.Util
         [Test]
         public virtual void TestLargeSetOfByteArrays()
         {
-            MemoryMXBean memoryMXBean = ManagementFactory.MemoryMXBean;
-
             CauseGc();
-            long before = memoryMXBean.HeapMemoryUsage.Used;
+            long before = GC.GetTotalMemory(false);
             object[] all = new object[1000000];
             for (int i = 0; i < all.Length; i++)
             {
                 all[i] = new sbyte[Random().Next(3)];
             }
             CauseGc();
-            long after = memoryMXBean.HeapMemoryUsage.Used;
-            Console.WriteLine("mx:  " + RamUsageEstimator.humanReadableUnits(after - before));
-            Console.WriteLine("rue: " + RamUsageEstimator.humanReadableUnits(ShallowSizeOf(all)));
+            long after = GC.GetTotalMemory(false);
+            Console.WriteLine("mx:  " + RamUsageEstimator.HumanReadableUnits(after - before));
+            Console.WriteLine("rue: " + RamUsageEstimator.HumanReadableUnits(ShallowSizeOf(all)));
 
             Guard = all;
         }
 
         private long ShallowSizeOf(object[] all)
         {
-            long s = RamUsageEstimator.shallowSizeOf(all);
+            long s = RamUsageEstimator.ShallowSizeOf(all);
             foreach (object o in all)
             {
-                s += RamUsageEstimator.shallowSizeOf(o);
+                s += RamUsageEstimator.ShallowSizeOf(o);
             }
             return s;
         }
 
         private long ShallowSizeOf(object[][] all)
         {
-            long s = RamUsageEstimator.shallowSizeOf(all);
+            long s = RamUsageEstimator.ShallowSizeOf(all);
             foreach (object[] o in all)
             {
-                s += RamUsageEstimator.shallowSizeOf(o);
+                s += RamUsageEstimator.ShallowSizeOf(o);
                 foreach (object o2 in o)
                 {
-                    s += RamUsageEstimator.shallowSizeOf(o2);
+                    s += RamUsageEstimator.ShallowSizeOf(o2);
                 }
             }
             return s;
         }
 
-        [Test]
+        [Test, Timeout(180000)]
         public virtual void TestSimpleByteArrays()
         {
-            MemoryMXBean memoryMXBean = ManagementFactory.MemoryMXBean;
-
             object[][] all = new object[0][];
             try
             {
@@ -135,18 +129,18 @@ namespace Lucene.Net.Util
                 {
                     // Check the current memory consumption and provide the estimate.
                     CauseGc();
-                    MemoryUsage mu = memoryMXBean.HeapMemoryUsage;
+                    
                     long estimated = ShallowSizeOf(all);
                     if (estimated > 50 * RamUsageEstimator.ONE_MB)
                     {
                         break;
                     }
 
-                    Console.WriteLine(string.format(Locale.ROOT, "%10s\t%10s\t%10s", RamUsageEstimator.humanReadableUnits(mu.Used), RamUsageEstimator.humanReadableUnits(mu.Max), RamUsageEstimator.humanReadableUnits(estimated)));
+                    Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0}\t{1}\t{2}", RamUsageEstimator.HumanReadableUnits(GC.GetTotalMemory(false)).PadLeft(10, ' '), RamUsageEstimator.HumanReadableUnits(GC.MaxGeneration).PadLeft(10, ' '), RamUsageEstimator.HumanReadableUnits(estimated).PadLeft(10, ' ')));
 
                     // Make another batch of objects.
                     object[] seg = new object[10000];
-                    all = Arrays.copyOf(all, all.Length + 1);
+                    all = Arrays.CopyOf(all, all.Length + 1);
                     all[all.Length - 1] = seg;
                     for (int i = 0; i < seg.Length; i++)
                     {
@@ -166,23 +160,7 @@ namespace Lucene.Net.Util
         /// </summary>
         private void CauseGc()
         {
-            IList<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory.GarbageCollectorMXBeans;
-            IList<long?> ccounts = new List<long?>();
-            foreach (GarbageCollectorMXBean g in garbageCollectorMXBeans)
-            {
-                ccounts.Add(g.CollectionCount);
-            }
-            IList<long?> ccounts2 = new List<long?>();
-            do
-            {
-                System.gc();
-                ccounts.Clear();
-                foreach (GarbageCollectorMXBean g in garbageCollectorMXBeans)
-                {
-                    ccounts2.Add(g.CollectionCount);
-                }
-            } while (ccounts2.Equals(ccounts));
+            GC.Collect();
         }
     }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1203e6b/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimator.cs b/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimator.cs
index 113e730..b08739d 100644
--- a/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimator.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimator.cs
@@ -1,10 +1,8 @@
-using System;
-using Lucene.Net.Util;
 using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Util
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -25,22 +23,22 @@ namespace Lucene.Net.Util
     [TestFixture]
     public class TestRamUsageEstimator : LuceneTestCase
     {
-        /*[Test]
+        [Test]
         public virtual void TestSanity()
         {
-            Assert.IsTrue(sizeof(new string("test string")) > ShallowSizeOfInstance(typeof(string)));
+            Assert.IsTrue(RamUsageEstimator.SizeOf("test string") > RamUsageEstimator.ShallowSizeOfInstance(typeof(string)));
 
             Holder holder = new Holder();
             holder.Holder_Renamed = new Holder("string2", 5000L);
-            Assert.IsTrue(sizeof(holder) > shallowSizeOfInstance(typeof(Holder)));
-            Assert.IsTrue(sizeof(holder) > sizeof(holder.Holder_Renamed));
+            Assert.IsTrue(RamUsageEstimator.SizeOf(holder) > RamUsageEstimator.ShallowSizeOfInstance(typeof(Holder)));
+            Assert.IsTrue(RamUsageEstimator.SizeOf(holder) > RamUsageEstimator.SizeOf(holder.Holder_Renamed));
 
-            Assert.IsTrue(shallowSizeOfInstance(typeof(HolderSubclass)) >= shallowSizeOfInstance(typeof(Holder)));
-            Assert.IsTrue(shallowSizeOfInstance(typeof(Holder)) == shallowSizeOfInstance(typeof(HolderSubclass2)));
+            Assert.IsTrue(RamUsageEstimator.ShallowSizeOfInstance(typeof(HolderSubclass)) >= RamUsageEstimator.ShallowSizeOfInstance(typeof(Holder)));
+            Assert.IsTrue(RamUsageEstimator.ShallowSizeOfInstance(typeof(Holder)) == RamUsageEstimator.ShallowSizeOfInstance(typeof(HolderSubclass2)));
 
-            string[] strings = new string[] { new string("test string"), new string("hollow"), new string("catchmaster") };
-            Assert.IsTrue(sizeof(strings) > shallowSizeOf(strings));
-        }*/
+            string[] strings = new string[] { "test string", "hollow", "catchmaster" };
+            Assert.IsTrue(RamUsageEstimator.SizeOf(strings) > RamUsageEstimator.ShallowSizeOf(strings));
+        }
 
         [Test]
         public virtual void TestStaticOverloads()
@@ -48,73 +46,74 @@ namespace Lucene.Net.Util
             Random rnd = Random();
             {
                 sbyte[] array = new sbyte[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 bool[] array = new bool[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 char[] array = new char[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 short[] array = new short[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 int[] array = new int[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 float[] array = new float[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 long[] array = new long[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
 
             {
                 double[] array = new double[rnd.Next(1024)];
-                Assert.AreEqual(sizeof(array), sizeof((object)array));
+                assertEquals(RamUsageEstimator.SizeOf(array), RamUsageEstimator.SizeOf((object)array));
             }
         }
 
-        /* LUCENE PORT: The JVM is obviously not relevant to our purposes
-        [Test]
+        
+       [Test]
         public virtual void TestReferenceSize()
         {
-            if (!SupportedJVM)
-            {
-                Console.Error.WriteLine("WARN: Your JVM does not support certain Oracle/Sun extensions.");
-                Console.Error.WriteLine(" Memory estimates may be inaccurate.");
-                Console.Error.WriteLine(" Please report this to the Lucene mailing list.");
-                Console.Error.WriteLine("JVM version: " + RamUsageEstimator.JVM_INFO_STRING);
-                Console.Error.WriteLine("UnsupportedFeatures:");
-                foreach (JvmFeature f in RamUsageEstimator.UnsupportedFeatures)
-                {
-                    Console.Error.Write(" - " + f.ToString());
-                    if (f == RamUsageEstimator.JvmFeature.OBJECT_ALIGNMENT)
-                    {
-                        Console.Error.Write("; Please note: 32bit Oracle/Sun VMs don't allow exact OBJECT_ALIGNMENT retrieval, this is a known issue.");
-                    }
-                    Console.Error.WriteLine();
-                }
-            }
-
-            Assert.IsTrue(NUM_BYTES_OBJECT_REF == 4 || NUM_BYTES_OBJECT_REF == 8);
+            //LUCENENET: The JVM is obviously not relevant to our purposes
+            //if (!SupportedJVM)
+            //{
+            //    Console.Error.WriteLine("WARN: Your JVM does not support certain Oracle/Sun extensions.");
+            //    Console.Error.WriteLine(" Memory estimates may be inaccurate.");
+            //    Console.Error.WriteLine(" Please report this to the Lucene mailing list.");
+            //    Console.Error.WriteLine("JVM version: " + RamUsageEstimator.JVM_INFO_STRING);
+            //    Console.Error.WriteLine("UnsupportedFeatures:");
+            //    foreach (JvmFeature f in RamUsageEstimator.UnsupportedFeatures)
+            //    {
+            //        Console.Error.Write(" - " + f.ToString());
+            //        if (f == RamUsageEstimator.JvmFeature.OBJECT_ALIGNMENT)
+            //        {
+            //            Console.Error.Write("; Please note: 32bit Oracle/Sun VMs don't allow exact OBJECT_ALIGNMENT retrieval, this is a known issue.");
+            //        }
+            //        Console.Error.WriteLine();
+            //    }
+            //}
+
+            Assert.IsTrue(RamUsageEstimator.NUM_BYTES_OBJECT_REF == 4 || RamUsageEstimator.NUM_BYTES_OBJECT_REF == 8);
             if (!Constants.JRE_IS_64BIT)
             {
-                Assert.AreEqual("For 32bit JVMs, reference size must always be 4?", 4, NUM_BYTES_OBJECT_REF);
+                assertEquals("For 32bit JVMs, reference size must always be 4?", 4, RamUsageEstimator.NUM_BYTES_OBJECT_REF);
             }
-        }*/
+        }
 
         private class Holder
         {


[34/49] lucenenet git commit: Enabled ignored Lucene.Net.Index.TestBinaryTerms.TestBinary()

Posted by sy...@apache.org.
Enabled ignored Lucene.Net.Index.TestBinaryTerms.TestBinary()


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

Branch: refs/heads/master
Commit: 0146b478a6f593ba2d699c68b07979cacbfcf82e
Parents: 72ef185
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 05:57:14 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 05:57:14 2016 +0700

----------------------------------------------------------------------
 .../core/Index/TestBinaryTerms.cs               | 38 ++++++++++----------
 1 file changed, 18 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0146b478/src/Lucene.Net.Tests/core/Index/TestBinaryTerms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestBinaryTerms.cs b/src/Lucene.Net.Tests/core/Index/TestBinaryTerms.cs
index 0c0fabc..2ae675c 100644
--- a/src/Lucene.Net.Tests/core/Index/TestBinaryTerms.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestBinaryTerms.cs
@@ -1,28 +1,27 @@
 using Lucene.Net.Documents;
+using NUnit.Framework;
 
 namespace Lucene.Net.Index
 {
-    using NUnit.Framework;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-    using Directory = Lucene.Net.Store.Directory;
-
     /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
 
+    using BytesRef = Lucene.Net.Util.BytesRef;
+    using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using Field = Field;
     using FieldType = FieldType;
@@ -38,7 +37,6 @@ namespace Lucene.Net.Index
     [TestFixture]
     public class TestBinaryTerms : LuceneTestCase
     {
-        [Ignore]
         [Test]
         public virtual void TestBinary()
         {


[45/49] lucenenet git commit: Moved common code from Core.Util.Fst.FST and TestFramework.Util.Fst.FSTTester into the support namespace.

Posted by sy...@apache.org.
Moved common code from Core.Util.Fst.FST and TestFramework.Util.Fst.FSTTester into the support namespace.


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

Branch: refs/heads/master
Commit: 979f4e9d43e393ed1e312145f726666d9e333a56
Parents: b9ba938
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Sep 17 21:38:37 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Sep 17 22:40:51 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Lucene.Net.csproj           |  1 +
 src/Lucene.Net.Core/Support/HashCodeMerge.cs    | 37 ++++++++++
 src/Lucene.Net.Core/Support/ObjectExtensions.cs | 56 +++++++++++++++
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 18 ++---
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        | 71 +++++++-------------
 .../Util/fst/FSTTester.cs                       | 18 +----
 6 files changed, 125 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/979f4e9d/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 9dbcd4c..4740604 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -638,6 +638,7 @@
     <Compile Include="Support\ListExtensions.cs" />
     <Compile Include="Support\MathExtension.cs" />
     <Compile Include="Support\MemoryMappedFileByteBuffer.cs" />
+    <Compile Include="Support\ObjectExtensions.cs" />
     <Compile Include="Support\PriorityQueue.cs" />
     <Compile Include="Support\ReentrantLock.cs" />
     <Compile Include="Support\SetExtensions.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/979f4e9d/src/Lucene.Net.Core/Support/HashCodeMerge.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/HashCodeMerge.cs b/src/Lucene.Net.Core/Support/HashCodeMerge.cs
index ebac0ba..5268a43 100644
--- a/src/Lucene.Net.Core/Support/HashCodeMerge.cs
+++ b/src/Lucene.Net.Core/Support/HashCodeMerge.cs
@@ -6,6 +6,7 @@
 //-----------------------------------------------------------------------
 
 using System;
+using System.Collections;
 
 namespace Lucene.Net.Support
 {
@@ -86,5 +87,41 @@ namespace Lucene.Net.Support
 
             return (int)crc32Value;
         }
+
+        /// <summary>
+        /// Gets a hash code for the valueOrEnumerable. If the valueOrEnumerable implements
+        /// IEnumerable, it enumerates the values and makes a combined hash code representing
+        /// all of the values in the order they occur in the set. The types of IEnumerable must also be
+        /// the same, so for example a <see cref="int[]"/> and a <see cref="List{Int32}"/> containing
+        /// the same values will have different hash codes.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="valueOrEnumerable">Any value type, reference type or IEnumerable type.</param>
+        /// <returns>A combined hash code of the value and, if IEnumerable, any values it contains.</returns>
+        public static int GetValueHashCode<T>(this T valueOrEnumerable)
+        {
+            if (valueOrEnumerable == null)
+                return 0; // 0 for null
+
+            if (!(valueOrEnumerable is IEnumerable) || valueOrEnumerable is string)
+            {
+                return valueOrEnumerable.GetHashCode();
+            }
+
+            int hashCode = valueOrEnumerable.GetType().GetHashCode();
+            foreach (object value in valueOrEnumerable as IEnumerable)
+            {
+                if (value != null)
+                {
+                    hashCode = CombineHashCodes(hashCode, value.GetHashCode());
+                }
+                else
+                {
+                    hashCode = CombineHashCodes(hashCode, 0 /* 0 for null */);
+                }
+            }
+
+            return hashCode;
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/979f4e9d/src/Lucene.Net.Core/Support/ObjectExtensions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ObjectExtensions.cs b/src/Lucene.Net.Core/Support/ObjectExtensions.cs
new file mode 100644
index 0000000..37ef70b
--- /dev/null
+++ b/src/Lucene.Net.Core/Support/ObjectExtensions.cs
@@ -0,0 +1,56 @@
+\ufeffusing System.Collections;
+
+namespace Lucene.Net.Support
+{
+    public static class ObjectExtensions
+    {
+        /// <summary>
+        /// Compares the current value against the other value to determine if
+        /// the values are equal. If the values implement IEnumerable (and are 
+        /// not strings), then it will enumerate over the values and compare them
+        /// in the same order.
+        /// 
+        /// This differs from most SetEquals implementations in that they usually
+        /// don't check the order of the elements in the IEnumerable, but this one does.
+        /// It also does the check in a safe manner in case the IEnumerable type is nullable,
+        /// so that null == null.
+        /// 
+        /// The values that are provided don't necessarily have to implement IEnumerable 
+        /// to check their values for equality.
+        /// 
+        /// This method is most useful for assertions and testing, but it may 
+        /// also be useful in other scenarios. Do note the IEnumerable values are cast to
+        /// object before comparing, so it may not be ideal for production scenarios 
+        /// if the values are not reference types.
+        /// </summary>
+        /// <typeparam name="T">The type of object</typeparam>
+        /// <param name="a">This object</param>
+        /// <param name="b">The object that this object will be compared against</param>
+        /// <returns><c>true</c> if the values are equal; otherwise <c>false</c></returns>
+        public static bool ValueEquals<T>(this T a, T b)
+        {
+            if (a is IEnumerable && b is IEnumerable)
+            {
+                var iter = (b as IEnumerable).GetEnumerator();
+                foreach (object value in a as IEnumerable)
+                {
+                    iter.MoveNext();
+                    if (!object.Equals(value, iter.Current))
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+
+            return a.Equals(b);
+        }
+
+        // Special case: strings are IEnumerable, but the default Equals works fine
+        // for testing value equality
+        public static bool ValueEquals(this string a, string b)
+        {
+            return a.Equals(b);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/979f4e9d/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 99be83d..c38f658 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Support;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -440,22 +441,11 @@ namespace Lucene.Net.Util.Fst
                     Debug.Assert(root.Flags == asserting.Flags);
                     Debug.Assert(root.Label == asserting.Label);
                     Debug.Assert(root.NextArc == asserting.NextArc);
+
                     // LUCENENET NOTE: In .NET, IEnumerable will not equal another identical IEnumerable
                     // because it checks for reference equality, not that the list contents
-                    // are the same.
-                    if (root.NextFinalOutput is IEnumerable && asserting.NextFinalOutput is IEnumerable)
-                    {
-                        var iter = (asserting.NextFinalOutput as IEnumerable).GetEnumerator();
-                        foreach (object value in root.NextFinalOutput as IEnumerable)
-                        {
-                            iter.MoveNext();
-                            Debug.Assert(object.Equals(value, iter.Current));
-                        }
-                    }
-                    else
-                    {
-                        Debug.Assert(root.NextFinalOutput.Equals(asserting.NextFinalOutput));
-                    }
+                    // are the same. ValueEquals (a custom extension method) will make that check.
+                    Debug.Assert(root.NextFinalOutput.ValueEquals(asserting.NextFinalOutput));
                     Debug.Assert(root.Node == asserting.Node);
                     Debug.Assert(root.NumArcs == asserting.NumArcs);
                     Debug.Assert(root.Output.Equals(asserting.Output));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/979f4e9d/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 95b6115..5198fe7 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -2,6 +2,7 @@ using System.Diagnostics;
 
 namespace Lucene.Net.Util.Fst
 {
+    using Support;
     using System.Collections;
     /*
     * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -88,29 +89,7 @@ namespace Lucene.Net.Util.Fst
                 long n = ((Builder<T>.CompiledNode)arc.Target).Node;
                 h = PRIME * h + (int)(n ^ (n >> 32));
                 h = PRIME * h + arc.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 (arc.NextFinalOutput is IEnumerable)
-                {
-                    h = PRIME * h + arc.NextFinalOutput.GetType().GetHashCode();
-                    foreach (object value in arc.NextFinalOutput as IEnumerable)
-                    {
-                        if (value != null)
-                        {
-                            h = PRIME * h + value.GetHashCode();
-                        }
-                        else
-                        {
-                            h = PRIME * h + 0; // 0 for null
-                        }
-                    }
-                }
-                else
-                {
-                    h = PRIME * h + arc.NextFinalOutput.GetHashCode();
-                }
+                h = PRIME * h + arc.NextFinalOutput.GetValueHashCode();
                 if (arc.IsFinal)
                 {
                     h += 17;
@@ -133,29 +112,29 @@ namespace Lucene.Net.Util.Fst
                 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)
-                {
-                    h = PRIME * h + scratchArc.NextFinalOutput.GetType().GetHashCode();
-                    foreach (object value in scratchArc.NextFinalOutput as IEnumerable)
-                    {
-                        if (value != null)
-                        {
-                            h = PRIME * h + value.GetHashCode();
-                        }
-                        else
-                        {
-                            h = PRIME * h + 0; // 0 for null
-                        }
-                    }
-                }
-                else
-                {
-                    h = PRIME * h + scratchArc.NextFinalOutput.GetHashCode();
-                }
+                h = PRIME * h + scratchArc.NextFinalOutput.GetValueHashCode();
+                //// 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)
+                //{
+                //    h = PRIME * h + scratchArc.NextFinalOutput.GetType().GetHashCode();
+                //    foreach (object value in scratchArc.NextFinalOutput as IEnumerable)
+                //    {
+                //        if (value != null)
+                //        {
+                //            h = PRIME * h + value.GetHashCode();
+                //        }
+                //        else
+                //        {
+                //            h = PRIME * h + 0; // 0 for null
+                //        }
+                //    }
+                //}
+                //else
+                //{
+                //    h = PRIME * h + scratchArc.NextFinalOutput.GetHashCode();
+                //}
 
                 if (scratchArc.IsFinal)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/979f4e9d/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 9bcccb9..fc3d75a 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -407,25 +407,11 @@ namespace Lucene.Net.Util.Fst
 
         protected internal virtual bool OutputsEqual(T a, T b)
         {
-            // LUCENENET: In .NET, lists do not automatically test to ensure
+            // LUCENENET: In .NET, IEnumerables do not automatically test to ensure
             // their values are equal, so we need to do that manually.
             // Note that we are testing the values without regard to whether
             // the enumerable type is nullable.
-            if (a is IEnumerable && b is IEnumerable)
-            {
-                var iter = (b as IEnumerable).GetEnumerator();
-                foreach (object value in a as IEnumerable)
-                {
-                    iter.MoveNext();
-                    if (!object.Equals(value, iter.Current))
-                    {
-                        return false;
-                    }
-                }
-                return true;
-            }
-
-            return a.Equals(b);
+            return a.ValueEquals(b);
         }
 
         // FST is complete


[12/49] lucenenet git commit: .NETify FST: Interfaces should start with "I"

Posted by sy...@apache.org.
.NETify FST: Interfaces should start with "I"


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

Branch: refs/heads/master
Commit: 18f84437970c1cc0d16312952a4e6726d35f97df
Parents: b8db797
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 17:30:10 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:54 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/Builder.cs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/18f84437/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 540b913..93dfbf6 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -573,7 +573,7 @@ namespace Lucene.Net.Util.Fst
         public class Arc<S>
         {
             public int Label; // really an "unsigned" byte
-            public Node Target;
+            public INode Target;
             public bool IsFinal;
             public S Output;
             public S NextFinalOutput;
@@ -583,7 +583,7 @@ namespace Lucene.Net.Util.Fst
         // memory while the FST is being built; it's only the
         // current "frontier":
 
-        public interface Node
+        public interface INode
         {
             bool IsCompiled { get; }
         }
@@ -593,7 +593,7 @@ namespace Lucene.Net.Util.Fst
             return fst.SizeInBytes();
         }
 
-        public sealed class CompiledNode : Node
+        public sealed class CompiledNode : INode
         {
             public long Node;
 
@@ -608,7 +608,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Expert: holds a pending (seen but not yet serialized) Node. </summary>
-        public sealed class UnCompiledNode<S> : Node
+        public sealed class UnCompiledNode<S> : INode
         {
             internal readonly Builder<S> Owner;
             public int NumArcs;
@@ -666,7 +666,7 @@ namespace Lucene.Net.Util.Fst
                 return Arcs[NumArcs - 1].Output;
             }
 
-            public void AddArc(int label, Node target)
+            public void AddArc(int label, INode target)
             {
                 Debug.Assert(label >= 0);
                 // LUCENENET: Commented this because it makes testing difficult in Visual Studio.
@@ -691,7 +691,7 @@ namespace Lucene.Net.Util.Fst
                 arc.IsFinal = false;
             }
 
-            public void ReplaceLast(int labelToMatch, Node target, S nextFinalOutput, bool isFinal)
+            public void ReplaceLast(int labelToMatch, INode target, S nextFinalOutput, bool isFinal)
             {
                 Debug.Assert(NumArcs > 0);
                 Arc<S> arc = Arcs[NumArcs - 1];
@@ -702,7 +702,7 @@ namespace Lucene.Net.Util.Fst
                 arc.IsFinal = isFinal;
             }
 
-            public void DeleteLast(int label, Node target)
+            public void DeleteLast(int label, INode target)
             {
                 Debug.Assert(NumArcs > 0);
                 Debug.Assert(label == Arcs[NumArcs - 1].Label);


[38/49] lucenenet git commit: Enabled ignored Core.Util.TestWAH8DocIdSet + fixed bugs in tests

Posted by sy...@apache.org.
Enabled ignored Core.Util.TestWAH8DocIdSet + fixed bugs in tests


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

Branch: refs/heads/master
Commit: 2ebff9483f99160faafb3e1b4a14772434efc254
Parents: abfe82c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 16:04:04 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 16:04:04 2016 +0700

----------------------------------------------------------------------
 .../core/Util/TestWAH8DocIdSet.cs                | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ebff948/src/Lucene.Net.Tests/core/Util/TestWAH8DocIdSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestWAH8DocIdSet.cs b/src/Lucene.Net.Tests/core/Util/TestWAH8DocIdSet.cs
index 6968e19..73d338d 100644
--- a/src/Lucene.Net.Tests/core/Util/TestWAH8DocIdSet.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestWAH8DocIdSet.cs
@@ -22,7 +22,6 @@ namespace Lucene.Net.Util
      * limitations under the License.
      */
 
-    [Ignore]
     [TestFixture]
     public class TestWAH8DocIdSet : BaseDocIdSetTestCase<WAH8DocIdSet>
     {
@@ -43,7 +42,6 @@ namespace Lucene.Net.Util
             Assert.AreEqual(ds1.Cardinality(), ds2.Cardinality());
         }
 
-        [Ignore]
         [Test]
         public virtual void TestUnion()
         {
@@ -72,7 +70,6 @@ namespace Lucene.Net.Util
             AssertEquals(numBits, expected, union);
         }
 
-        [Ignore]
         [Test]
         public virtual void TestIntersection()
         {
@@ -96,26 +93,14 @@ namespace Lucene.Net.Util
             {
                 for (int previousDoc = -1, doc = set.NextSetBit(0); ; previousDoc = doc, doc = set.NextSetBit(doc + 1))
                 {
-                    int startIdx = previousDoc + 1;
-                    int endIdx;
                     if (doc == -1)
                     {
-                        endIdx = startIdx + set.Count;
-                        //expected.Clear(previousDoc + 1, set.Count);
-                        for (int i = startIdx; i < endIdx; i++)
-                        {
-                            expected[i] = false;
-                        }
+                        expected.Clear(previousDoc + 1, set.Count);
                         break;
                     }
                     else
                     {
-                        endIdx = startIdx + doc;
-                        for (int i = startIdx; i > endIdx; i++)
-                        {
-                            expected[i] = false;
-                        }
-                        //expected.Clear(previousDoc + 1, doc);
+                        expected.Clear(previousDoc + 1, doc);
                     }
                 }
             }


[44/49] lucenenet git commit: Removed commented code block from TestFramework.Util.Fst.FSTTester.

Posted by sy...@apache.org.
Removed commented code block from TestFramework.Util.Fst.FSTTester.


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

Branch: refs/heads/master
Commit: b9ba93855822ad6cfb5cdf427a4ba1a8008dde7a
Parents: a10dc0e
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Sep 17 18:14:56 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Sep 17 18:14:56 2016 +0700

----------------------------------------------------------------------
 .../Util/fst/FSTTester.cs                       | 67 --------------------
 1 file changed, 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b9ba9385/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 ccd2379..9bcccb9 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -945,73 +945,6 @@ namespace Lucene.Net.Util.Fst
                 }
             }
 
-
-            //// prune 'em
-            //IEnumerator<KeyValuePair<IntsRef, CountMinOutput<T>>> it = prefixes.GetEnumerator();
-            //while (it.MoveNext())
-            //{
-            //    KeyValuePair<IntsRef, CountMinOutput<T>> ent = it.Current;
-            //    IntsRef prefix = ent.Key;
-            //    CountMinOutput<T> cmo = ent.Value;
-            //    if (LuceneTestCase.VERBOSE)
-            //    {
-            //        Console.WriteLine("  term prefix=" + InputToString(inputMode, prefix, false) + " count=" + cmo.Count + " isLeaf=" + cmo.IsLeaf + " output=" + Outputs.OutputToString(cmo.Output) + " isFinal=" + cmo.IsFinal);
-            //    }
-            //    bool keep;
-            //    if (prune1 > 0)
-            //    {
-            //        keep = cmo.Count >= prune1;
-            //    }
-            //    else
-            //    {
-            //        Debug.Assert(prune2 > 0);
-            //        if (prune2 > 1 && cmo.Count >= prune2)
-            //        {
-            //            keep = true;
-            //        }
-            //        else if (prefix.Length > 0)
-            //        {
-            //            // consult our parent
-            //            scratch.Length = prefix.Length - 1;
-            //            Array.Copy(prefix.Ints, prefix.Offset, scratch.Ints, 0, scratch.Length);
-            //            CountMinOutput<T> cmo2 = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
-            //            //System.out.println("    parent count = " + (cmo2 == null ? -1 : cmo2.count));
-            //            keep = cmo2 != null && ((prune2 > 1 && cmo2.Count >= prune2) || (prune2 == 1 && (cmo2.Count >= 2 || prefix.Length <= 1)));
-            //        }
-            //        else if (cmo.Count >= prune2)
-            //        {
-            //            keep = true;
-            //        }
-            //        else
-            //        {
-            //            keep = false;
-            //        }
-            //    }
-
-            //    if (!keep)
-            //    {
-            //        it.Reset();
-            //        //System.out.println("    remove");
-            //    }
-            //    else
-            //    {
-            //        // clear isLeaf for all ancestors
-            //        //System.out.println("    keep");
-            //        scratch.CopyInts(prefix);
-            //        scratch.Length--;
-            //        while (scratch.Length >= 0)
-            //        {
-            //            CountMinOutput<T> cmo2 = prefixes.ContainsKey(scratch) ? prefixes[scratch] : null;
-            //            if (cmo2 != null)
-            //            {
-            //                //System.out.println("    clear isLeaf " + inputToString(inputMode, scratch));
-            //                cmo2.IsLeaf = false;
-            //            }
-            //            scratch.Length--;
-            //        }
-            //    }
-            //}
-
             if (LuceneTestCase.VERBOSE)
             {
                 Console.WriteLine("TEST: after prune");


[39/49] lucenenet git commit: Updated ignore attribute on Index.Test2BNumericDocValues with the message from Java that indicates it takes ~30 minutes

Posted by sy...@apache.org.
Updated ignore attribute on Index.Test2BNumericDocValues with the message from Java that indicates it takes ~30 minutes


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

Branch: refs/heads/master
Commit: e42f400278b53fd6d2c0f1519642b0ec0a152a38
Parents: 2ebff94
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 16:23:35 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 16:23:35 2016 +0700

----------------------------------------------------------------------
 .../core/Index/Test2BNumericDocValues.cs        | 48 +++++++++-----------
 1 file changed, 22 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e42f4002/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs b/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
index c62200f..57db3d0 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
@@ -1,45 +1,41 @@
-using System;
+using Lucene.Net.Attributes;
 using Lucene.Net.Documents;
+using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Index
 {
-    using NUnit.Framework;
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using Document = Documents.Document;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-
-    /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
-
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
     using NumericDocValuesField = NumericDocValuesField;
 
-    /*using Ignore = org.junit.Ignore;
-
-    using TimeoutSuite = com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;*/
-
     //@TimeoutSuite(millis = 80 * TimeUnits.HOUR) @Ignore("takes ~ 30 minutes") @SuppressCodecs("Lucene3x") public class Test2BNumericDocValues extends Lucene.Net.Util.LuceneTestCase
-    [Ignore]
+    [Ignore("takes ~ 30 minutes")]
     [TestFixture]
     public class Test2BNumericDocValues : LuceneTestCase
     {
         // indexes Integer.MAX_VALUE docs with an increasing dv field
-        [Test]
+        [Test, LongRunningTest]
         public virtual void TestNumerics([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BNumerics"));


[02/49] lucenenet git commit: Setup InternalsVisibleTo Lucene.Net.TestFramework <- Lucene.Net.Tests for testing.

Posted by sy...@apache.org.
Setup InternalsVisibleTo Lucene.Net.TestFramework <- Lucene.Net.Tests for testing.


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

Branch: refs/heads/master
Commit: b56ebc22bb06fddc941b467d8310cfd735e5f9e9
Parents: c67366f
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Sep 6 13:17:13 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Sep 6 13:19:08 2016 +0700

----------------------------------------------------------------------
 .../Lucene.Net.TestFramework.csproj                    |  2 +-
 .../Properties/AssemblyInfo.cs                         | 13 +++++++++++++
 .../core/Analysis/TestLookaheadTokenFilter.cs          |  2 +-
 .../core/Analysis/TrivialLookaheadFilter.cs            |  4 ++--
 .../Codecs/Lucene40/TestLucene40DocValuesFormat.cs     |  2 +-
 .../Codecs/Lucene42/TestLucene42DocValuesFormat.cs     |  2 +-
 .../Codecs/Perfield/TestPerFieldDocValuesFormat.cs     |  2 +-
 src/Lucene.Net.Tests/core/Index/TestDocValuesFormat.cs |  2 +-
 src/Lucene.Net.Tests/core/Index/TestLogMergePolicy.cs  |  2 +-
 src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs      | 12 ++++++------
 .../core/Index/TestTieredMergePolicy.cs                |  2 +-
 .../core/Search/TestSearcherManager.cs                 | 12 ++++++------
 12 files changed, 35 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index 8d3d4e5..cf0ba78 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -36,7 +36,7 @@
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup>
-    <SignAssembly>true</SignAssembly>
+    <SignAssembly>false</SignAssembly>
   </PropertyGroup>
   <PropertyGroup>
     <AssemblyOriginatorKeyFile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs b/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
index 467e175..a6ade6d 100644
--- a/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
+++ b/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
@@ -22,6 +22,19 @@ using System.Runtime.InteropServices;
 // The following GUID is for the ID of the typelib if this project is exposed to COM
 [assembly: Guid("5f36e3cf-82ac-4d97-af1a-6dabe60e9180")]
 
+// for testing
+//[assembly: InternalsVisibleTo("Lucene.Net.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010075a07ce602f88e" +
+//                                                         "f263c7db8cb342c58ebd49ecdcc210fac874260b0213fb929ac3dcaf4f5b39744b800f99073eca" +
+//                                                         "72aebfac5f7284e1d5f2c82012a804a140f06d7d043d83e830cdb606a04da2ad5374cc92c0a495" +
+//                                                         "08437802fb4f8fb80a05e59f80afb99f4ccd0dfe44065743543c4b053b669509d29d332cd32a0c" +
+//                                                         "b1e97e84")]
+
+// LUCENENET NOTE: For now it is not possible to use a SNK because we have unmanaged references in Analysis.Common.
+// However, we still need InternalsVisibleTo in order to prevent making everything public just for the sake of testing.
+// This has broad implications, though because many methods are marked "protected internal", which means other assemblies
+// must update overridden methods to match.
+[assembly: InternalsVisibleTo("Lucene.Net.Tests")]
+
 // Version information for an assembly consists of the following four values:
 //
 //      Major Version

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Analysis/TestLookaheadTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Analysis/TestLookaheadTokenFilter.cs b/src/Lucene.Net.Tests/core/Analysis/TestLookaheadTokenFilter.cs
index f8b9b78..44933dc 100644
--- a/src/Lucene.Net.Tests/core/Analysis/TestLookaheadTokenFilter.cs
+++ b/src/Lucene.Net.Tests/core/Analysis/TestLookaheadTokenFilter.cs
@@ -58,7 +58,7 @@ namespace Lucene.Net.Analysis
             {
             }
 
-            protected override LookaheadTokenFilter.Position NewPosition()
+            protected internal override LookaheadTokenFilter.Position NewPosition()
             {
                 return new LookaheadTokenFilter.Position();
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Analysis/TrivialLookaheadFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Analysis/TrivialLookaheadFilter.cs b/src/Lucene.Net.Tests/core/Analysis/TrivialLookaheadFilter.cs
index e513e57..a79b17c 100644
--- a/src/Lucene.Net.Tests/core/Analysis/TrivialLookaheadFilter.cs
+++ b/src/Lucene.Net.Tests/core/Analysis/TrivialLookaheadFilter.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Analysis
             OffsetAtt = AddAttribute<IOffsetAttribute>();
         }
 
-        protected override TestPosition NewPosition()
+        protected internal override TestPosition NewPosition()
         {
             return new TestPosition();
         }
@@ -62,7 +62,7 @@ namespace Lucene.Net.Analysis
             InsertUpto = -1;
         }
 
-        protected override void AfterPosition()
+        protected internal override void AfterPosition()
         {
             if (InsertUpto < OutputPos)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
index 813c638..9ee39e7 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.Codecs.Lucene40
         }
 
         // LUCENE-4583: this codec should throw IAE on huge binary values:
-        protected override bool CodecAcceptsHugeBinaryValues(string field)
+        protected internal override bool CodecAcceptsHugeBinaryValues(string field)
         {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
index 4cf9c73..7f4438b 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
@@ -47,7 +47,7 @@ namespace Lucene.Net.Codecs.Lucene42
             }
         }
 
-        protected override bool CodecAcceptsHugeBinaryValues(string field)
+        protected internal override bool CodecAcceptsHugeBinaryValues(string field)
         {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Codecs/Perfield/TestPerFieldDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Perfield/TestPerFieldDocValuesFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Perfield/TestPerFieldDocValuesFormat.cs
index f2898ab..bf0a5fe 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Perfield/TestPerFieldDocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Perfield/TestPerFieldDocValuesFormat.cs
@@ -72,7 +72,7 @@ namespace Lucene.Net.Codecs.Perfield
             }
         }
 
-        protected override bool CodecAcceptsHugeBinaryValues(string field)
+        protected internal override bool CodecAcceptsHugeBinaryValues(string field)
         {
             return TestUtil.FieldSupportsHugeBinaryDocValues(field);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Index/TestDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocValuesFormat.cs b/src/Lucene.Net.Tests/core/Index/TestDocValuesFormat.cs
index 5db90c9..1efe781 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocValuesFormat.cs
@@ -34,7 +34,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        protected override bool CodecAcceptsHugeBinaryValues(string field)
+        protected internal override bool CodecAcceptsHugeBinaryValues(string field)
         {
             return TestUtil.FieldSupportsHugeBinaryDocValues(field);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Index/TestLogMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestLogMergePolicy.cs b/src/Lucene.Net.Tests/core/Index/TestLogMergePolicy.cs
index 35e3603..e99678b 100644
--- a/src/Lucene.Net.Tests/core/Index/TestLogMergePolicy.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestLogMergePolicy.cs
@@ -19,7 +19,7 @@ namespace Lucene.Net.Index
 
     public class TestLogMergePolicy : BaseMergePolicyTestCase
     {
-        protected override MergePolicy MergePolicy()
+        protected internal override MergePolicy MergePolicy()
         {
             return NewLogMergePolicy(Random());
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs b/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
index 658d9f3..e248d2e 100644
--- a/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.Index
             UseNonNrtReaders = Random().NextBoolean();
         }
 
-        protected override void DoSearching(TaskScheduler es, DateTime stopTime)
+        protected internal override void DoSearching(TaskScheduler es, DateTime stopTime)
         {
             bool anyOpenDelFiles = false;
 
@@ -114,7 +114,7 @@ namespace Lucene.Net.Index
             Assert.IsFalse(anyOpenDelFiles, "saw non-zero open-but-deleted count");
         }
 
-        protected override Directory GetDirectory(Directory @in)
+        protected internal override Directory GetDirectory(Directory @in)
         {
             Debug.Assert(@in is MockDirectoryWrapper);
             if (!UseNonNrtReaders)
@@ -124,7 +124,7 @@ namespace Lucene.Net.Index
             return @in;
         }
 
-        protected override void DoAfterWriter(TaskScheduler es)
+        protected internal override void DoAfterWriter(TaskScheduler es)
         {
             // Force writer to do reader pooling, always, so that
             // all merged segments, even for merges before
@@ -134,7 +134,7 @@ namespace Lucene.Net.Index
 
         private IndexSearcher FixedSearcher;
 
-        protected override IndexSearcher CurrentSearcher
+        protected internal override IndexSearcher CurrentSearcher
         {
             get
             {
@@ -142,7 +142,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        protected override void ReleaseSearcher(IndexSearcher s)
+        protected internal override void ReleaseSearcher(IndexSearcher s)
         {
             if (s != FixedSearcher)
             {
@@ -151,7 +151,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        protected override IndexSearcher FinalSearcher
+        protected internal override IndexSearcher FinalSearcher
         {
             get
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Index/TestTieredMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestTieredMergePolicy.cs b/src/Lucene.Net.Tests/core/Index/TestTieredMergePolicy.cs
index efeb08b..5dc9b6c 100644
--- a/src/Lucene.Net.Tests/core/Index/TestTieredMergePolicy.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestTieredMergePolicy.cs
@@ -32,7 +32,7 @@ namespace Lucene.Net.Index
     [TestFixture]
     public class TestTieredMergePolicy : BaseMergePolicyTestCase
     {
-        protected override MergePolicy MergePolicy()
+        protected internal override MergePolicy MergePolicy()
         {
             return NewTieredMergePolicy();
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b56ebc22/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
index 240f310..234f09c 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Search
             RunTest("TestSearcherManager");
         }
 
-        protected override IndexSearcher FinalSearcher
+        protected internal override IndexSearcher FinalSearcher
         {
             get
             {
@@ -74,7 +74,7 @@ namespace Lucene.Net.Search
         private readonly IList<long> PastSearchers = new List<long>();
         private bool IsNRT;
 
-        protected override void DoAfterWriter(TaskScheduler es)
+        protected internal override void DoAfterWriter(TaskScheduler es)
         {
             SearcherFactory factory = new SearcherFactoryAnonymousInnerClassHelper(this, es);
             if (Random().NextBoolean())
@@ -118,7 +118,7 @@ namespace Lucene.Net.Search
             }
         }
 
-        protected override void DoSearching(TaskScheduler es, DateTime stopTime)
+        protected internal override void DoSearching(TaskScheduler es, DateTime stopTime)
         {
             ThreadClass reopenThread = new ThreadAnonymousInnerClassHelper(this, stopTime);
             reopenThread.SetDaemon(true);
@@ -180,7 +180,7 @@ namespace Lucene.Net.Search
             }
         }
 
-        protected override IndexSearcher CurrentSearcher
+        protected internal override IndexSearcher CurrentSearcher
         {
             get
             {
@@ -240,12 +240,12 @@ namespace Lucene.Net.Search
             }
         }
 
-        protected override void ReleaseSearcher(IndexSearcher s)
+        protected internal override void ReleaseSearcher(IndexSearcher s)
         {
             s.IndexReader.DecRef();
         }
 
-        protected override void DoClose()
+        protected internal override void DoClose()
         {
             Assert.IsTrue(WarmCalled);
             if (VERBOSE)


[03/49] lucenenet git commit: Fixed bugs in FST that were causing test failures and Debug.Assert failures in Misc.Util.Fst.

Posted by sy...@apache.org.
Fixed bugs in FST that were causing test failures and Debug.Assert failures in Misc.Util.Fst.


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

Branch: refs/heads/master
Commit: 243ada716c47dafeaf8d2aa39c9ebd8f4c0e8bd7
Parents: b56ebc2
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Sep 5 18:21:23 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Sep 7 17:34:51 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/BytesStore.cs      | 18 ++---
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 18 ++++-
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        | 80 +++++++++++++++-----
 .../Util/fst/FSTTester.cs                       | 24 +++++-
 4 files changed, 110 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/243ada71/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
index de949b8..471cd68 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
@@ -375,7 +375,7 @@ namespace Lucene.Net.Util.Fst
                 blockIndex--;
                 NextWrite = BlockSize;
             }
-            Blocks.GetRange(blockIndex + 1, Blocks.Count).Clear();
+            Blocks.RemoveRange(blockIndex + 1, Blocks.Count - (blockIndex + 1));
             if (newLen == 0)
             {
                 Current = null;
@@ -430,7 +430,7 @@ namespace Lucene.Net.Util.Fst
                 nextRead = outerInstance.BlockSize;
             }
 
-            private sbyte[] Current;
+            private byte[] Current;
             private int nextBuffer;
             private int nextRead;
 
@@ -438,15 +438,15 @@ namespace Lucene.Net.Util.Fst
             {
                 if (nextRead == OuterInstance.BlockSize)
                 {
-                    OuterInstance.Current = OuterInstance.Blocks[nextBuffer++];
+                    Current = OuterInstance.Blocks[nextBuffer++];
                     nextRead = 0;
                 }
-                return OuterInstance.Current[nextRead++];
+                return Current[nextRead++];
             }
 
             public override void SkipBytes(int count)
             {
-                Position = OuterInstance.Position + count;
+                Position = Position + count;
             }
 
             public override void ReadBytes(byte[] b, int offset, int len)
@@ -456,7 +456,7 @@ namespace Lucene.Net.Util.Fst
                     int chunkLeft = OuterInstance.BlockSize - nextRead;
                     if (len <= chunkLeft)
                     {
-                        Array.Copy(OuterInstance.Current, nextRead, b, offset, len);
+                        Array.Copy(Current, nextRead, b, offset, len);
                         nextRead += len;
                         break;
                     }
@@ -464,11 +464,11 @@ namespace Lucene.Net.Util.Fst
                     {
                         if (chunkLeft > 0)
                         {
-                            Array.Copy(OuterInstance.Current, nextRead, b, offset, chunkLeft);
+                            Array.Copy(Current, nextRead, b, offset, chunkLeft);
                             offset += chunkLeft;
                             len -= chunkLeft;
                         }
-                        OuterInstance.Current = OuterInstance.Blocks[nextBuffer++];
+                        Current = OuterInstance.Blocks[nextBuffer++];
                         nextRead = 0;
                     }
                 }
@@ -484,7 +484,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     int bufferIndex = (int)(value >> OuterInstance.blockBits);
                     nextBuffer = bufferIndex + 1;
-                    OuterInstance.Current = OuterInstance.Blocks[bufferIndex];
+                    Current = OuterInstance.Blocks[bufferIndex];
                     nextRead = (int)(value & OuterInstance.BlockMask);
                     Debug.Assert(this.Position == value, "pos=" + value + " getPos()=" + this.Position);
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/243ada71/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 d9dd78c..74beb96 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -6,6 +6,7 @@ using System.Text;
 namespace Lucene.Net.Util.Fst
 {
     using Lucene.Net.Util;
+    using System.Collections;
     using System.IO;
     using ByteArrayDataOutput = Lucene.Net.Store.ByteArrayDataOutput;
 
@@ -439,7 +440,22 @@ namespace Lucene.Net.Util.Fst
                     Debug.Assert(root.Flags == asserting.Flags);
                     Debug.Assert(root.Label == asserting.Label);
                     Debug.Assert(root.NextArc == asserting.NextArc);
-                    Debug.Assert(root.NextFinalOutput.Equals(asserting.NextFinalOutput));
+                    // LUCENENET NOTE: In .NET, IEnumerable will not equal another identical IEnumerable
+                    // because it checks for reference equality, not that the list contents
+                    // are the same.
+                    if (root.NextFinalOutput is IEnumerable && asserting.NextFinalOutput is IEnumerable)
+                    {
+                        var iter = (asserting.NextFinalOutput as IEnumerable).GetEnumerator();
+                        foreach (object value in root.NextFinalOutput as IEnumerable)
+                        {
+                            iter.MoveNext();
+                            Debug.Assert(object.Equals(value, iter.Current));
+                        }
+                    }
+                    else
+                    {
+                        Debug.Assert(root.NextFinalOutput.Equals(asserting.NextFinalOutput));
+                    }
                     Debug.Assert(root.Node == asserting.Node);
                     Debug.Assert(root.NumArcs == asserting.NumArcs);
                     Debug.Assert(root.Output.Equals(asserting.Output));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/243ada71/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 4e8bc73..ad8f2d3 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -2,22 +2,23 @@ using System.Diagnostics;
 
 namespace Lucene.Net.Util.Fst
 {
+    using System.Collections;
     /*
-     * Licensed to the Apache Software Foundation (ASF) under one or more
-     * contributor license agreements.  See the NOTICE file distributed with
-     * this work for additional information regarding copyright ownership.
-     * The ASF licenses this file to You under the Apache License, Version 2.0
-     * (the "License"); you may not use this file except in compliance with
-     * the License.  You may obtain a copy of the License at
-     *
-     *     http://www.apache.org/licenses/LICENSE-2.0
-     *
-     * Unless required by applicable law or agreed to in writing, software
-     * distributed under the License is distributed on an "AS IS" BASIS,
-     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     * See the License for the specific language governing permissions and
-     * limitations under the License.
-     */
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 
     using PackedInts = Lucene.Net.Util.Packed.PackedInts;
     using PagedGrowableWriter = Lucene.Net.Util.Packed.PagedGrowableWriter;
@@ -87,7 +88,29 @@ namespace Lucene.Net.Util.Fst
                 long n = ((Builder<T>.CompiledNode)arc.Target).Node;
                 h = PRIME * h + (int)(n ^ (n >> 32));
                 h = PRIME * h + arc.Output.GetHashCode();
-                h = PRIME * h + arc.NextFinalOutput.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 (arc.NextFinalOutput is IEnumerable)
+                {
+                    h = PRIME * h + arc.NextFinalOutput.GetType().GetHashCode();
+                    foreach (object value in arc.NextFinalOutput as IEnumerable)
+                    {
+                        if (value != null)
+                        {
+                            h = PRIME * h + value.GetHashCode();
+                        }
+                        else
+                        {
+                            h = PRIME * h + 0; // 0 for null
+                        }
+                    }
+                }
+                else
+                {
+                    h = PRIME * h + arc.NextFinalOutput.GetHashCode();
+                }
                 if (arc.IsFinal)
                 {
                     h += 17;
@@ -110,7 +133,30 @@ namespace Lucene.Net.Util.Fst
                 h = PRIME * h + ScratchArc.Label;
                 h = PRIME * h + (int)(ScratchArc.Target ^ (ScratchArc.Target >> 32));
                 h = PRIME * h + ScratchArc.Output.GetHashCode();
-                h = PRIME * h + ScratchArc.NextFinalOutput.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)
+                {
+                    h = PRIME * h + ScratchArc.NextFinalOutput.GetType().GetHashCode();
+                    foreach (object value in ScratchArc.NextFinalOutput as IEnumerable)
+                    {
+                        if (value != null)
+                        {
+                            h = PRIME * h + value.GetHashCode();
+                        }
+                        else
+                        {
+                            h = PRIME * h + 0; // 0 for null
+                        }
+                    }
+                }
+                else
+                {
+                    h = PRIME * h + ScratchArc.NextFinalOutput.GetHashCode();
+                }
+
                 if (ScratchArc.Final)
                 {
                     h += 17;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/243ada71/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 9a72d60..d86b695 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -327,11 +327,11 @@ namespace Lucene.Net.Util.Fst
 
             foreach (InputOutput<T> pair in Pairs)
             {
-                if (pair.Output is IList)
+                if (pair.Output is IEnumerable)
                 {
-                    IList<long> longValues = (IList<long>)pair.Output;
                     Builder<object> builderObject = builder as Builder<object>;
-                    foreach (long value in longValues)
+                    var values = pair.Output as IEnumerable;
+                    foreach (object value in values)
                     {
                         builderObject.Add(pair.Input, value);
                     }
@@ -395,6 +395,24 @@ namespace Lucene.Net.Util.Fst
 
         protected internal virtual bool OutputsEqual(T a, T b)
         {
+            // LUCENENET: In .NET, lists do not automatically test to ensure
+            // their values are equal, so we need to do that manually.
+            // Note that we are testing the values without regard to whether
+            // the enumerable type is nullable.
+            if (a is IEnumerable && b is IEnumerable)
+            {
+                var iter = (b as IEnumerable).GetEnumerator();
+                foreach (object value in a as IEnumerable)
+                {
+                    iter.MoveNext();
+                    if (!object.Equals(value, iter.Current))
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+
             return a.Equals(b);
         }
 


[30/49] lucenenet git commit: Ported Core.TestMergeSchedulerExternal

Posted by sy...@apache.org.
Ported Core.TestMergeSchedulerExternal


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

Branch: refs/heads/master
Commit: c031b600cf3fe1bb44754a65384d20008dcdfc90
Parents: 4b4485b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 04:17:21 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 04:19:49 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c031b600/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs b/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
index 7512d5d..d77e380 100644
--- a/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
+++ b/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
@@ -4,9 +4,8 @@ using System.IO;
 using Lucene.Net.Documents;
 using NUnit.Framework;
 
-namespace Lucene.Net.Tests
+namespace Lucene.Net
 {
-
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
      * contributor license agreements.  See the NOTICE file distributed with
@@ -23,6 +22,7 @@ namespace Lucene.Net.Tests
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
+
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using Document = Documents.Document;
     using Field = Field;


[23/49] lucenenet git commit: Ported Core.Util.TestWeakIdentityMap (partially)

Posted by sy...@apache.org.
Ported Core.Util.TestWeakIdentityMap (partially)


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

Branch: refs/heads/master
Commit: 3b18a74a95c21ee4174fcd87c16bea5fe05d6752
Parents: 0c2f5ae
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Sep 11 02:22:30 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Sep 11 02:22:30 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |  1 +
 .../core/Util/TestWeakIdentityMap.cs            | 83 ++++++++++++--------
 2 files changed, 52 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3b18a74a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index dc54705..32dea94 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -608,6 +608,7 @@
     <Compile Include="core\Util\TestWAH8DocIdSet.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="core\Util\TestWeakIdentityMap.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="core\Util\Cache\" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3b18a74a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs b/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
index 19939c3..82c5c4c 100644
--- a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
@@ -1,28 +1,28 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Threading;
 
 namespace Lucene.Net.Util
 {
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
 
     [TestFixture]
     public class TestWeakIdentityMap : LuceneTestCase
@@ -35,8 +35,14 @@ namespace Lucene.Net.Util
             // we keep strong references to the keys,
             // so WeakIdentityMap will not forget about them:
             string key1 = "foo";
-            string key2 = "foo";
-            string key3 = "foo";
+            string key2 = "test1 foo".Split(' ')[1];
+            string key3 = "test2 foo".Split(' ')[1];
+
+            // LUCENENET NOTE: As per http://stackoverflow.com/a/543329/181087,
+            // the above hack is required in order to ensure the AreNotSame
+            // check will work. If you assign the same string to 3 different variables
+            // without doing some kind of manipulation from the original string, the
+            // AreNotSame test will fail because the references will be the same.
 
             Assert.AreNotSame(key1, key2);
             Assert.AreEqual(key1, key2);
@@ -102,7 +108,8 @@ namespace Lucene.Net.Util
                 //Assert.IsTrue(iter.hasNext()); // try again, should return same result!
                 string k = iter.Current;
                 Assert.IsTrue(k == key1 || k == key2 | k == key3);
-                keysAssigned += (k == key1) ? 1 : ((k == key2) ? 2 : 4);
+                // LUCENENET NOTE: Need object.ReferenceEquals here because the == operator does more than check reference equality
+                keysAssigned += object.ReferenceEquals(k, key1) ? 1 : (object.ReferenceEquals(k, key2) ? 2 : 4);
                 c++;
             }
             Assert.AreEqual(3, c);
@@ -126,12 +133,13 @@ namespace Lucene.Net.Util
             {
                 try
                 {
-                    System.RunFinalization();
-                    System.gc();
+                    //System.RunFinalization();
+                    //System.gc();
+                    GC.Collect();
                     int newSize = map.Size();
                     Assert.IsTrue(size >= newSize, "previousSize(" + size + ")>=newSize(" + newSize + ")");
                     size = newSize;
-                    Thread.Sleep(new TimeSpan(100L));
+                    Thread.Sleep(new TimeSpan(0, 0, 1));
                     c = 0;
                     for (IEnumerator<string> iter = map.Keys.GetEnumerator(); iter.MoveNext(); )
                     {
@@ -163,8 +171,14 @@ namespace Lucene.Net.Util
             {
             }*/
 
-            key1 = "foo";
-            key2 = "foo";
+            // LUCENENET NOTE: As per http://stackoverflow.com/a/543329/181087,
+            // the following hack is required in order to ensure the string references
+            // are different. If you assign the same string to 2 different variables
+            // without doing some kind of manipulation from the original string, the
+            // references will be the same.
+
+            key1 = "test3 foo".Split(' ')[1];
+            key2 = "test4 foo".Split(' ')[1];
             map.Put(key1, "bar1");
             map.Put(key2, "bar2");
             Assert.AreEqual(2, map.Size());
@@ -174,12 +188,15 @@ namespace Lucene.Net.Util
             Assert.IsTrue(map.Empty);
         }
 
+        /* LUCENENET TODO: Compile issues
         [Test]
         public virtual void TestConcurrentHashMap()
         {
             // don't make threadCount and keyCount random, otherwise easily OOMs or fails otherwise:
             const int threadCount = 8, keyCount = 1024;
-            ExecutorService exec = Executors.newFixedThreadPool(threadCount, new NamedThreadFactory("testConcurrentHashMap"));
+
+            System.Threading.ThreadPool.QueueUserWorkItem(;
+            //ExecutorService exec = Executors.newFixedThreadPool(threadCount, new NamedThreadFactory("testConcurrentHashMap"));
             WeakIdentityMap<object, int?> map = WeakIdentityMap<object, int?>.NewConcurrentHashMap(Random().NextBoolean());
             // we keep strong references to the keys,
             // so WeakIdentityMap will not forget about them:
@@ -215,14 +232,15 @@ namespace Lucene.Net.Util
             {
                 try
                 {
-                    System.runFinalization();
-                    System.gc();
+                    //System.runFinalization();
+                    //System.gc();
+                    GC.Collect();
                     int newSize = map.Size();
                     Assert.IsTrue(size >= newSize, "previousSize(" + size + ")>=newSize(" + newSize + ")");
                     size = newSize;
                     Thread.Sleep(new TimeSpan(100L));
                     int c = 0;
-                    for (IEnumerator<object> it = map.Keys.GetEnumerator(); it.MoveNext(); )
+                    for (IEnumerator<object> it = map.Keys.GetEnumerator(); it.MoveNext();)
                     {
                         Assert.IsNotNull(it.Current);
                         c++;
@@ -283,7 +301,7 @@ namespace Lucene.Net.Util
                             break;
                         case 4:
                             // check iterator still working
-                            for (IEnumerator<object> it = Map.Keys.GetEnumerator(); it.MoveNext(); )
+                            for (IEnumerator<object> it = Map.Keys.GetEnumerator(); it.MoveNext();)
                             {
                                 Assert.IsNotNull(it.Current);
                             }
@@ -295,5 +313,6 @@ namespace Lucene.Net.Util
                 }
             }
         }
+        */
     }
 }
\ No newline at end of file