lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 14/20: Lucene.Net.Analysis.Kuromoji: Changed GetInstance() > Instance property for ConnectionCosts, TokenInfoDictionary, and UnknownDictionary
Date Tue, 03 Dec 2019 14:03:44 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 1cb33f6a1402b52e42292347993e01c044d51bf0
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Mon Nov 25 18:03:33 2019 +0700

    Lucene.Net.Analysis.Kuromoji: Changed GetInstance() > Instance property for ConnectionCosts,
TokenInfoDictionary, and UnknownDictionary
---
 src/Lucene.Net.Analysis.Kuromoji/Dict/CharacterDefinition.cs   |  5 +----
 src/Lucene.Net.Analysis.Kuromoji/Dict/ConnectionCosts.cs       |  5 +----
 src/Lucene.Net.Analysis.Kuromoji/Dict/TokenInfoDictionary.cs   | 10 ++--------
 src/Lucene.Net.Analysis.Kuromoji/Dict/UnknownDictionary.cs     |  7 ++-----
 src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs          |  6 +++---
 .../Dict/TestTokenInfoDictionary.cs                            |  4 ++--
 .../TestJapaneseTokenizer.cs                                   |  2 +-
 7 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Kuromoji/Dict/CharacterDefinition.cs b/src/Lucene.Net.Analysis.Kuromoji/Dict/CharacterDefinition.cs
index eba14c2..7e0938a 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Dict/CharacterDefinition.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Dict/CharacterDefinition.cs
@@ -100,10 +100,7 @@ namespace Lucene.Net.Analysis.Ja.Dict
             return (byte)Enum.Parse(typeof(CharacterClass), characterClassName, true);
         }
 
-        public static CharacterDefinition GetInstance()
-        {
-            return SingletonHolder.INSTANCE;
-        }
+        public static CharacterDefinition Instance => SingletonHolder.INSTANCE;
 
         private class SingletonHolder
         {
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Dict/ConnectionCosts.cs b/src/Lucene.Net.Analysis.Kuromoji/Dict/ConnectionCosts.cs
index 3dc848d..2d41024 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Dict/ConnectionCosts.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Dict/ConnectionCosts.cs
@@ -66,10 +66,7 @@ namespace Lucene.Net.Analysis.Ja.Dict
             return costs[backwardId][forwardId];
         }
 
-        public static ConnectionCosts GetInstance()
-        {
-            return SingletonHolder.INSTANCE;
-        }
+        public static ConnectionCosts Instance => SingletonHolder.INSTANCE;
 
         private class SingletonHolder
         {
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Dict/TokenInfoDictionary.cs b/src/Lucene.Net.Analysis.Kuromoji/Dict/TokenInfoDictionary.cs
index 9760018..d278e00 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Dict/TokenInfoDictionary.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Dict/TokenInfoDictionary.cs
@@ -43,15 +43,9 @@ namespace Lucene.Net.Analysis.Ja.Dict
             this.fst = new TokenInfoFST(fst, true);
         }
 
-        public TokenInfoFST FST
-        {
-            get { return fst; }
-        }
+        public TokenInfoFST FST => fst;
 
-        public static TokenInfoDictionary GetInstance()
-        {
-            return SingletonHolder.INSTANCE;
-        }
+        public static TokenInfoDictionary Instance => SingletonHolder.INSTANCE;
 
         private class SingletonHolder
         {
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Dict/UnknownDictionary.cs b/src/Lucene.Net.Analysis.Kuromoji/Dict/UnknownDictionary.cs
index 5927601..9f1c7c0 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Dict/UnknownDictionary.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Dict/UnknownDictionary.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Ja.Dict
     /// </summary>
     public class UnknownDictionary : BinaryDictionary
     {
-        private readonly CharacterDefinition characterDefinition = CharacterDefinition.GetInstance();
+        private readonly CharacterDefinition characterDefinition = CharacterDefinition.Instance;
 
         private UnknownDictionary()
         {
@@ -76,10 +76,7 @@ namespace Lucene.Net.Analysis.Ja.Dict
             return null;
         }
 
-        public static UnknownDictionary GetInstance()
-        {
-            return SingletonHolder.INSTANCE;
-        }
+        public static UnknownDictionary Instance => SingletonHolder.INSTANCE;
 
         private class SingletonHolder
         {
diff --git a/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs b/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs
index 8aa7504..7512eb2 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs
@@ -168,12 +168,12 @@ namespace Lucene.Net.Analysis.Ja
             this.readingAtt = AddAttribute<IReadingAttribute>();
             this.inflectionAtt = AddAttribute<IInflectionAttribute>();
 
-            dictionary = TokenInfoDictionary.GetInstance();
+            dictionary = TokenInfoDictionary.Instance;
             fst = dictionary.FST;
-            unkDictionary = UnknownDictionary.GetInstance();
+            unkDictionary = UnknownDictionary.Instance;
             characterDefinition = unkDictionary.CharacterDefinition;
             this.userDictionary = userDictionary;
-            costs = ConnectionCosts.GetInstance();
+            costs = ConnectionCosts.Instance;
             fstReader = fst.GetBytesReader();
             if (userDictionary != null)
             {
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs
index 009203e..3eb5cd2 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs
@@ -35,8 +35,8 @@ namespace Lucene.Net.Analysis.Ja.Dict
             int numWords = 0;
             int lastWordId = -1;
             int lastSourceId = -1;
-            TokenInfoDictionary tid = TokenInfoDictionary.GetInstance();
-            ConnectionCosts matrix = ConnectionCosts.GetInstance();
+            TokenInfoDictionary tid = TokenInfoDictionary.Instance;
+            ConnectionCosts matrix = ConnectionCosts.Instance;
             FST<long?> fst = tid.FST.InternalFST;
             Int32sRefFSTEnum<long?> fstEnum = new Int32sRefFSTEnum<long?>(fst);
             Int32sRefFSTEnum.InputOutput<long?> mapping;
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
index 32bf2ac..3996c38 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
@@ -418,7 +418,7 @@ namespace Lucene.Net.Analysis.Ja
         [Test]
         public void TestLatticeToDot()
         {
-            GraphvizFormatter gv2 = new GraphvizFormatter(ConnectionCosts.GetInstance());
+            GraphvizFormatter gv2 = new GraphvizFormatter(ConnectionCosts.Instance);
             Analyzer analyzer = Analyzer.NewAnonymous(createComponents: (fieldName, reader)
=>
             {
                 JapaneseTokenizer tokenizer = new JapaneseTokenizer(reader, ReadDict(), false,
JapaneseTokenizerMode.SEARCH)


Mime
View raw message