lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [03/10] lucenenet git commit: Lucene.Net.Benchmark.ByTask.Tasks.AnalyzerFactory: Changed setter methods into properties and made PositionIncrementGap and OffsetGap nullable (so they can be used in the initializer).
Date Fri, 13 Oct 2017 11:10:00 GMT
Lucene.Net.Benchmark.ByTask.Tasks.AnalyzerFactory: Changed setter methods into properties and
made PositionIncrementGap and OffsetGap nullable (so they can be used in the initializer).


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

Branch: refs/heads/master
Commit: 5406340ddf02ddce592df7e0dacc52217117f993
Parents: 869d1dd
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Oct 4 23:29:40 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Oct 4 23:29:40 2017 +0700

----------------------------------------------------------------------
 .../ByTask/Tasks/AnalyzerFactoryTask.cs         |  9 +++--
 .../ByTask/Utils/AnalyzerFactory.cs             | 42 +++++++-------------
 2 files changed, 19 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5406340d/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
index 61d1832..3f0f60d 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
@@ -356,10 +356,11 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
                 }
             }
 
-            AnalyzerFactory analyzerFactory = new AnalyzerFactory
-                (charFilterFactories, tokenizerFactory, tokenFilterFactories);
-            analyzerFactory.SetPositionIncrementGap(positionIncrementGap.GetValueOrDefault());
-            analyzerFactory.SetOffsetGap(offsetGap.GetValueOrDefault());
+            AnalyzerFactory analyzerFactory = new AnalyzerFactory(charFilterFactories, tokenizerFactory,
tokenFilterFactories)
+            {
+                PositionIncrementGap = positionIncrementGap,
+                OffsetGap = offsetGap
+            };
             RunData.AnalyzerFactories[factoryName] = analyzerFactory;
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5406340d/src/Lucene.Net.Benchmark/ByTask/Utils/AnalyzerFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/AnalyzerFactory.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/AnalyzerFactory.cs
index 63c17cb..28a3ff6 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Utils/AnalyzerFactory.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Utils/AnalyzerFactory.cs
@@ -33,9 +33,9 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
         private IList<CharFilterFactory> charFilterFactories;
         private TokenizerFactory tokenizerFactory;
         private IList<TokenFilterFactory> tokenFilterFactories;
-        private string name = null;
-        private int? positionIncrementGap = null;
-        private int? offsetGap = null;
+        public string Name { get; set; } = null;
+        public int? PositionIncrementGap { get; set; } = null;
+        public int? OffsetGap { get; set; } = null;
 
         public AnalyzerFactory(IList<CharFilterFactory> charFilterFactories,
                                TokenizerFactory tokenizerFactory,
@@ -47,21 +47,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             this.tokenFilterFactories = tokenFilterFactories;
         }
 
-        // LUCENENET TODO: Properties ?
-        public void SetName(string name)
-        {
-            this.name = name;
-        }
-
-        public void SetPositionIncrementGap(int positionIncrementGap) // LUCENENET TODO:
Nullable?
-        {
-            this.positionIncrementGap = positionIncrementGap;
-        }
-
-        public void SetOffsetGap(int offsetGap) // LUCENENET TODO: Nullable?
-        {
-            this.offsetGap = offsetGap;
-        }
+        // LUCENENET specific - made Name, PositionIncrementGap, and OffsetGap setters into
properties (above)
 
         public Analyzer Create()
         {
@@ -104,15 +90,15 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
 
             public override int GetPositionIncrementGap(string fieldName)
             {
-                return outerInstance.positionIncrementGap.HasValue
-                    ? outerInstance.positionIncrementGap.Value
+                return outerInstance.PositionIncrementGap.HasValue
+                    ? outerInstance.PositionIncrementGap.Value
                     : base.GetPositionIncrementGap(fieldName);
             }
 
             public override int GetOffsetGap(string fieldName)
             {
-                return outerInstance.offsetGap.HasValue
-                    ? outerInstance.offsetGap.Value
+                return outerInstance.OffsetGap.HasValue
+                    ? outerInstance.OffsetGap.Value
                     : base.GetOffsetGap(fieldName);
             }
         }
@@ -120,22 +106,22 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
         public override string ToString()
         {
             StringBuilder sb = new StringBuilder("AnalyzerFactory(");
-            if (null != name)
+            if (null != Name)
             {
                 sb.Append("name:");
-                sb.Append(name);
+                sb.Append(Name);
                 sb.Append(", ");
             }
-            if (null != positionIncrementGap)
+            if (null != PositionIncrementGap)
             {
                 sb.Append("positionIncrementGap:");
-                sb.Append(positionIncrementGap);
+                sb.Append(PositionIncrementGap);
                 sb.Append(", ");
             }
-            if (null != offsetGap)
+            if (null != OffsetGap)
             {
                 sb.Append("offsetGap:");
-                sb.Append(offsetGap);
+                sb.Append(OffsetGap);
                 sb.Append(", ");
             }
             foreach (CharFilterFactory charFilterFactory in charFilterFactories)


Mime
View raw message