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

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

?? 8.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一区二区三区免费野_久草精品视频
精品国产乱码久久久久久图片 | 北条麻妃一区二区三区| 日韩二区三区四区| 香蕉乱码成人久久天堂爱免费| 国产欧美精品在线观看| 国产日产欧美精品一区二区三区| 精品理论电影在线| 久久综合中文字幕| 久久蜜桃一区二区| 日本一区二区高清| **网站欧美大片在线观看| 国产精品视频免费看| 国产精品欧美精品| 亚洲婷婷在线视频| 亚洲成人激情社区| 蜜臀av性久久久久蜜臀av麻豆| 久久精品99国产精品| 韩国v欧美v亚洲v日本v| 成人激情黄色小说| 在线日韩一区二区| 日韩你懂的在线播放| 久久新电视剧免费观看| 国产精品每日更新| 亚洲主播在线观看| 美腿丝袜在线亚洲一区| 国产一区999| 成人一道本在线| 欧美午夜不卡在线观看免费| 7777精品伊人久久久大香线蕉的 | 中文字幕一区二区三区精华液| 亚洲天堂成人在线观看| 亚洲午夜久久久久久久久电影院 | 欧美另类z0zxhd电影| 在线免费观看视频一区| 欧美大片拔萝卜| 中文字幕亚洲视频| 美女被吸乳得到大胸91| av中文字幕在线不卡| 欧美一区二区三区在线| 国产精品欧美综合在线| 男女激情视频一区| 91官网在线免费观看| 久久在线观看免费| 天天做天天摸天天爽国产一区| 高清av一区二区| 日韩视频在线永久播放| 一二三四区精品视频| 丁香桃色午夜亚洲一区二区三区| 欧美日韩卡一卡二| 中文字幕在线不卡| 韩国精品主播一区二区在线观看| 91国偷自产一区二区三区成为亚洲经典 | 欧美性xxxxx极品少妇| 国产欧美一区二区在线观看| 日韩av一二三| 91免费精品国自产拍在线不卡| 精品盗摄一区二区三区| 日韩激情中文字幕| 欧美综合视频在线观看| 国产精品的网站| 国产91精品免费| 久久综合五月天婷婷伊人| 美女视频第一区二区三区免费观看网站| 97精品久久久久中文字幕| 国产精品嫩草影院com| 韩日av一区二区| 日韩精品一区二区三区视频播放| 天堂一区二区在线免费观看| 色999日韩国产欧美一区二区| 欧美激情一区二区| 成人av在线资源| 中文字幕制服丝袜成人av| 国产福利一区二区三区视频| 久久久久9999亚洲精品| 国产成人精品三级麻豆| 国产无一区二区| av在线不卡电影| 国产精品国产三级国产普通话99 | 国产精品日产欧美久久久久| 国产一区视频网站| 久久久久久毛片| 国产成人综合精品三级| 中国av一区二区三区| 国产成人精品影视| 专区另类欧美日韩| 欧美午夜一区二区三区免费大片| 亚洲国产aⅴ成人精品无吗| 欧美老女人在线| 蜜桃视频免费观看一区| 精品精品欲导航| 成人午夜视频在线观看| 亚洲品质自拍视频| 欧美日高清视频| 国内成人自拍视频| 国产精品久久久久一区二区三区| 91在线国产福利| 同产精品九九九| 久久天天做天天爱综合色| eeuss鲁一区二区三区| 亚洲一区二区成人在线观看| 91麻豆精品国产自产在线观看一区| 精品中文av资源站在线观看| 国产精品美女一区二区| 欧美人狂配大交3d怪物一区| 精品一区二区三区欧美| 日韩一区日韩二区| 日韩一区二区三区免费看| 成人免费视频app| 日韩中文字幕亚洲一区二区va在线| 欧美一区二区高清| 99久久精品国产观看| 日本成人在线看| 亚洲免费av高清| 精品国内片67194| 欧美三级韩国三级日本一级| 国产高清精品久久久久| 日韩精品电影在线观看| 国产精品二三区| 久久综合九色综合欧美就去吻| 色婷婷av一区二区三区之一色屋| 亚洲综合色网站| 欧美激情一区三区| 日韩欧美另类在线| 欧美天堂一区二区三区| 国产大片一区二区| 麻豆国产精品777777在线| 亚洲欧美另类图片小说| 精品国产一区二区在线观看| 在线观看视频一区| 高清成人免费视频| 精品一区二区影视| 偷拍一区二区三区四区| 亚洲精品视频一区二区| 国产欧美视频一区二区三区| 日韩三级视频在线看| 色婷婷综合久久久久中文一区二区| 国产中文一区二区三区| 免费亚洲电影在线| 夜夜爽夜夜爽精品视频| 日韩一区中文字幕| 国产欧美一区在线| 国产亚洲精久久久久久| 久久免费美女视频| 欧美mv日韩mv国产| 日韩免费电影一区| 欧美一区二区三区免费大片| 欧美探花视频资源| 欧美日韩一区二区在线视频| 欧美最猛性xxxxx直播| 91传媒视频在线播放| 色综合av在线| 91成人在线精品| 欧美日韩中字一区| 在线精品亚洲一区二区不卡| 91首页免费视频| 欧美最新大片在线看 | 日韩一级高清毛片| 欧美一区二区私人影院日本| 欧美日韩国产美| 91精品国产综合久久精品app | 一区二区三区成人| 一区二区三区久久久| 亚洲.国产.中文慕字在线| 亚洲欧美视频一区| 亚洲成人动漫av| 蜜臀久久99精品久久久画质超高清 | 亚洲一区二区影院| 亚洲一区二区三区自拍| 午夜电影一区二区| 久久精品免费看| 成人aaaa免费全部观看| 99精品视频在线播放观看| 91黄色激情网站| 日韩欧美在线综合网| 久久久三级国产网站| 亚洲欧美自拍偷拍| 天堂va蜜桃一区二区三区 | 亚洲国产视频一区| 蜜桃av一区二区三区电影| 国产精品12区| 欧美亚洲动漫精品| 久久久久久夜精品精品免费| 亚洲视频电影在线| 全国精品久久少妇| 97精品国产露脸对白| 91精品国产免费| 欧美国产精品中文字幕| 午夜精品久久久久久久99樱桃 | 中文乱码免费一区二区| 亚洲一卡二卡三卡四卡无卡久久| 欧美aa在线视频| 色综合色综合色综合色综合色综合| 3atv一区二区三区| 国产精品高清亚洲| 久久狠狠亚洲综合| 95精品视频在线| 久久亚洲精品国产精品紫薇| 亚洲国产欧美在线| 成人黄色av电影| 精品人在线二区三区|