main
 1using System.Collections.Generic;
 2
 3namespace common
 4{
 5    public class SynchronousCommandProcessor : CommandProcessor
 6    {
 7        readonly Queue<Command> queued_commands;
 8
 9        public SynchronousCommandProcessor()
10        {
11            queued_commands = new Queue<Command>();
12        }
13
14        public void add(Command command_to_process)
15        {
16            queued_commands.Enqueue(command_to_process);
17        }
18
19        public void run()
20        {
21            while (queued_commands.Count > 0) queued_commands.Dequeue().run();
22        }
23
24        public void stop()
25        {
26            queued_commands.Clear();
27        }
28    }
29}