예제 #1
0
파일: List.cs 프로젝트: kosya/for_study
 public void PrintList()
 {
     ListElement pos = this.First();
     for (int i = 0; i < length; ++i)
     {
         Console.Write(Retrieve(pos.GetNext()));
         Console.Write(' ');
         pos = pos.GetNext();
     }
     Console.WriteLine();
 }
예제 #2
0
파일: List.cs 프로젝트: kosya/for_study
 public void Remove(ListElement pos)
 {
     ListElement temp = this.head;
     if (this.head.GetNext() == null)
         return;
     while (temp.GetNext() == null || temp.GetNext() != pos)
     {
         temp = temp.GetNext();
     }
     temp.SetNext(pos.GetNext());
     --length;
 }
예제 #3
0
파일: List.cs 프로젝트: kosya/for_study
        public bool Find(int value)
        {
            ListElement pos = this.First();

            while (pos.GetNext() != null)
            {
                if (pos.GetNext().GetNum() == value)
                {
                    return(true);
                }
                pos.SetNext(pos.GetNext());
            }
            return(false);
        }
예제 #4
0
 public virtual void Insert(int value, ListElement pos)
 {
     ListElement temp = new ListElement();
     temp.SetNum(value);
     temp.SetNext(pos.GetNext());
     pos.SetNext(temp);
     ++length;
 }
예제 #5
0
파일: List.cs 프로젝트: kosya/for_study
 public virtual void Insert(int value, ListElement pos)
 {
     ListElement temp = new ListElement();
     temp.SetNum(value);
     temp.SetNext(pos.GetNext());
     pos.SetNext(temp);
     ++length;
 }
예제 #6
0
 public void Remove(ListElement pos)
 {
     ListElement temp = this.head;
     if (this.head.GetNext() == null)
         return;
     while (temp.GetNext() == null || temp.GetNext() != pos)
     {
         temp = temp.GetNext();
     }
     temp.SetNext(pos.GetNext());
     --length;
 }
예제 #7
0
 public ListElement Next(ListElement pos)
 {
     return pos.GetNext();
 }
예제 #8
0
파일: List.cs 프로젝트: kosya/for_study
 public ListElement Next(ListElement pos)
 {
     return(pos.GetNext());
 }