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

            chain.PushFront(k2);
            chain.PushFront(k1);
            Chain = chain;
        }
Ejemplo n.º 2
0
 public UCLinkedList <T> Concat(UCLinkedList <T> other)
 {
     foreach (var node in other)
     {
         this.AddLast(node);
     }
     return(this);
 }
Ejemplo 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;
 }
Ejemplo 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);
             *
             * }
             */
        }