/** * Uses a stack to sequence the squares of the maze as explored. * * @author Scot Drysdale * @see Sequencer */ public class StackSequencer implements Sequencer { private CS10Stack theStack; /** * Constructor that initializes a stack */ public StackSequencer() { theStack = new ArrayListStack(); } /** *

{@inheritDoc} */ public void add(int row, int col, SequenceItem prev) { theStack.push(new SequenceItem(row, col, prev)); } /** *

{@inheritDoc} */ public SequenceItem next() { return theStack.pop(); } /** *

{@inheritDoc} */ public boolean hasNext() { return !theStack.isEmpty(); } /** * Not needed for stack sequencer. *

{@inheritDoc} */ public void setTarget(int row, int col) {} }