OSDN Git Service

微修正
authorkomutan <t_komuta@nifty.com>
Sun, 27 Jul 2014 03:00:46 +0000 (12:00 +0900)
committerkomutan <t_komuta@nifty.com>
Sun, 27 Jul 2014 03:00:46 +0000 (12:00 +0900)
src/LibNMeCab/Core/PriorityQueue.cs

index 004cbd9..ab2772a 100644 (file)
@@ -22,7 +22,7 @@ namespace NMeCab.Core
         public void Push(T item)\r
         {\r
             int currentPos = this.list.Count;\r
-            this.list.Add(item); // dummy\r
+            this.list.Add(default(T));\r
 \r
             while (currentPos != 0)\r
             {\r
@@ -30,6 +30,7 @@ namespace NMeCab.Core
                 T parent = this.list[parentPos];\r
 \r
                 if (parent.CompareTo(item) <= 0) break;\r
+\r
                 this.list[currentPos] = parent;\r
                 currentPos = parentPos;\r
             }\r
@@ -48,7 +49,7 @@ namespace NMeCab.Core
         private void DeleteRoot()\r
         {\r
             int tailPos = this.list.Count - 1;\r
-            T current = this.list[tailPos];\r
+            T current = this.list[tailPos]; // final\r
             this.list.RemoveAt(tailPos);\r
             if (tailPos == 0) return; // empty\r
             tailPos--;\r
@@ -72,6 +73,7 @@ namespace NMeCab.Core
                 }\r
 \r
                 if (current.CompareTo(child) < 0) break;\r
+\r
                 this.list[currentPos] = child;\r
                 currentPos = childPos;\r
             }\r