public bool MoveNext() { if (actual == null) { actual = firstE; return(true); } if (actual.getNextStruct() == null) { return(false); } actual = actual.getNextStruct(); return(true); }
public T removeLast() { ListStruct <T> tmp = lastE; if (lastE != null) { if ((lastE = firstE.getPrevStruct()) == firstE) { firstE = lastE; } length--; return(tmp.getElem()); } return(default(T)); }
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++; }
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()); } }
public void setNextStruct(ListStruct <T> n) { nStruct = n; }
public ListStruct(T elem, ListStruct <T> pStruct) { this.elem = elem; this.pStruct = pStruct; }
public void Reset() { actual = null; }
public void Dispose() { actual = null; }