Beispiel #1
0
        // FIXME: test it
        public DList <ElementType, ParentType> Copy()
        {
            DList <ElementType, ParentType> result = new DList <ElementType, ParentType> ();

            DList <ElementType, ParentType> .Iterator insert_it = new DList <ElementType, ParentType> .Iterator(this);

            DList <ElementType, ParentType> .Iterator enum_it = new DList <ElementType, ParentType> .Iterator(result);

            while (true)
            {
                enum_it.Advance();
                if (!enum_it.ElementAvailable)
                {
                    break;
                }

                insert_it.Insert(enum_it.Element);
            }

            return(result);
        }
Beispiel #2
0
 public Iterator(DList <ElementType, ParentType> DL)
 {
     current = DL.head;
     this.DL = DL;
 }