import java.util.LinkedList; import java.util.Queue; /** * Uses a queue to sequence the squares of the maze as explored. * * @author Scot Drysdale * @see Sequencer */ public class QueueSequencer implements Sequencer { private Queue theQueue; /** * Constructor that initializes a queue */ public QueueSequencer() { theQueue = new LinkedList(); } /** *

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

{@inheritDoc} */ public SequenceItem next() { return theQueue.remove(); } /** *

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

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