001package myhw3.command; 002 003/** 004 * An unbounded list of commands with undo/redo capability. 005 * 006 * <p>Logically, the functionality is described in terms of two stacks: 007 * <code>undoable</code> and <code>redoable</code>, both initially empty.</p> 008 */ 009public interface CommandHistory { 010 /** 011 * Add command <code>undoable</code> and clear <code>redoable</code>. 012 * @param cmd the command to be run. 013 */ 014 public void add(Command cmd); 015 016 /** 017 * Pop command from <code>undoable</code>, undo it, then push it 018 * onto <code>redoable</code>. 019 */ 020 public boolean undo(); 021 022 /** 023 * Pop command from <code>redoable</code>, redo it, then push it 024 * onto <code>undoable</code>. 025 */ 026 public boolean redo(); 027}