001    package aima.search.uninformed;
002    
003    import java.util.List;
004    
005    import aima.search.framework.Metrics;
006    import aima.search.framework.Problem;
007    import aima.search.framework.QueueSearch;
008    import aima.search.framework.Search;
009    import aima.search.nodestore.LIFONodeStore;
010    
011    /**
012     * Artificial Intelligence A Modern Approach (2nd Edition): page 75.
013     * 
014     * Depth-first search.
015     */
016    public class DepthFirstSearch implements Search {
017    
018            QueueSearch search;
019    
020            public DepthFirstSearch(QueueSearch search) {
021    
022                    this.search = search;
023    
024            }
025    
026            public List search(Problem p) {
027    
028                    return search.search(p, new LIFONodeStore());
029            }
030    
031            public Metrics getMetrics() {
032                    return search.getMetrics();
033            }
034    
035    }