Beispiel #1
0
        public void LinkedList()
        {
            SystemLinkedListString linkedList = new SystemLinkedListString();

            linkedList.word = "sup guys";
            linkedList.Length();
            linkedList.Insert(linkedList.word);
            linkedList.Remove(2, 3);
            linkedList.ToString();
            Console.WriteLine(linkedList.newword);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("SystemString");
            SystemString systemString = new SystemString("Hello");
            Console.WriteLine(systemString.Length());
            systemString.Insert(5, " World!");
            Console.WriteLine(systemString);
            systemString.Insert(5, ",");
            Console.WriteLine(systemString);
            systemString.Remove(0, 7);
            Console.WriteLine(systemString);

            Console.WriteLine("SystemArrayString");
            SystemArrayString systemArrayString = new SystemArrayString("Hello");
            Console.WriteLine(systemArrayString.Length());
            systemArrayString.Insert(5, " World!");
            Console.WriteLine(systemArrayString);
            systemArrayString.Insert(5, ",");
            Console.WriteLine(systemArrayString);
            systemArrayString.Remove(0, 7);
            Console.WriteLine(systemArrayString);

            Console.WriteLine("SystemLinkedListString");
            SystemLinkedListString systemLinkedListString = new SystemLinkedListString("Hello");
            Console.WriteLine(systemLinkedListString.Length());
            systemLinkedListString.Insert(5, " World!");
            Console.WriteLine(systemLinkedListString);
            systemLinkedListString.Insert(5, ",");
            Console.WriteLine(systemLinkedListString);
            systemLinkedListString.Remove(0, 7);
            Console.WriteLine(systemLinkedListString);

            Console.WriteLine("CustomSystemLinkedListString");
            CustomLinkedListString customLinkedListString = new CustomLinkedListString("Hello");
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());
            customLinkedListString.Insert(5, " World!");
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());
            customLinkedListString.Insert(5, ",");
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());
            customLinkedListString.Remove(0, 7);
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());

            Console.ReadKey();
        }
        //        Create a custom string structure:
        //    Create an ICustomString interface with the following custom functions:
        //        string ToString()
        //        void Insert(string stringToInsert)
        //        void Remove(int startIndex, int numCharsToRemove)
        //        int Length()
        //    Inherit from the ICustomString interface to implement the following custom string subclasses:
        //        SystemString
        //            Underlying structure: System.string
        //            Piggyback off System.string's built-in functionality to implement ICustomString's functions
        //        SystemArrayString
        //            Underlying structure: System.array
        //            Each index of the underlying array holds one character
        //        SystemLinkedListString
        //            Underlying structure: System.Collections.Generic.LinkedList
        //            Each node of the underlying C# LinkedList holds one character
        //        CustomLinkedListString
        //            Underlying structure: your own custom linked list
        //            Each node of the underlying custom linked list structure holds one character
        static void Main(string[] args)
        {
            //SystemString systemstring = new SystemString();
            //systemstring.Insert("nt", 9);
            //systemstring.Length();
            //systemstring.Remove(7, 2);

            //SystemArrayString arrayString = new SystemArrayString();
            //arrayString.Insert("the", 0);
            //arrayString.Length();
            //arrayString.Remove(2, 3);

            SystemLinkedListString systemLinkedList = new SystemLinkedListString();
            Node<string> node = new Node<string>("ILoveThe");
            systemLinkedList.Insert(node.storage, 0);
            Console.ReadLine();
        }
//        Create a custom string structure:
//    Create an ICustomString interface with the following custom functions:
//        string ToString()
//        void Insert(string stringToInsert)
//        void Remove(int startIndex, int numCharsToRemove)
//        int Length()
//    Inherit from the ICustomString interface to implement the following custom string subclasses:
//        SystemString
//            Underlying structure: System.string
//            Piggyback off System.string's built-in functionality to implement ICustomString's functions
//        SystemArrayString
//            Underlying structure: System.array
//            Each index of the underlying array holds one character
//        SystemLinkedListString
//            Underlying structure: System.Collections.Generic.LinkedList
//            Each node of the underlying C# LinkedList holds one character
//        CustomLinkedListString
//            Underlying structure: your own custom linked list
//            Each node of the underlying custom linked list structure holds one character
        static void Main(string[] args)
        {
            //SystemString systemstring = new SystemString();
            //systemstring.Insert("nt", 9);
            //systemstring.Length();
            //systemstring.Remove(7, 2);

            //SystemArrayString arrayString = new SystemArrayString();
            //arrayString.Insert("the", 0);
            //arrayString.Length();
            //arrayString.Remove(2, 3);

            SystemLinkedListString systemLinkedList = new SystemLinkedListString();
            Node <string>          node             = new Node <string>("ILoveThe");

            systemLinkedList.Insert(node.storage, 0);
            Console.ReadLine();
        }