/// <summary> /// Adds a command to the tail of the linked list. /// </summary> /// <param name="cmd"></param> public void Add(Command cmd) { switch(size) { case 0: head = new DualPointer(null, null, cmd); tail = new DualPointer(null, null, cmd); break; case 1: tail.GetPreviousPointer = head; tail.MyCommand = cmd; head.GetNextPointer = tail; break; default: tail.GetPreviousPointer = tail; tail.MyCommand = cmd; break; } size++; }
/// <summary> /// Constructor for the DualPointer. /// </summary> /// <param name="bef"></param> /// <param name="af"></param> /// <param name="comd"></param> public DualPointer(DualPointer bef, DualPointer af, Command comd) { before = bef; after = af; myComd = comd; }