예제 #1
0
        public StackWindow Pop()
        {
            _count--;
            StackWindow result = _stackWindows[_count];

            _stackWindows[_count] = null;
            return(result);
        }
예제 #2
0
        public void Push(StackWindow stackWindow)
        {
            if (_count >= _maxCallDepth)
            {
                throw new BaseException(BaseException.Codes.CallStackOverflow, _maxCallDepth);
            }

            EnsureCapacity(_count);
            _stackWindows[_count] = stackWindow;
            _count++;
        }
예제 #3
0
 private void EnsureCapacity(int requiredCapacity)
 {
     if (_stackWindows.Length <= requiredCapacity)
     {
         StackWindow[] newStackWindows = new StackWindow[Math.Max(_stackWindows.Length, 1) * 2];
         for (int index = 0; index < _stackWindows.Length; index++)
         {
             newStackWindows[index] = _stackWindows[index];
         }
         _stackWindows = newStackWindows;
     }
 }