示例#1
0
 // Append a cLinkedList item onto the list.
 public void Append(cLinkedList pList)
 {
     // If there's a mpNext, send the message down the list
     // If not, then mpNext becomes the input pList pointer
     if (mpNext != null)
         mpNext.Append(pList);
     else
         mpNext = pList;
 }
示例#2
0
        // Append an object onto the list
        public void Append(object pObject)
        {
            cLinkedList pListItem = new cLinkedList(pObject);

            Append(pListItem);
        }
示例#3
0
 // Default Constructor
 public cLinkedList()
 {
     mpNext = null;
     mpListItem = null;
 }
示例#4
0
 // Overwridden Constructor taking an object pointer
 public cLinkedList(object pObject)
 {
     mpNext = null;
     mpListItem = pObject;
 }
示例#5
0
        // Remove a specific object from the list
        public cLinkedList RemoveItem(object pItem)
        {
            cLinkedList pList;

            if (mpNext != null)
            {
                if (mpNext.mpListItem == mpListItem)
                {
                    pList = mpNext;
                    mpNext = pList.mpNext;
                    pList.mpNext = null;

                    return pList;
                }
                else
                    return mpNext.RemoveItem(pItem);
            }
            else
                return null;
        }