001package headfirst.command.party;
002
003public class MacroCommand implements Command {
004        Command[] commands;
005
006        public MacroCommand(Command[] commands) {
007                this.commands = commands;
008        }
009
010        public void execute() {
011                for (int i = 0; i < commands.length; i++) {
012                        commands[i].execute();
013                }
014        }
015
016        public void undo() {
017                for (int i = 0; i < commands.length; i++) {
018                        commands[i].undo();
019                }
020        }
021}
022