Ejemplo n.º 1
0
 public bool MoveNext()
 {
     if (actual == null)
     {
         actual = firstE; return(true);
     }
     if (actual.getNextStruct() == null)
     {
         return(false);
     }
     actual = actual.getNextStruct();
     return(true);
 }
Ejemplo n.º 2
0
        public T removeLast()
        {
            ListStruct <T> tmp = lastE;

            if (lastE != null)
            {
                if ((lastE = firstE.getPrevStruct()) == firstE)
                {
                    firstE = lastE;
                }
                length--;
                return(tmp.getElem());
            }
            return(default(T));
        }
Ejemplo n.º 3
0
 public void add(T elem)
 {
     if (firstE == null)
     {
         firstE = new ListStruct <T>(elem, null);
         lastE  = firstE;
     }
     else
     {
         ListStruct <T> tmp = new ListStruct <T>(elem, lastE);
         lastE.setNextStruct(tmp);
         lastE = tmp;
     }
     length++;
 }
Ejemplo n.º 4
0
 public T this[int index]
 {
     get
     {
         ListStruct <T> tmp = firstE;
         for (int i = 0; i < index; i++)
         {
             if (tmp != null)
             {
                 tmp = tmp.getNextStruct();
             }
             else
             {
                 return(default(T));
             }
         }
         return(tmp.getElem());
     }
 }
Ejemplo n.º 5
0
 public void setNextStruct(ListStruct <T> n)
 {
     nStruct = n;
 }
Ejemplo n.º 6
0
 public ListStruct(T elem, ListStruct <T> pStruct)
 {
     this.elem    = elem;
     this.pStruct = pStruct;
 }
Ejemplo n.º 7
0
 public void Reset()
 {
     actual = null;
 }
Ejemplo n.º 8
0
 public void Dispose()
 {
     actual = null;
 }