Exemplo n.º 1
0
        /// <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++;
        }
Exemplo n.º 2
0
 public virtual void Copy(Eliza.Key k)
 {
     key    = k.GetKey();
     rank   = k.Rank();
     decomp = k.Decomp();
 }