示例#1
0
 public bool MoveNext()
 {
     if (current == null)
     {
         current = beg;
     }
     else
     {
         current = current.next;
     }
     return(current != null);
 }
示例#2
0
        public void FindInColl(T beg1, int employee)
        {
            DoublePointConnection <Organization> p = beg;

            while (p != null)
            {
                if (p.data.Number_of_employees == employee)
                {
                    Console.WriteLine(p.ToString());
                }
            }
            p = p.next;
        }
示例#3
0
        public void Delete(int nom)
        {
            DoublePointConnection <Organization> dp1;
            DoublePointConnection <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;
        }
示例#4
0
        public void Add(int nom, params Organization[] mas)
        {
            DoublePointConnection <Organization> p1    = beg;
            DoublePointConnection <Organization> temp1 = new DoublePointConnection <Organization>(mas[rnd.Next(0, mas.Length - 1)]);
            DoublePointConnection <Organization> vr1;
            DoublePointConnection <Organization> vr2;
            DoublePointConnection <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;
        }
示例#5
0
        public DoubleListConnection(params Organization[] mas)
        {
            DoublePointConnection <Organization> r;

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

            for (int i = 1; i < mas.Length; i++)
            {
                DoublePointConnection <Organization> temp = new DoublePointConnection <Organization>(mas[i]);
                DoublePointConnection <Organization> vr   = new DoublePointConnection <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;
                }
            }
        }
示例#6
0
 public DoublePointConnection(T data, DoublePointConnection <T> next, DoublePointConnection <T> pred)
 {
     this.data = data;
     this.next = next;
     this.pred = pred;
 }
示例#7
0
 public DoublePointConnection(T d)
 {
     next = null;
     data = d;
     pred = null;
 }
示例#8
0
 public DoublePointConnection()
 {
     data = default;
     next = null;
     pred = null;
 }
示例#9
0
 public void Reset()
 {
     current = this.beg;
 }
示例#10
0
 public void DeleteCollection(T beg)//нужно передать корень коллекции
 {
     this.beg = null;
 }
示例#11
0
 public MyNumerator(DoubleListConnection <T> collection)
 {
     //beg = collection.beg;
     current = null;
 }