OSDN Git Service

微修正
authorkomutan <t_komuta@nifty.com>
Mon, 4 Aug 2014 14:52:45 +0000 (23:52 +0900)
committerkomutan <t_komuta@nifty.com>
Mon, 4 Aug 2014 14:52:45 +0000 (23:52 +0900)
src/LibNMeCab/Core/MeCabDictionary.cs
src/LibNMeCab/Core/PriorityQueue.cs

index 39702a1..79a1fee 100644 (file)
@@ -220,7 +220,7 @@ namespace NMeCab.Core
 \r
         public unsafe Token[] GetToken(DoubleArray.ResultPair n)\r
         {\r
-            Token[] dist = new Token[this.GetTokenSize(n)];\r
+            Token[] dist = new Token[0xFF & n.Value];\r
             int tokenPos = n.Value >> 8;\r
 #if MMF_DIC\r
             this.tokens.ReadArray<Token>(tokenPos * sizeof(Token), dist, 0, dist.Length);\r
@@ -230,11 +230,6 @@ namespace NMeCab.Core
             return dist;\r
         }\r
 \r
-        public int GetTokenSize(DoubleArray.ResultPair n)\r
-        {\r
-            return 0xFF & n.Value;\r
-        }\r
-\r
         public string GetFeature(uint featurePos)\r
         {\r
             return StrUtils.GetString(this.features, (long)featurePos, this.encoding);\r
index 0d6604c..2f28af2 100644 (file)
@@ -23,7 +23,7 @@ namespace NMeCab.Core
         {
             if (item == null) throw new ArgumentNullException("item");
 
-            int currentPos = this.list.Count;
+            int currentPos = this.list.Count; //tail
             this.list.Add(default(T));
 
             while (currentPos != 0)
@@ -41,24 +41,24 @@ namespace NMeCab.Core
 
         public T Pop()
         {
-            if (this.Count == 0) throw new InvalidOperationException("Empty");
+            if (this.list.Count == 0) throw new InvalidOperationException("Empty");
 
-            T ret = this.list[0];
+            T ret = this.list[0]; //root
 
             int tailPos = this.list.Count - 1;
-            T current = this.list[tailPos]; // final
+            T current = this.list[tailPos];
             this.list.RemoveAt(tailPos);
-            if (tailPos == 0) return ret; // empty
+            if (tailPos == 0) return ret; //empty
             tailPos--;
 
             int currentPos = 0;
             while (true)
             {
-                int childPos = currentPos * 2 + 1; // left child
+                int childPos = currentPos * 2 + 1; //left child
                 if (childPos > tailPos) break;
                 T child = this.list[childPos];
 
-                int wrkPos = childPos + 1; // right child
+                int wrkPos = childPos + 1; //right child
                 if (wrkPos <= tailPos)
                 {
                     T wrk = this.list[wrkPos];