You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/02/08 14:32:12 UTC

[33/53] [abbrv] lucenenet git commit: Lucene.Net.Misc: Renamed all type-derived classes and interfaces from Short, Int, Long, and Float to match CLR types Int16, Int32, Int64, and Single, respectively.

Lucene.Net.Misc: Renamed all type-derived classes and interfaces from Short, Int, Long, and Float to match CLR types Int16, Int32, Int64, and Single, respectively.


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

Branch: refs/heads/api-work
Commit: 89e3de620d92acf9ceb48a7d98f82a0edcf473e9
Parents: c348531
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Feb 8 02:55:53 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Feb 8 21:08:23 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs   |  2 +-
 .../Util/Fst/UpToTwoPositiveIntOutputs.cs       | 48 +++++++++++---------
 .../Util/Fst/TestFSTsMisc.cs                    | 10 ++--
 3 files changed, 32 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/89e3de62/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs b/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs
index 5bc303b..27ca0f3 100644
--- a/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs
+++ b/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs
@@ -42,7 +42,7 @@ namespace Lucene.Net.Util.Fst
     /// how the FST maps a single input to multiple outputs (e.g. you
     /// cannot pass a List&lt;Object&gt; to <see cref="Builder{T}.Add(Int32sRef, T)"/>).  If
     /// your outputs are longs, and you need at most 2, then use
-    /// <see cref="UpToTwoPositiveIntOutputs"/> instead since it stores
+    /// <see cref="UpToTwoPositiveInt64Outputs"/> instead since it stores
     /// the outputs more compactly (by stealing a bit from each
     /// long value).
     /// 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/89e3de62/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs b/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs
index 0a21fb2..d4442ee 100644
--- a/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs
+++ b/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs
@@ -34,7 +34,7 @@ namespace Lucene.Net.Util.Fst
     /// <para>NOTE: the only way to create a TwoLongs output is to
     /// add the same input to the FST twice in a row.  This is
     /// how the FST maps a single input to two outputs (e.g. you
-    /// cannot pass a <see cref="TwoLongs"/> to <see cref="Builder{T}.Add(Int32sRef, T)"/>.  If you
+    /// cannot pass a <see cref="TwoInt64s"/> to <see cref="Builder{T}.Add(Int32sRef, T)"/>.  If you
     /// need more than two then use <see cref="ListOfOutputs{T}"/>, but if
     /// you only have at most 2 then this implementation will
     /// require fewer bytes as it steals one bit from each long
@@ -43,16 +43,20 @@ namespace Lucene.Net.Util.Fst
     /// </para>
     /// <para>NOTE: the resulting FST is not guaranteed to be minimal!
     /// See <see cref="Builder{T}"/>.
-    /// 
-    /// @lucene.experimental
     /// </para>
+    /// <para>
+    /// NOTE: This was UpToTwoPositiveIntOutputs in Lucene - the data type (int) was wrong there - it should have been long
+    /// </para>
+    /// @lucene.experimental
     /// </summary>
-    public sealed class UpToTwoPositiveIntOutputs : Outputs<object>
+    public sealed class UpToTwoPositiveInt64Outputs : Outputs<object>
     {
-
         /// <summary>
-        /// Holds two long outputs. </summary>
-        public sealed class TwoLongs
+        /// Holds two long outputs.
+        /// <para/>
+        /// NOTE: This was TwoLongs in Lucene
+        /// </summary>
+        public sealed class TwoInt64s
         {
             public long First
             {
@@ -66,7 +70,7 @@ namespace Lucene.Net.Util.Fst
             }
             private readonly long second;
 
-            public TwoLongs(long first, long second)
+            public TwoInt64s(long first, long second)
             {
                 this.first = first;
                 this.second = second;
@@ -81,9 +85,9 @@ namespace Lucene.Net.Util.Fst
 
             public override bool Equals(object other)
             {
-                if (other is TwoLongs)
+                if (other is TwoInt64s)
                 {
-                    TwoLongs other2 = (TwoLongs)other;
+                    TwoInt64s other2 = (TwoInt64s)other;
                     return first == other2.first && second == other2.second;
                 }
                 else
@@ -102,15 +106,15 @@ namespace Lucene.Net.Util.Fst
 
         private readonly bool doShare;
 
-        private static readonly UpToTwoPositiveIntOutputs singletonShare = new UpToTwoPositiveIntOutputs(true);
-        private static readonly UpToTwoPositiveIntOutputs singletonNoShare = new UpToTwoPositiveIntOutputs(false);
+        private static readonly UpToTwoPositiveInt64Outputs singletonShare = new UpToTwoPositiveInt64Outputs(true);
+        private static readonly UpToTwoPositiveInt64Outputs singletonNoShare = new UpToTwoPositiveInt64Outputs(false);
 
-        private UpToTwoPositiveIntOutputs(bool doShare)
+        private UpToTwoPositiveInt64Outputs(bool doShare)
         {
             this.doShare = doShare;
         }
 
-        public static UpToTwoPositiveIntOutputs GetSingleton(bool doShare)
+        public static UpToTwoPositiveInt64Outputs GetSingleton(bool doShare)
         {
             return doShare ? singletonShare : singletonNoShare;
         }
@@ -127,9 +131,9 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        public TwoLongs Get(long first, long second)
+        public TwoInt64s Get(long first, long second)
         {
-            return new TwoLongs(first, second);
+            return new TwoInt64s(first, second);
         }
 
         public override object Common(object output1, object output2)
@@ -203,9 +207,9 @@ namespace Lucene.Net.Util.Fst
             }
             else
             {
-                TwoLongs output3 = (TwoLongs)output;
+                TwoInt64s output3 = (TwoInt64s)output;
                 long v = prefix2.Value;
-                return new TwoLongs(output3.First + v, output3.Second + v);
+                return new TwoInt64s(output3.First + v, output3.Second + v);
             }
         }
 
@@ -219,7 +223,7 @@ namespace Lucene.Net.Util.Fst
             }
             else
             {
-                TwoLongs output3 = (TwoLongs)output;
+                TwoInt64s output3 = (TwoInt64s)output;
                 @out.WriteVInt64((output3.First << 1) | 1);
                 @out.WriteVInt64(output3.Second);
             }
@@ -246,7 +250,7 @@ namespace Lucene.Net.Util.Fst
                 // two longs
                 long first = (long)((ulong)code >> 1);
                 long second = @in.ReadVInt64();
-                return new TwoLongs(first, second);
+                return new TwoInt64s(first, second);
             }
         }
 
@@ -266,7 +270,7 @@ namespace Lucene.Net.Util.Fst
                 Debug.Assert(o is long?);
                 return Valid((long?)o);
             }
-            else if (o is TwoLongs)
+            else if (o is TwoInt64s)
             {
                 return true;
             }
@@ -293,7 +297,7 @@ namespace Lucene.Net.Util.Fst
         {
             Debug.Assert(Valid(first, false));
             Debug.Assert(Valid(second, false));
-            return new TwoLongs(((long?)first).GetValueOrDefault(), ((long?)second).GetValueOrDefault());
+            return new TwoInt64s(((long?)first).GetValueOrDefault(), ((long?)second).GetValueOrDefault());
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/89e3de62/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs b/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
index 7ad22ef..304f11d 100644
--- a/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
+++ b/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
@@ -67,7 +67,7 @@ namespace Lucene.Net.Util.Fst
                 {
                     Console.WriteLine("TEST: now test UpToTwoPositiveIntOutputs");
                 }
-                UpToTwoPositiveIntOutputs outputs = UpToTwoPositiveIntOutputs.GetSingleton(true);
+                UpToTwoPositiveInt64Outputs outputs = UpToTwoPositiveInt64Outputs.GetSingleton(true);
                 List<Lucene.Net.Util.Fst.FSTTester<object>.InputOutput<object>> pairs = new List<Lucene.Net.Util.Fst.FSTTester<object>.InputOutput<object>>(terms.Length);
                 long lastOutput = 0;
                 for (int idx = 0; idx < terms.Length; idx++)
@@ -153,16 +153,16 @@ namespace Lucene.Net.Util.Fst
 
             protected internal override bool OutputsEqual(T output1, T output2)
             {
-                if (output1 is UpToTwoPositiveIntOutputs.TwoLongs && output2 is IEnumerable<long>)
+                if (output1 is UpToTwoPositiveInt64Outputs.TwoInt64s && output2 is IEnumerable<long>)
                 {
-                    UpToTwoPositiveIntOutputs.TwoLongs twoLongs1 = output1 as UpToTwoPositiveIntOutputs.TwoLongs;
+                    UpToTwoPositiveInt64Outputs.TwoInt64s twoLongs1 = output1 as UpToTwoPositiveInt64Outputs.TwoInt64s;
                     long[] list2 = (output2 as IEnumerable<long>).ToArray();
                     return (new long[] { twoLongs1.First, twoLongs1.Second }).SequenceEqual(list2);
                 }
-                else if (output2 is UpToTwoPositiveIntOutputs.TwoLongs && output1 is IEnumerable<long>)
+                else if (output2 is UpToTwoPositiveInt64Outputs.TwoInt64s && output1 is IEnumerable<long>)
                 {
                     long[] list1 = (output1 as IEnumerable<long>).ToArray();
-                    UpToTwoPositiveIntOutputs.TwoLongs twoLongs2 = output2 as UpToTwoPositiveIntOutputs.TwoLongs;
+                    UpToTwoPositiveInt64Outputs.TwoInt64s twoLongs2 = output2 as UpToTwoPositiveInt64Outputs.TwoInt64s;
                     return (new long[] { twoLongs2.First, twoLongs2.Second }).SequenceEqual(list1);
                 }