Exemple #1
0
 /// <summary>
 /// Removes a command of a certain trigger, returns null and removes nothing if not found.
 /// </summary>
 /// <param name="cmd"></param>
 /// <returns> The removed command. </returns>
 public Command Remove(Command cmd)
 {
     Command ret = null;
     DualPointer use = head;
     for(int i = 0; i < size; i++)
     {
         if (use.MyCommand.Trigger == cmd.Trigger)
         {
             ret = use.MyCommand;
             break;
         }
         else
         {
             use = head.GetNextPointer;
         }
     }
     return ret;
 }
Exemple #2
0
 /// <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>
        /// Adds a command to the top of the stack.
        /// </summary>
        /// <param name="cmd"></param>
        public void Push(Command cmd)
        {

        }
Exemple #4
0
 /// <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;
 }