lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [17/50] [abbrv] lucenenet git commit: Renamed SizeInBytes() to GetSizeInBytes() (with a verb) because this action can be intensive and thus should not be a property or have a noun for a name.
Date Sun, 02 Oct 2016 14:35:35 GMT
Renamed SizeInBytes() to GetSizeInBytes() (with a verb) because this action can be intensive
and thus should not be a property or have a noun for a name.


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

Branch: refs/heads/master
Commit: 537d88600dc0cf99549966b24c45c64500c10c7d
Parents: 75ac55f
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Sep 16 01:56:04 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 17:44:27 2016 +0700

----------------------------------------------------------------------
 .../Suggest/Analyzing/AnalyzingInfixSuggester.cs             | 2 +-
 .../Suggest/Analyzing/AnalyzingSuggester.cs                  | 4 ++--
 .../Suggest/Analyzing/FreeTextSuggester.cs                   | 2 +-
 src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs    | 2 +-
 src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs   | 2 +-
 src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellLookup.cs      | 4 ++--
 .../Suggest/Jaspell/JaspellTernarySearchTrie.cs              | 8 ++++----
 src/Lucene.Net.Suggest/Suggest/Lookup.cs                     | 2 +-
 src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs              | 4 ++--
 src/Lucene.Net.Suggest/Suggest/Tst/TernaryTreeNode.cs        | 8 ++++----
 .../Suggest/Analyzing/TestFreeTextSuggester.cs               | 2 +-
 src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs  | 2 +-
 12 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
index da6a043..23a38eb 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
@@ -747,7 +747,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             }
         }
 
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
             long mem = RamUsageEstimator.ShallowSizeOf(this);
             try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
index 8b13969..f43c6df 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
@@ -252,9 +252,9 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
         /// <summary>
         /// Returns byte size of the underlying FST. </summary>
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
-            return fst == null ? 0 : fst.SizeInBytes();
+            return fst == null ? 0 : fst.SizeInBytes(); // LUCENENET TODO: Rename FST.SizeInBytes()
to FST.GetSizeInBytes() because this can be intensive and it should be a method (with a verb)
         }
 
         private void CopyDestTransitions(State from, State to, IList<Transition> transitions)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
index b4fe98b..0a52947 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
@@ -192,7 +192,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
         /// <summary>
         /// Returns byte size of the underlying FST. </summary>
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
             if (fst == null)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
index 0a7ba25..ae71771 100644
--- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
@@ -311,7 +311,7 @@ namespace Lucene.Net.Search.Suggest.Fst
             }
         }
 
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
             long mem = RamUsageEstimator.ShallowSizeOf(this) + RamUsageEstimator.ShallowSizeOf(normalCompletion)
+ RamUsageEstimator.ShallowSizeOf(higherWeightsCompletion);
             if (normalCompletion != null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
index f487b91..40defba 100644
--- a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
@@ -332,7 +332,7 @@ namespace Lucene.Net.Search.Suggest.Fst
 
         /// <summary>
         /// Returns byte size of the underlying FST. </summary>
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
             return (fst == null) ? 0 : fst.SizeInBytes();
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellLookup.cs b/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellLookup.cs
index 708a11e..a272add 100644
--- a/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellLookup.cs
@@ -242,9 +242,9 @@ namespace Lucene.Net.Search.Suggest.Jaspell
 
         /// <summary>
         /// Returns byte size of the underlying TST. </summary>
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
-            return trie.SizeInBytes();
+            return trie.GetSizeInBytes();
         }
 
         public override long Count

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs b/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
index 598f384..d0814c6 100644
--- a/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
@@ -100,14 +100,14 @@ namespace Lucene.Net.Search.Suggest.Jaspell
 
             /// <summary>
             /// Return an approximate memory usage for this node and its sub-nodes. </summary>
-            public long SizeInBytes()
+            public long GetSizeInBytes()
             {
                 long mem = RamUsageEstimator.ShallowSizeOf(this) + RamUsageEstimator.ShallowSizeOf(relatives);
                 foreach (TSTNode node in relatives)
                 {
                     if (node != null)
                     {
-                        mem += node.SizeInBytes();
+                        mem += node.GetSizeInBytes();
                     }
                 }
                 return mem;
@@ -971,13 +971,13 @@ namespace Lucene.Net.Search.Suggest.Jaspell
 
         /// <summary>
         /// Return an approximate memory usage for this trie. </summary>
-        public virtual long SizeInBytes()
+        public virtual long GetSizeInBytes()
         {
             long mem = RamUsageEstimator.ShallowSizeOf(this);
             TSTNode root = Root;
             if (root != null)
             {
-                mem += root.SizeInBytes();
+                mem += root.GetSizeInBytes();
             }
             return mem;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Lookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Lookup.cs b/src/Lucene.Net.Suggest/Suggest/Lookup.cs
index 6f52c27..7cdb951 100644
--- a/src/Lucene.Net.Suggest/Suggest/Lookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Lookup.cs
@@ -293,6 +293,6 @@ namespace Lucene.Net.Search.Suggest
         /// <summary>
         /// Get the size of the underlying lookup implementation in memory </summary>
         /// <returns> ram size of the lookup implementation in bytes </returns>
-        public abstract long SizeInBytes();
+        public abstract long GetSizeInBytes();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs b/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs
index b7a9239..45110e7 100644
--- a/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs
@@ -276,12 +276,12 @@ namespace Lucene.Net.Search.Suggest.Tst
         /// <summary>
         /// Returns byte size of the underlying TST
         /// </summary>
-        public override long SizeInBytes()
+        public override long GetSizeInBytes()
         {
             long mem = RamUsageEstimator.ShallowSizeOf(this);
             if (root != null)
             {
-                mem += root.SizeInBytes();
+                mem += root.GetSizeInBytes();
             }
             return mem;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Suggest/Suggest/Tst/TernaryTreeNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Tst/TernaryTreeNode.cs b/src/Lucene.Net.Suggest/Suggest/Tst/TernaryTreeNode.cs
index 43d29d7..030ccf1 100644
--- a/src/Lucene.Net.Suggest/Suggest/Tst/TernaryTreeNode.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Tst/TernaryTreeNode.cs
@@ -52,20 +52,20 @@ namespace Lucene.Net.Search.Suggest.Tst
         internal string token;
         internal object val;
 
-        internal virtual long SizeInBytes()
+        internal virtual long GetSizeInBytes()
         {
             long mem = RamUsageEstimator.ShallowSizeOf(this);
             if (loKid != null)
             {
-                mem += loKid.SizeInBytes();
+                mem += loKid.GetSizeInBytes();
             }
             if (eqKid != null)
             {
-                mem += eqKid.SizeInBytes();
+                mem += eqKid.GetSizeInBytes();
             }
             if (hiKid != null)
             {
-                mem += hiKid.SizeInBytes();
+                mem += hiKid.GetSizeInBytes();
             }
             if (token != null)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index e1cf56e..c88b6e7 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -219,7 +219,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             sug.Build(new TestWikiInputIterator(this, lfd));
             if (VERBOSE)
             {
-                Console.WriteLine(sug.SizeInBytes() + " bytes");
+                Console.WriteLine(sug.GetSizeInBytes() + " bytes");
 
                 IList<Lookup.LookupResult> results = sug.DoLookup("general r", 10);
                 Console.WriteLine("results:");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/537d8860/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
index 2c9682d..be02682 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
@@ -153,7 +153,7 @@ namespace Lucene.Net.Search.Suggest
             foreach (Type cls in benchmarkClasses)
             {
                 Lookup lookup = BuildLookup(cls, dictionaryInput);
-                long sizeInBytes = lookup.SizeInBytes();
+                long sizeInBytes = lookup.GetSizeInBytes();
                 Console.WriteLine(
             string.Format(CultureInfo.InvariantCulture, "{0,15}s size[B]:{1:#,##0}" /*"%-15s
size[B]:%,13d"*/,
                 lookup.GetType().Name,


Mime
View raw message