aima.core.search.framework.QueueFactory Maven / Gradle / Ivy
package aima.core.search.framework;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
/**
* Factory class for queues. Changes made here will affect all queue based
* search algorithms of this library.
*
* @author Ruediger Lunde
*
*/
public class QueueFactory {
/**
* Returns a {@link LinkedList}.
*/
public static Queue createFifoQueue() {
return new LinkedList();
}
/**
* Returns a Last-in-first-out (Lifo) view on a {@link LinkedList}.
*/
public static Queue createLifoQueue() {
return Collections.asLifoQueue(new LinkedList());
}
/**
* Returns a standard java {@link PriorityQueue}. Note that the smallest
* element comes first!
*/
public static Queue createPriorityQueue(Comparator comparator) {
return new PriorityQueue(11, comparator);
}
}