public void undo(int levels) { for (int i = 0; i < levels; i++) { if (current > 0) { CommandPattern command = comandos[--current]; comandos.Remove(command); command.undo(); } } }
public void compute(CommandPattern command) { command.execute(); comandos.Add(command); current++; }