示例#1
0
文件: KeyStack.cs 项目: mjdavy/Eliza
        /// <summary>Push a key in the stack.</summary>
        /// <remarks>
        /// Push a key in the stack.
        /// Keep the highest rank keys at the bottom.
        /// </remarks>
        public virtual void PushKey(Eliza.Key key)
        {
            if (key == null)
            {
                ConsoleSurrogate.WriteLine("push null key");
                return;
            }
            int i;

            for (i = keyTop; i > 0; i--)
            {
                if (key.rank > keyStack[i - 1].rank)
                {
                    keyStack[i] = keyStack[i - 1];
                }
                else
                {
                    break;
                }
            }
            keyStack[i] = key;
            keyTop++;
        }
示例#2
0
 public virtual void Copy(Eliza.Key k)
 {
     key    = k.GetKey();
     rank   = k.Rank();
     decomp = k.Decomp();
 }