aima.core.search.framework.QueueFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
The newest version!
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);
}
}