Esempio n. 1
0
 //добавление случайного элемента в коллекцию
 public void AddDefault(int nom, string Name)
 {
     if (nom > Length)
     {
         Console.WriteLine("Номер элемента находится за перделами границ списка");
     }
     else
     {
         Factory Fact = new Factory();
         Fact = (Factory)Fact.Init();
         NewDoublePointConnection <Organization> p1    = beg;
         NewDoublePointConnection <Organization> temp1 = new NewDoublePointConnection <Organization>(Fact);
         NewDoublePointConnection <Organization> vr1;
         NewDoublePointConnection <Organization> vr2;
         NewDoublePointConnection <Organization> p2 = beg;
         for (int i = 1; i < nom; i++)
         {
             p2 = p2.next;
         }
         vr2 = p2;
         for (int i = 1; i < nom - 1; i++)
         {
             p1 = p1.next;
         }
         vr1     = p1;
         p1.next = temp1;
         p1      = p1.next;
         p1.pred = vr1;
         p1.next = vr2;
         ChanAdd(nom, Name);
         OnCollectionCountChanged(this, new CollectionHandlerEventArgs(NameColl, "Дабавление случайного элемента", p2));
     }
 }
Esempio n. 2
0
 public void Add(int nom, Organization org, string Name, params Organization[] mas)//добавление введенного элемента в коллекцию
 {
     if (nom > Length)
     {
         Console.WriteLine("Номер элемента находится за перделами границ списка");
     }
     else
     {
         NewDoublePointConnection <Organization> p1    = beg;
         NewDoublePointConnection <Organization> temp1 = new NewDoublePointConnection <Organization>(org);
         NewDoublePointConnection <Organization> vr1;
         NewDoublePointConnection <Organization> vr2;
         NewDoublePointConnection <Organization> p2 = beg;
         for (int i = 1; i < nom; i++)
         {
             p2 = p2.next;
         }
         vr2 = p2;
         for (int i = 1; i < nom - 1; i++)
         {
             p1 = p1.next;
         }
         vr1     = p1;
         p1.next = temp1;
         p1      = p1.next;
         p1.pred = vr1;
         p1.next = vr2;
         ChanAdd(nom, Name);
         OnCollectionCountChanged(this, new CollectionHandlerEventArgs(NameColl, "Дабавление", p2));
     }
 }
Esempio n. 3
0
 public bool MoveNext()
 {
     if (current == null)
     {
         current = beg;
     }
     else
     {
         current = current.next;
     }
     return(current != null);
 }
Esempio n. 4
0
        public void FindInColl(T beg1, int employee)
        {
            NewDoublePointConnection <Organization> p = beg;

            while (p != null)
            {
                if (p.data.Number_of_employees == employee)
                {
                    Console.WriteLine(p.ToString());
                }
            }
            p = p.next;
        }
Esempio n. 5
0
 public void Delete(int nom, string Name)
 {
     if (nom > Length)
     {
         Console.WriteLine("Номер элемента находится за пределами границ списка");
     }
     else
     {
         NewDoublePointConnection <Organization> dp1;
         NewDoublePointConnection <Organization> dp = beg;
         for (int t = 0; t < nom; t++)
         {
             dp = dp.next;
         }
         dp.next = dp.next.next;
         dp1     = dp;
         dp      = dp.next.next;
         dp.pred = dp1;
         ChanDel(nom, Name);
         OnCollectionCountChanged(this, new CollectionHandlerEventArgs(NameColl, "Удаление", dp1));
     }
 }
Esempio n. 6
0
        public NewDoubleListConnection(string Name, params Organization[] mas)//передаем элемененты коллекции и ее имя
        {
            name = Name;
            NewDoublePointConnection <Organization> r;

            beg = new NewDoublePointConnection <Organization>(mas[0]);
            NewDoublePointConnection <Organization> p = beg;

            for (int i = 1; i < mas.Length; i++)
            {
                NewDoublePointConnection <Organization> temp = new NewDoublePointConnection <Organization>(mas[i]);
                NewDoublePointConnection <Organization> vr   = new NewDoublePointConnection <Organization>(mas[i - 1]);
                p.next = temp;
                p      = temp;
                p.pred = vr;
                if (i == mas.Length - 1)
                {
                    r      = p;
                    p.next = beg;
                    p      = beg;
                    p.pred = r;
                }
            }
        }
Esempio n. 7
0
 public void Reset()
 {
     current = this.beg;
 }
Esempio n. 8
0
 public void DeleteCollection(T beg)//нужно передать корень коллекции
 {
     this.beg = null;
 }
Esempio n. 9
0
 public MyNumerator(NewDoubleListConnection <T> collection)
 {
     //beg = collection.beg;
     current = null;
 }
Esempio n. 10
0
 public NewDoublePointConnection(T data, NewDoublePointConnection <T> next, NewDoublePointConnection <T> pred)
 {
     this.data = data;
     this.next = next;
     this.pred = pred;
 }
Esempio n. 11
0
 public NewDoublePointConnection(T d)
 {
     next = null;
     data = d;
     pred = null;
 }
Esempio n. 12
0
 public NewDoublePointConnection()
 {
     data = default;
     next = null;
     pred = null;
 }