⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queue.java

📁 集束搜索,经典算法
💻 JAVA
字号:
/*	Name: Queue.java
 *	Author: Liu Lizhe
 *	Date Created: November 13,2004
 *	Description: Queue implementation in Java
 */

package com.LiuLizhe.util;

public class Queue extends java.util.Vector {
	public Queue() {
		super();
	}
	public synchronized void enQueue(Object x) {
		super.addElement(x);
	}
	public synchronized Object deQueue() {
		if(this.empty())
			throw new EmptyQueueException();
		Object x = super.elementAt(0);
		super.removeElementAt(0);
		return x;
	}
	public synchronized Object getHead() {
		if(this.empty())
			throw new EmptyQueueException();
		return super.elementAt(0);
	}
	public boolean empty() {
		return super.isEmpty();
	}
	public synchronized void clear() {
		super.removeAllElements();
	}
	public int search(Object x) {
		return super.indexOf(x);
	}
	public class EmptyQueueException extends java.lang.RuntimeException {
		public EmptyQueueException() {
		super();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -