public void stringToCustomLinkedCharList(string manString) { manipulatedCustom.AddFirst(manString.ElementAt(0)); head = manipulatedCustom.First; for (int i = 1; i < manString.Length; i++) { manipulatedCustom.AddAfter(head, manString.ElementAt(i)); head = head.Next; } }
public void AddAfter(CNode <T> current, T cValue) { CNode <T> temp = new CNode <T>(cValue); CNode <T> temp2; temp2 = current.Next; current.Next = temp; temp.Next = temp2; temp.Last = current; }
public override string ToString() { string manString = null; head = manipulatedCustom.First; for (int i = 0; i < manipulatedCustom.Count(); i++) { manString += head.Value; head = head.Next; } return(manString); }
public void AddFirst(T cValue) { CNode <T> temp = new CNode <T>(cValue); if (Head == null) { Head = temp; } while (Head.Last != null) { temp = temp.Last; } first = temp; }
public int Count() { int count; int loopcount = 0; CNode <T> headholder = Head; for (int i = 0; headholder != null; i++) { headholder = headholder.Next; loopcount++; } count = loopcount; return(count); }
public void Insert(int startIndex, string stringToInsert) { int count = 0; head = manipulatedCustom.First; for (int i = 0; i < manipulatedCustom.Count(); i++) { if (i >= startIndex - 1 && count < stringToInsert.Length) { manipulatedCustom.AddAfter(head, stringToInsert.ElementAt(count)); count++; } head = head.Next; } }
//public void addHead(T cValue) //{ // CNode<T> temp = new CNode<T>(cValue); // temp.Next = head; // head = temp; //} public void AddLast(T cValue) { CNode <T> temp = new CNode <T>(cValue); if (Head == null) { Head = temp; } else { while (Head.Next != null) { temp = temp.Next; } } last = temp; }
public void Remove(int startIndex, int numCharsToRemove) { int count2 = 0; head = manipulatedCustom.First; for (int i = 0; i < manipulatedCustom.Count(); i++) { CNode <char> next; next = head.Next; while (i >= startIndex - 1 && count2 < numCharsToRemove) { CNode <char> nextNext; nextNext = next.Next; manipulatedCustom.Remove(next); next = nextNext; count2++; } head = head.Next; } }
public CNode(T CValue) { cValue = CValue; next = null; last = null; }
public void Remove(CNode <T> current) { current.Next.Last = current.Last; current.Last.Next = current.Next; current = null; }
public CustomLinkedList() { Head = null; }