lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [7/7] git commit: FST API .NETification
Date Wed, 10 Sep 2014 01:48:08 GMT
FST API .NETification


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

Branch: refs/heads/master
Commit: fd0a0811f5b007b47e9b7e0cf14529349f8be5ca
Parents: 273b9fd
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Wed Sep 10 04:46:58 2014 +0300
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Wed Sep 10 04:46:58 2014 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs |  4 ++--
 .../Codecs/Lucene42/Lucene42DocValuesProducer.cs   |  6 +++---
 src/Lucene.Net.Core/Util/Fst/FST.cs                | 17 +++++++----------
 src/Lucene.Net.Core/Util/Fst/FSTEnum.cs            |  8 ++++----
 src/Lucene.Net.Core/Util/Fst/Util.cs               | 12 ++++++------
 src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs |  4 ++--
 6 files changed, 24 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd0a0811/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 644b97c..a2055dd 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
@@ -1061,7 +1061,7 @@ namespace Lucene.Net.Codecs
                     }
                     else
                     {
-                        FstReader = outerInstance.Index.GetBytesReader;
+                        FstReader = outerInstance.Index.BytesReader;
                     }
 
                     // TODO: if the automaton is "smallish" we really
@@ -1562,7 +1562,7 @@ namespace Lucene.Net.Codecs
                     }
                     else
                     {
-                        FstReader = OuterInstance.Index.GetBytesReader;
+                        FstReader = OuterInstance.Index.BytesReader;
                     }
 
                     // Init w/ root block; don't use index since it may

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd0a0811/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 c511c4e..566f66a 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
@@ -448,7 +448,7 @@ namespace Lucene.Net.Codecs.Lucene42
             FST<long> fst = instance;
 
             // per-thread resources
-            FST<long>.BytesReader @in = fst.GetBytesReader;
+            FST<long>.BytesReader @in = fst.BytesReader;
             FST<long>.Arc<long> firstArc = new FST<long>.Arc<long>();
             FST<long>.Arc<long> scratchArc = new FST<long>.Arc<long>();
             IntsRef scratchInts = new IntsRef();
@@ -567,7 +567,7 @@ namespace Lucene.Net.Codecs.Lucene42
             FST<long> fst = instance;
 
             // per-thread resources
-            FST<long>.BytesReader @in = fst.GetBytesReader;
+            FST<long>.BytesReader @in = fst.BytesReader;
             FST<long>.Arc<long> firstArc = new FST<long>.Arc<long>();
             FST<long>.Arc<long> scratchArc = new FST<long>.Arc<long>();
             IntsRef scratchInts = new IntsRef();
@@ -750,7 +750,7 @@ namespace Lucene.Net.Codecs.Lucene42
             {
                 this.Fst = fst;
                 @in = new BytesRefFSTEnum<long>(fst);
-                BytesReader = fst.GetBytesReader;
+                BytesReader = fst.BytesReader;
             }
 
             public override BytesRef Next()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd0a0811/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 69fcfad..86608ed 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -35,9 +35,6 @@ namespace Lucene.Net.Util.Fst
     using PackedInts = Lucene.Net.Util.Packed.PackedInts;
     using RAMOutputStream = Lucene.Net.Store.RAMOutputStream;
 
-    //import java.io.Writer;
-    //import java.io.OutputStreamWriter;
-
     // TODO: break this into WritableFST and ReadOnlyFST.. then
     // we can have subclasses of ReadOnlyFST to handle the
     // different byte[] level encodings (packed or
@@ -167,7 +164,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// If arc has this label then that arc is final/accepted </summary>
-        public const int END_LABEL = -1;
+        public static readonly int END_LABEL = -1;
 
         private readonly bool AllowArrayArcs;
 
@@ -396,7 +393,7 @@ namespace Lucene.Net.Util.Fst
         {
             Arc<T> arc = new Arc<T>();
             GetFirstArc(arc);
-            BytesReader @in = GetBytesReader;
+            BytesReader @in = BytesReader;
             if (TargetHasArcs(arc))
             {
                 ReadFirstRealTargetArc(arc.Target, arc, @in);
@@ -588,7 +585,7 @@ namespace Lucene.Net.Util.Fst
         /// <summary>
         /// Reads an automaton from a file.
         /// </summary>
-        public static FST<T> read<T>(FileInfo file, Outputs<T> outputs)
+        public static FST<T> Read<T>(FileInfo file, Outputs<T> outputs)
         {
             var bs = new BufferedStream(file.OpenRead());
             bool success = false;
@@ -698,7 +695,7 @@ namespace Lucene.Net.Util.Fst
             for (int arcIdx = 0; arcIdx < nodeIn.NumArcs; arcIdx++)
             {
                 Builder<T>.Arc<T> arc = nodeIn.Arcs[arcIdx];
-                Builder<T>.CompiledNode target = (Builder<T>.CompiledNode)arc.Target;
+                var target = (Builder<T>.CompiledNode)arc.Target;
                 int flags = 0;
                 //System.out.println("  arc " + arcIdx + " label=" + arc.Label + " ->
target=" + target.Node);
 
@@ -1508,10 +1505,10 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Returns a <seealso cref="BytesReader"/> for this FST, positioned at
+        /// Returns a <seealso cref="FST.BytesReader"/> for this FST, positioned at
         ///  position 0.
         /// </summary>
-        public FST.BytesReader GetBytesReader
+        public FST.BytesReader BytesReader
         {
             get
             {
@@ -1720,7 +1717,7 @@ namespace Lucene.Net.Util.Fst
 
             Arc<T> arc = new Arc<T>();
 
-            BytesReader r = GetBytesReader;
+            BytesReader r = BytesReader;
 
             int topN = Math.Min(maxDerefNodes, InCounts.Size());
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd0a0811/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 2b97b51..93469ce 100644
--- a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Util.Fst
         protected internal FSTEnum(FST<T> fst)
         {
             this.Fst = fst;
-            FstReader = fst.GetBytesReader;
+            FstReader = fst.BytesReader;
             NO_OUTPUT = fst.Outputs.NoOutput;
             fst.GetFirstArc(GetArc(0));
             Output[0] = NO_OUTPUT;
@@ -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.GetBytesReader;
+                    FST<T>.BytesReader @in = Fst.BytesReader;
                     int low = arc.ArcIdx;
                     int high = arc.NumArcs - 1;
                     int mid = 0;
@@ -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.GetBytesReader;
+                    FST<T>.BytesReader @in = Fst.BytesReader;
                     int low = arc.ArcIdx;
                     int high = arc.NumArcs - 1;
                     int mid = 0;
@@ -517,7 +517,7 @@ namespace Lucene.Net.Util.Fst
             FST<T>.Arc<T> arc = GetArc(Upto - 1);
             int targetLabel = TargetLabel;
 
-            FST<T>.BytesReader fstReader = Fst.GetBytesReader;
+            FST<T>.BytesReader fstReader = Fst.BytesReader;
 
             while (true)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd0a0811/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 779220d..adc6417 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Util.Fst
             // TODO: would be nice not to alloc this on every lookup
             var arc = fst.GetFirstArc(new FST<T>.Arc<T>());
 
-            var fstReader = fst.GetBytesReader;
+            var fstReader = fst.BytesReader;
 
             // Accumulate output as we go
             T output = fst.Outputs.NoOutput;
@@ -82,7 +82,7 @@ namespace Lucene.Net.Util.Fst
         {
             Debug.Assert(fst.inputType == FST<long>.INPUT_TYPE.BYTE1);
 
-            var fstReader = fst.GetBytesReader;
+            var fstReader = fst.BytesReader;
 
             // TODO: would be nice not to alloc this on every lookup
             var arc = fst.GetFirstArc(new FST<T>.Arc<T>());
@@ -124,7 +124,7 @@ namespace Lucene.Net.Util.Fst
         /// </summary>
         public static IntsRef GetByOutput(FST<long> fst, long targetOutput)
         {
-            var @in = fst.GetBytesReader;
+            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>());
@@ -376,7 +376,7 @@ namespace Lucene.Net.Util.Fst
             public TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, IComparer<T>
comparator)
             {
                 this.Fst = fst;
-                this.BytesReader = fst.GetBytesReader;
+                this.BytesReader = fst.BytesReader;
                 this.TopN = topN;
                 this.MaxQueueDepth = maxQueueDepth;
                 this.Comparator = comparator;
@@ -479,7 +479,7 @@ namespace Lucene.Net.Util.Fst
 
                 //System.out.println("search topN=" + topN);
 
-                var fstReader = Fst.GetBytesReader;
+                var fstReader = Fst.BytesReader;
                 T NO_OUTPUT = Fst.Outputs.NoOutput;
 
                 // TODO: we could enable FST to sorting arcs by weight
@@ -760,7 +760,7 @@ namespace Lucene.Net.Util.Fst
             EmitDotState(@out, "initial", "point", "white", "");
 
             T NO_OUTPUT = fst.Outputs.NoOutput;
-            var r = fst.GetBytesReader;
+            var r = fst.BytesReader;
 
             // final FST.Arc<T> scratchArc = new FST.Arc<>();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd0a0811/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 94efec0..3800ec9 100644
--- a/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
+++ b/src/Lucene.Net.TestFramework/Util/fst/FSTTester.cs
@@ -220,7 +220,7 @@ namespace Lucene.Net.Util.Fst
             FST<T>.Arc<T> arc = fst.GetFirstArc(new FST.Arc<T>());
             T NO_OUTPUT = fst.Outputs.NoOutput;
             T output = NO_OUTPUT;
-            FST.BytesReader fstReader = fst.GetBytesReader;
+            FST.BytesReader fstReader = fst.BytesReader;
 
             for (int i = 0; i <= term.Length; i++)
             {
@@ -267,7 +267,7 @@ namespace Lucene.Net.Util.Fst
             @in.Offset = 0;
             T NO_OUTPUT = fst.Outputs.NoOutput;
             T output = NO_OUTPUT;
-            FST.BytesReader fstReader = fst.GetBytesReader;
+            FST.BytesReader fstReader = fst.BytesReader;
 
             while (true)
             {


Mime
View raw message