Example #1
0
        private int objectType;         //This allows checkings for mixed types

        public TailLink()
        {
            content    = null;
            previous   = null;
            next       = null;
            objectType = 0;
        }
Example #2
0
 public TailLink(object _content, int _objectType)
 {
     content    = null;
     previous   = null;
     next       = null;
     content    = _content;
     objectType = _objectType;
 }
Example #3
0
 public TailLink(object _content)
 {
     content    = null;
     previous   = null;
     next       = null;
     content    = _content;
     objectType = 0;
 }
Example #4
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++;
     }
 }
Example #5
0
        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);
        }
Example #6
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++;
     }
 }
Example #7
0
        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);
        }
Example #8
0
 public DynamicTail()
 {
     size = 0;
     head = null;
     tail = null;
 }
Example #9
0
        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;
        }
Example #10
0
 public TailLink(object _content,int _objectType)
 {
     content = null;
     previous = null;
     next = null;
     content = _content;
     objectType = _objectType;
 }
Example #11
0
 public TailLink(object _content)
 {
     content = null;
     previous = null;
     next = null;
     content = _content;
     objectType = 0;
 }
Example #12
0
 public DynamicTail()
 {
     size = 0;
     head = null;
     tail = null;
 }
Example #13
0
 public TailLink()
 {
     content = null;
     previous = null;
     next = null;
     objectType = 0;
 }