package cn.bunny.pattern5.demo2;

import cn.bunny.pattern5.demo2.command.Command;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务员
 */
public class Waiter {

    private final List<Command> commandList = new ArrayList<>();

    public void addCommand(Command command) {
        commandList.add(command);
    }

    /**
     * 通知厨师去做
     */
    public void notifyCook() {
        for (Command command : commandList) {
            command.execute();
        }
    }
}
