001package headfirst.command.undo; 002 003public class DimmerLightOnCommand implements Command { 004 Light light; 005 int prevLevel; 006 007 public DimmerLightOnCommand(Light light) { 008 this.light = light; 009 } 010 011 public void execute() { 012 prevLevel = light.getLevel(); 013 light.dim(75); 014 } 015 016 public void undo() { 017 light.dim(prevLevel); 018 } 019}