示例#1
0
 public override void Add(Figure obj)
 {
     if (!obj.GetObservers().Contains(this))
     {
         obj.AddObserver(this);
     }
     if (size == capacity)
     {
         Figure[] copy = ptr;
         capacity = (int)((capacity + 1) * 1.25);
         ptr      = new Figure[capacity];
         for (int i = 0; i < size; i++)
         {
             ptr[i] = copy[i];
         }
         ptr[size] = obj;
         size++;
         NotifyAboutChangeInStorage();
         return;
     }
     ptr[size] = obj;
     size++;
     NotifyAboutChangeInStorage();
 }