Example #1
0
        public virtual NAW Delete(string key)
        {
            if (key == null)
            {
                return(null);
            }
            else if (Find(key) != null)
            {
                LogFileLink temp = Head;
                NAW         tempnaw;
                if (temp.Key == key)
                {
                    tempnaw = temp.Value;
                    Head    = temp.Next;
                    return(tempnaw);
                }

                while (temp != null)
                {
                    if (temp.Next.Key == key)
                    {
                        tempnaw   = temp.Next.Value;
                        temp.Next = temp.Next.Next;
                        return(tempnaw);
                    }
                    temp = temp.Next;
                }
                return(null);
            }

            return(null);
        }
        public virtual NAW Delete(string key)
        {
            if (key == null)
            {
                return(null);
            }

            LogFileLink temp     = Head;
            LogFileLink previous = null;

            while (temp != null)
            {
                if (temp.Key.Equals(key))
                {
                    if (temp == Head)
                    {
                        Head = temp.Next;
                    }
                    else
                    {
                        previous.Next = temp.Next;
                    }


                    NAW target = temp.Value;
                    temp.Next = null;
                    return(target);
                }

                previous = temp;
                temp     = temp.Next;
            }
            return(null);
        }
Example #3
0
        public virtual void Insert(string key, NAW value)
        {
            if (key == null)
            {
                throw new ArgumentNullException();
            }
            LogFileLink temp = new LogFileLink(key, value, Head);

            Head = temp;
        }
Example #4
0
 public virtual NAW Find(string key)
 {
     if (key == null)
     {
         return(null);
     }
     else
     {
         LogFileLink temp = Head;
         while (temp != null)
         {
             if (temp.Key == key)
             {
                 return(temp.Value);
             }
             temp = temp.Next;
         }
         return(null);
     }
 }
 public LogFileLink(string key, NAW value, LogFileLink next)
 {
     Key   = key;
     Value = value;
     Next  = next;
 }