private int objectType; //This allows checkings for mixed types public TailLink() { content = null; previous = null; next = null; objectType = 0; }
public TailLink(object _content, int _objectType) { content = null; previous = null; next = null; content = _content; objectType = _objectType; }
public TailLink(object _content) { content = null; previous = null; next = null; content = _content; objectType = 0; }
public void Append(object content,int objectType) { if (head == null){ head = new TailLink(content, objectType); tail = head; size++; } else{ tail.Next = new TailLink(content, objectType); tail.Next.Previous = tail; tail = tail.Next; // <<< fun here too size++; } }
public int DeleteAt(int i) { // Return 1 if deleted, 0 (or less) if not if (size == 0 || i > (size - 1) || i < 0) { return(-1); } TailLink temp; // Temporary used object if (i == 0) //deleting the head { temp = head.Next; head = null; //Garbage collector, hi! head = temp; size--; return(1); } if (i == (size - 1)) //deleting the tail { temp = tail.Previous; tail = null; // Garbage collector, hi again! tail = temp; size--; return(1); } // deleting any other object temp = head; while (i != 0) { temp = temp.Next; // Look for it i--; } /// A => B => C // (deleting B here) TailLink aux = temp; aux.Next.Previous = aux.Previous; aux.Previous.Next = aux.Next; aux = null; size--; return(1); }
public void Append(object content, int objectType) { if (head == null) { head = new TailLink(content, objectType); tail = head; size++; } else { tail.Next = new TailLink(content, objectType); tail.Next.Previous = tail; tail = tail.Next; // <<< fun here too size++; } }
public int TypeAt(int i) { // Give them null if not available (empty, out of bounds + - ) if (size == 0 || i > (size - 1) || i < 0) { return(-1); } TailLink temp = head; while (i != 0) { temp = temp.Next; // <<< Fun here i--; } return(temp.ObjectType); }
public DynamicTail() { size = 0; head = null; tail = null; }
public int DeleteAt(int i) { // Return 1 if deleted, 0 (or less) if not if (size == 0 || i>(size-1) || i < 0) return -1; TailLink temp; // Temporary used object if (i==0){ //deleting the head temp = head.Next; head = null; //Garbage collector, hi! head = temp; size--; return 1; } if (i==(size-1)){ //deleting the tail temp = tail.Previous; tail = null; // Garbage collector, hi again! tail = temp; size--; return 1; } // deleting any other object temp = head; while (i!=0){ temp = temp.Next; // Look for it i--; } /// A => B => C // (deleting B here) TailLink aux = temp; aux.Next.Previous = aux.Previous; aux.Previous.Next = aux.Next; aux = null; size--; return 1; }
public TailLink(object _content,int _objectType) { content = null; previous = null; next = null; content = _content; objectType = _objectType; }
public TailLink() { content = null; previous = null; next = null; objectType = 0; }