Example #1
0
 private void CheckStack()
 {
     if (_orbStack.Count == _stackSize)
     {
         stackFull.Invoke(StackProcessor.GetId(_orbStack));
         _orbStack.Clear();
     }
 }
Example #2
0
 public void Push(T obj)
 {
     data.Add(obj);
     if (StackEvent != null)
     {
         StackEvent.Invoke(this, new StackEventData <T> {
             IsPushed = true, Value = obj
         });
     }
 }
Example #3
0
        public T Pop()
        {
            if (data.Count == 0)
            {
                throw new InvalidOperationException();
            }
            var result = data[data.Count - 1];

            if (StackEvent != null)
            {
                StackEvent.Invoke(this, new StackEventData <T> {
                    IsPushed = false, Value = result
                });
            }
            return(result);
        }
Example #4
0
 public void Publish(object sender, TEventArgs eventArg)
 {
     StackEvent?.Invoke(sender, eventArg);
 }