Esempio n. 1
0
        public Via(Kid k1, Kid k2)
        {
            var chain = new UCLinkedList <Kid>();

            chain.PushFront(k2);
            chain.PushFront(k1);
            Chain = chain;
        }
Esempio n. 2
0
 public UCLinkedList <T> Concat(UCLinkedList <T> other)
 {
     foreach (var node in other)
     {
         this.AddLast(node);
     }
     return(this);
 }
Esempio n. 3
0
 public Via(UCLinkedList <Kid> chain)
 {
     if (chain.Count < 2)
     {
         throw new ArgumentException("A Chain has to be at least two elements long.");
     }
     this.Chain = chain;
 }
Esempio n. 4
0
        public UCLinkedList <T> Reverse()
        {
            var chain = new UCLinkedList <T>();

            foreach (var node in this)
            {
                chain.PushFront(node);
            }
            return(chain);

            /* TODO: do this properly
             * ref var left = this.First;
             * ref var right = this.Last;
             * for (var i = 0; i <= this.Count / 2; i++) {
             *  (left, right) = (right, left);
             *
             * }
             */
        }