\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
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
{
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)
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];