亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sortitem.java

?? Java各種排序算法代碼
?? JAVA
字號:
/*
 * @(#)SortItem.java	1.17f 95/04/10 James Gosling
			1.18  96/4/24  Jim Hagen : use setBackground
 *
 * Copyright (c) 1994-1996 Sun Microsystems, Inc. All Rights Reserved.
 *
 * Permission to use, copy, modify, and distribute this software
 * and its documentation for NON-COMMERCIAL or COMMERCIAL purposes and
 * without fee is hereby granted. 
 * Please refer to the file http://java.sun.com/copy_trademarks.html
 * for further important copyright and trademark information and to
 * http://java.sun.com/licensing.html for further important licensing
 * information for the Java (tm) Technology.
 * 
 * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
 * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 * 
 * THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
 * CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
 * PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
 * NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
 * SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
 * SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
 * PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES").  SUN
 * SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR
 * HIGH RISK ACTIVITIES.
 */
/**
 * JAVA愛好者:http://www.javafan.net
 * 免費提供Java教程、電子書籍、代碼源碼、開發工具等
 * 站長后注
 */
import java.awt.*;
import java.io.InputStream;
import java.util.Hashtable;
import java.net.*;

/**
 * A simple applet class to demonstrate a sort algorithm.
 * You can specify a sorting algorithm using the "alg"
 * attribute. When you click on the applet, a thread is
 * forked which animates the sorting algorithm.
 *
 * You can also specify the length of the pause with the
 * "pause" attribute. Default is 200.
 *
 * @author 		James Gosling
 * @version 	1.17f, 10 Apr 1995
 * @modified	Lars M. Garshol - 20.04.97 - Added pause parameter
 */
public class SortItem extends java.applet.Applet implements Runnable {
    /**
     * The thread that is sorting (or null).
     */
    private Thread kicker;

    /**
     * The array that is being sorted.
     */
    int arr[];

    /**
     * The high water mark.
     */
    int h1 = -1;

    /**
     * The low water mark.
     */
    int h2 = -1;

    /**
     * The name of the algorithm.
     */
    String algName;

    /**
     * The sorting algorithm (or null).
     */
    SortAlgorithm algorithm;

    /**
     * The length of the pause.
     */
    int pauselength;

    /**
     * Fill the array with random numbers from 0..n-1.
     */
    void scramble() {
	int a[] = new int[size().height / 2];
	double f = size().width / (double) a.length;
	for (int i = a.length; --i >= 0;) {
	    a[i] = (int)(i * f);
	}
	for (int i = a.length; --i >= 0;) {
	    int j = (int)(i * Math.random());
	    int t = a[i];
	    a[i] = a[j];
	    a[j] = t;
	}
	arr = a;
    }

    /**
     * Pause a while.
     * @see SortAlgorithm
     */
    void pause() {
	pause(-1, -1);
    }

    /**
     * Pause a while, and draw the high water mark.
     * @see SortAlgorithm
     */
    void pause(int H1) {
	pause(H1, -1);
    }

    /**
     * Pause a while, and draw the low&high water marks.
     * @see SortAlgorithm
     */
    void pause(int H1, int H2) {
	h1 = H1;
	h2 = H2;
	if (kicker != null) {
	    repaint();
	}
	try {Thread.sleep(pauselength);} 
          catch (InterruptedException e){}
    }

    /**
     * Initialize the applet.
     */
    public void init() {
	String at = getParameter("alg");
	if (at == null) {
	    at = "BubbleSort";
	}

	algName = at + "Algorithm";
	scramble();

	at = getParameter("pause");
	if (at == null) {
	    at = "200";
	}
      pauselength=Integer.parseInt(at);      

	resize(100, 100);
    }

    /**
     * Paint the array of numbers as a list
     * of horizontal lines of varying lenghts.
     */
    public void paint(Graphics g) {
	int a[] = arr;
	int y = size().height - 1;

	// Erase old lines
	g.setColor(getBackground());
	for (int i = a.length; --i >= 0; y -= 2) {
	    g.drawLine(arr[i], y, size().width, y);
	}

	// Draw new lines
	g.setColor(Color.black);
	y = size().height - 1;
	for (int i = a.length; --i >= 0; y -= 2) {
	    g.drawLine(0, y, arr[i], y);
	}

	if (h1 >= 0) {
	    g.setColor(Color.red);
	    y = h1 * 2 + 1;
	    g.drawLine(0, y, size().width, y);
	}
	if (h2 >= 0) {
	    g.setColor(Color.blue);
	    y = h2 * 2 + 1;
	    g.drawLine(0, y, size().width, y);
	}
    }

    /**
     * Update without erasing the background.
     */
    public void update(Graphics g) {
	paint(g);
    }

    /**
     * Run the sorting algorithm. This method is
     * called by class Thread once the sorting algorithm
     * is started.
     * @see java.lang.Thread#run
     * @see SortItem#mouseUp
     */
    public void run() {
	try {
	    if (algorithm == null) {
		algorithm = (SortAlgorithm)Class.forName(algName).newInstance();
		algorithm.setParent(this);
	    }
	    algorithm.init();
	    algorithm.sort(arr);
	} catch(Exception e) {
	}
    }

    /**
     * Stop the applet. Kill any sorting algorithm that
     * is still sorting.
     */
    public synchronized void stop() {
	if (kicker != null) {
            try {
		kicker.stop();
            } catch (IllegalThreadStateException e) {
                // ignore this exception
            }
	    kicker = null;
	}
	if (algorithm != null){
            try {
		algorithm.stop();
            } catch (IllegalThreadStateException e) {
                // ignore this exception
            }
	}
    }

    /**
     * For a Thread to actually do the sorting. This routine makes
     * sure we do not simultaneously start several sorts if the user
     * repeatedly clicks on the sort item.  It needs to be
     * synchronoized with the stop() method because they both
     * manipulate the common kicker variable.
     */
    private synchronized void startSort() {
	if (kicker == null || !kicker.isAlive()) {
	    scramble();
	    repaint();
	    kicker = new Thread(this);
	    kicker.start();
	}
    }

    /**
     * The user clicked in the applet. Start the clock!
     */
    public boolean mouseUp(java.awt.Event evt, int x, int y) {
	startSort();
	return true;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产综合成人久久大片91| 亚洲精品久久久蜜桃| 欧美人成免费网站| 在线亚洲免费视频| 色欧美片视频在线观看| 欧美亚洲自拍偷拍| 欧洲精品在线观看| 555夜色666亚洲国产免| 欧美日韩激情一区二区三区| 欧美老年两性高潮| 精品卡一卡二卡三卡四在线| 国产性天天综合网| 国产精品灌醉下药二区| 一区二区三区中文字幕| 视频一区中文字幕| 国产高清在线观看免费不卡| 本田岬高潮一区二区三区| 99久久国产综合精品色伊| 在线免费不卡电影| 欧美mv日韩mv| 亚洲欧美二区三区| 青青草精品视频| 国产成人免费视| 欧美在线免费播放| 精品国产123| 综合久久一区二区三区| 亚洲最大色网站| 美女一区二区久久| 成人h动漫精品一区二区| 欧美亚男人的天堂| 久久久综合视频| 亚洲一区二区三区四区在线观看| 青青草伊人久久| 色综合久久久久| 精品成人私密视频| 中文字幕佐山爱一区二区免费| 亚洲成av人片一区二区三区| 激情综合网激情| 欧美性淫爽ww久久久久无| 久久综合色一综合色88| 亚洲在线观看免费| 国产精品一区久久久久| 色噜噜狠狠色综合欧洲selulu| 欧美一级高清片| 亚洲影院免费观看| 国产成人免费网站| 欧美电影免费提供在线观看| 亚洲免费大片在线观看| 老汉av免费一区二区三区| 一本色道久久综合精品竹菊| 久久伊99综合婷婷久久伊| 日韩在线一区二区三区| 91视频免费看| 国产精品久久久久影院老司| 久久成人免费网站| 欧美日韩二区三区| 亚洲一区二区三区激情| 色域天天综合网| 国产精品久久久久一区二区三区 | 成人国产亚洲欧美成人综合网| 欧美日韩一区 二区 三区 久久精品| 国产欧美精品一区aⅴ影院| 免费观看成人av| 精品婷婷伊人一区三区三| 国产精品欧美久久久久无广告 | 久久精品一区二区三区av| 三级一区在线视频先锋 | 久久国产免费看| 欧美日韩一区二区三区四区| 亚洲一区二区三区中文字幕在线| 91免费视频网址| 亚洲天堂精品在线观看| 一本色道**综合亚洲精品蜜桃冫| 自拍偷拍亚洲欧美日韩| 99久久免费视频.com| 亚洲视频1区2区| 91网站最新地址| 亚洲免费av网站| 欧美唯美清纯偷拍| 亚洲午夜精品久久久久久久久| 色8久久人人97超碰香蕉987| 亚洲激情成人在线| 欧美日韩aaa| 麻豆免费精品视频| 欧美在线视频全部完| 国产色产综合产在线视频| 免费成人av在线播放| 欧美一级搡bbbb搡bbbb| 精品一区二区三区不卡| 久久久www免费人成精品| 国产精品99久久久久久久女警| 国产网红主播福利一区二区| 丁香五精品蜜臀久久久久99网站| 国产精品情趣视频| 91久久精品国产91性色tv| 日本亚洲最大的色成网站www| 日韩精品自拍偷拍| 高清视频一区二区| 一区二区三区中文字幕精品精品| 欧美在线观看一二区| 蜜桃精品在线观看| 1000部国产精品成人观看| 欧美色成人综合| 精品一区二区三区在线观看 | 亚洲自拍与偷拍| 日韩精品一区在线观看| 成人高清视频在线观看| 午夜精品福利视频网站| 国产午夜精品在线观看| 欧美午夜视频网站| 国产福利精品导航| 一区二区三国产精华液| 欧美成人激情免费网| 91视频你懂的| 国产精品资源在线| 亚洲超碰精品一区二区| 亚洲国产精品黑人久久久| 欧美色倩网站大全免费| 成人在线视频一区| 美腿丝袜在线亚洲一区| 亚洲老司机在线| 日韩欧美国产综合在线一区二区三区| 成人美女视频在线观看18| 免费观看30秒视频久久| 亚洲精品欧美专区| 国产欧美一区二区精品性| 欧美卡1卡2卡| 欧美性xxxxx极品少妇| 处破女av一区二区| 激情成人综合网| 五月婷婷另类国产| 亚洲免费观看高清完整| 国产日韩欧美精品电影三级在线| 欧美一级艳片视频免费观看| 欧美亚洲尤物久久| 91蜜桃网址入口| 成人激情综合网站| 国产风韵犹存在线视精品| 日韩av中文在线观看| 亚洲一区二区三区自拍| 亚洲综合一二区| 亚洲男同1069视频| 亚洲美女屁股眼交| 亚洲视频香蕉人妖| 国产精品高潮呻吟| 国产免费成人在线视频| 国产色产综合产在线视频| 欧美精品一区二区三区在线| 日韩欧美专区在线| 26uuu亚洲综合色| 日韩欧美色电影| 精品免费日韩av| 久久综合视频网| 国产人妖乱国产精品人妖| 中文幕一区二区三区久久蜜桃| 日本一区二区成人| 国产精品五月天| 一区二区国产视频| 亚洲成人精品一区二区| 日韩av午夜在线观看| 蜜臀av一区二区三区| 久久99精品久久久久婷婷| 国产福利91精品一区| 91女厕偷拍女厕偷拍高清| 在线观看不卡一区| 日韩欧美视频在线| 国产人久久人人人人爽| **欧美大码日韩| 午夜欧美视频在线观看| 蜜桃精品视频在线| 国产精品69毛片高清亚洲| 99久久亚洲一区二区三区青草| 91豆麻精品91久久久久久| 91精品视频网| 亚洲国产精品成人久久综合一区| 亚洲欧美激情一区二区| 日本欧美一区二区在线观看| 国产一区二区三区免费在线观看| 99这里只有精品| 欧美日韩色综合| 国产丝袜欧美中文另类| 亚洲成人自拍一区| 国产乱人伦偷精品视频不卡 | 久久精品视频一区二区| 亚洲丝袜另类动漫二区| 亚洲图片欧美一区| 国产一区二区三区免费观看| 91精彩视频在线观看| 久久综合精品国产一区二区三区 | 男女视频一区二区| www.欧美精品一二区| 欧美一级免费大片| 日本一区二区三区国色天香| 午夜精品成人在线| 成人av网站大全| 精品国产电影一区二区| 亚洲在线视频一区| 成人午夜在线视频| 欧美一二三在线| 一区二区三区中文字幕|