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

📄 sortalgorithm.java

📁 char33-2 多线程应用 提供了本书第3章的多线程应用实例的源程序;
💻 JAVA
字号:
public abstract class SortAlgorithm {
	private AnimatePanel parent;
	
	protected boolean stopRequested = false;
	public void setParent(AnimatePanel p) {
		parent = p;
	}
	//停止整个算法
	protected void pause() throws Exception {
		if (stopRequested) {
			throw new Exception("Sort Algorithm");
		}
		parent.pause(parent.h1, parent.h2);
	}
	
	protected void pause(int H1) throws Exception {
		if (stopRequested) {
			throw new Exception("Sort Algorithm");
		}
		parent.pause(H1, parent.h2);
	}
	
	protected void pause(int H1, int H2) throws Exception {
		if (stopRequested) {
			throw new Exception("Sort Algorithm");
		}
		parent.pause(H1, H2);
	}
	
	public void stop() {
		stopRequested = true;
	}
	//初始化方法
	public void init() {
		stopRequested = false;
	}
	
	abstract void sort(int[] a) throws Exception;
	
	abstract String getName();
}

⌨️ 快捷键说明

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