001 /* 002 * Created on Jul 17, 2004 003 * 004 * To change the template for this generated file go to 005 * Window - Preferences - Java - Code Generation - Code and Comments 006 */ 007 package aima.search.nodestore; 008 009 import java.util.List; 010 import aima.datastructures.LIFOQueue; 011 import aima.search.framework.Node; 012 import aima.search.framework.NodeStore; 013 014 /** 015 * @author Ravi Mohan 016 * 017 */ 018 019 public class LIFONodeStore implements NodeStore { 020 LIFOQueue queue; 021 022 public LIFONodeStore() { 023 queue = new LIFOQueue(); 024 } 025 026 public void add(Node anItem) { 027 queue.add(anItem); 028 029 } 030 031 public Node remove() { 032 return (Node) queue.remove(); 033 } 034 035 public void add(List nodes) { 036 queue.add(nodes); 037 038 } 039 040 public boolean isEmpty() { 041 return queue.isEmpty(); 042 } 043 044 public int size() { 045 return queue.size(); 046 } 047 048 }