예제 #1
0
        public void Push(T item)
        {
            _impl.Add(item);

            if (ItemPushed != null)
            {
                ItemPushed.Invoke(this, new StackItemEventArgs <T>(item));
            }
        }
예제 #2
0
 public bool Push()
 {
     if (_enumerator.MoveNext())
     {
         ItemPushed?.Invoke(this, new ItemPushedEventArgs <T>(_enumerator.Current));
         return(true);
     }
     else
     {
         AreAllItemsPushed = true;
         AllItemsPushed?.Invoke(this, EventArgs.Empty);
         AllItemsPushed = null;
         return(false);
     }
 }
예제 #3
0
파일: Stack.cs 프로젝트: ORKEMEY/StackLab1
        public void Push(T newObj)
        {
            Item <T> nextItem = GetNextEmptyItem();

            if (nextItem != null)
            {
                nextItem.Object   = newObj;
                nextItem.IsFilled = true;
                _Head             = nextItem;
            }
            else
            {
                _CapacityHead = _Head = new Item <T>(_Head, newObj);
            }
            ItemPushed?.Invoke(this, newObj, _Head.Index);
        }