All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.search.framework.QueueFactory Maven / Gradle / Ivy

Go to download

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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy