Example #1
0
 private void BuildIntLinkedListRandom(SCLinkedList <int> list, int start, int end)
 {
     for (int i = start; i <= end; ++i)
     {
         list.InsertTail(i);
     }
     WriteLine("Build:[{0}:{1}]", start, end);
 }
Example #2
0
 public void Push(T data)
 {
     if (m_List == null)
     {
         m_List = new SCLinkedList <T>();
     }
     m_List.InsertHead(data);
 }
Example #3
0
 private void BuildStringLinkedListRandom(SCLinkedList <string> list, int start, int end)
 {
     for (int i = start; i <= end; ++i)
     {
         list.InsertTail(string.Format("Index:{0}", i));
     }
     WriteLine("Build:[{0}:{1}]", start, end);
 }
Example #4
0
        private void TestInt()
        {
            WriteBegin("LinkListTest(Int)");
            SCLinkedList <int> list = new SCLinkedList <int>();

            BuildIntLinkedListRandom(list, 0, 10);
            BuildIntLinkedListRandom(list, 11, 20);
            RemoveListAtIndex(list, 19);
            RemoveListAtIndex(list, 0);
            RemoveData(list, 7);
            VisitList(list);
            FindData(list, 9);
            WriteEnd("LinkListTest(Int)");
        }
Example #5
0
        private void TestString()
        {
            WriteBegin("LinkListTest(String)");
            SCLinkedList <string> list = new SCLinkedList <string>();

            BuildStringLinkedListRandom(list, 0, 10);
            BuildStringLinkedListRandom(list, 11, 20);
            RemoveListAtIndex(list, 19);
            RemoveListAtIndex(list, 0);
            RemoveData(list, "Index:7");
            VisitList(list);
            FindData(list, "Index:9");
            WriteEnd("LinkListTest(String)");
        }
Example #6
0
 protected void FindData <T>(SCLinkedList <T> list, T data)
 {
     WriteLine("FindData{0}: Result:{1}", data, list.Query(data));
 }
Example #7
0
 private void VisitList <T>(SCLinkedList <T> list)
 {
     WriteLine("Data Begin:");
     list.Accept(VisitData);
     WriteLine("");
 }
Example #8
0
 private void RemoveData <T>(SCLinkedList <T> list, T data)
 {
     WriteLine("Remove Data:{0}-Result:{1}", data, list.Remove(data));
 }
Example #9
0
 private void RemoveListAtIndex <T>(SCLinkedList <T> list, int index)
 {
     WriteLine("Remove At:{0}-Result:{1}", index, list.RemoveAt(index));
 }