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

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

?? sortitem.java

?? 《移動Agent技術》一書的所有章節源代碼。
?? JAVA
字號:
/*
 * @(#)SortItem.java	1.5 97/07/30
 *
 * Copyright (c) 2070, 1997 Sun Microsystems, Inc. All Rights Reserved.
 *
 * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
 * modify and redistribute this software in source and binary code form,
 * provided that i) this copyright notice and license appear on all copies of
 * the software; and ii) Licensee does not utilize the software in a manner
 * which is disparaging to Sun.
 *
 * This software is provided "AS IS," without a warranty of any kind. ALL
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
 * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
 * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
 * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
 * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
 * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
 * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
 * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
 * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 *
 * This software is not designed or intended for use in on-line control of
 * aircraft, air traffic, aircraft navigation or aircraft communications; or in
 * the design, construction, operation or maintenance of any nuclear
 * facility. Licensee represents and warrants that it will not use or
 * redistribute the Software for such purposes.
 */

import java.awt.*;
import java.awt.event.*;
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"
 * attribyte. When you click on the applet, a thread is
 * forked which animates the sorting algorithm.
 *
 * @author James Gosling
 * @version 	1.17f, 10 Apr 1995
 */
public class SortItem 
    extends java.applet.Applet 
    implements Runnable, MouseListener {
    /**
     * 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;

    /**
     * Fill the array with random numbers from 0..n-1.
     */
    void scramble() {
	int a[] = new int[getSize().height / 2];
	double f = getSize().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(20);} catch (InterruptedException e){}
    }

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

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

	resize(100, 100);
	addMouseListener(this);
    }

    public void start() {
        scramble();
        repaint();
    }

    /**
     * Deallocate resources of applet.
     */
    public void destroy() {
        removeMouseListener(this);
    }

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

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

	// Draw new lines
	g.setColor(Color.black);
	y = getSize().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, getSize().width, y);
	}
	if (h2 >= 0) {
	    g.setColor(Color.blue);
	    y = h2 * 2 + 1;
	    g.drawLine(0, y, getSize().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 (algorithm != null){
            try {
		algorithm.stop();
            } catch (IllegalThreadStateException e) {
                // ignore this exception
            }
            kicker = null;
	}
    }

    /**
     * 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()) {
	    kicker = new Thread(this);
	    kicker.start();
	}
    }

  //1.1 event handling
  
  public void mouseClicked(MouseEvent e)
  {}
     
  public void mousePressed(MouseEvent e)
  {}

  /**
   * The user clicked in the applet. Start the clock!
   */
  
  public void mouseReleased(MouseEvent e) {
    startSort();
    e.consume();
  }
      
  public void mouseEntered(MouseEvent e)
  {}
      
  public void mouseExited(MouseEvent e) 	
  {}

  public String getAppletInfo() {
    return "Title: ImageMap \nAuthor: James Gosling 1.17f, 10 Apr 1995 \nA simple applet class to demonstrate a sort algorithm.  \nYou can specify a sorting algorithm using the 'alg' attribyte.  \nWhen you click on the applet, a thread is forked which animates \nthe sorting algorithm.";
  }
  
  public String[][] getParameterInfo() {
    String[][] info = {
      {"als", "string", "The name of the algorithm to run.  You can choose from the provided algorithms or suppply your own, as long as the classes are runnable as threads and their names end in 'Algorithm.'  BubbleSort is the default.  Example:  Use 'QSort' to run the QSortAlgorithm class."}
    };
    return info;
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品你懂的在线欣赏| 国内精品免费在线观看| 卡一卡二国产精品 | 国产欧美一区二区三区沐欲| 亚洲精品国久久99热| 国产一区二区精品久久99| 色香蕉久久蜜桃| 欧美国产乱子伦| 日韩av一区二区在线影视| 91久久精品一区二区| 中文字幕乱码一区二区免费| 久久99精品国产.久久久久| 欧美性感一类影片在线播放| 国产人成亚洲第一网站在线播放| 日本欧美韩国一区三区| 欧美日韩精品欧美日韩精品一 | 在线中文字幕一区二区| 欧美激情一区三区| 狠狠色狠狠色综合| 日韩无一区二区| 亚欧色一区w666天堂| 色婷婷综合久久久中文字幕| 中文字幕在线视频一区| 国产白丝网站精品污在线入口| 精品久久人人做人人爰| 免费的成人av| 日韩一区二区高清| 麻豆成人久久精品二区三区小说| 3d成人h动漫网站入口| 男男视频亚洲欧美| 欧美一区二区三区白人| 久草中文综合在线| 精品日韩在线观看| 精品一二线国产| 精品乱人伦一区二区三区| 久久精品国产一区二区三区免费看| 91精品国产综合久久福利软件| 亚洲超丰满肉感bbw| 69成人精品免费视频| 免费的成人av| 久久久久久久一区| 成人激情开心网| 亚洲图片你懂的| 欧洲一区在线观看| 日韩va欧美va亚洲va久久| 欧美va亚洲va国产综合| 国产精品亚洲一区二区三区妖精| 欧美激情中文不卡| av激情成人网| 亚洲一区二三区| 日韩亚洲欧美中文三级| 国产一区二区三区在线看麻豆| xf在线a精品一区二区视频网站| 国产麻豆精品在线| 中文字幕亚洲区| 欧美日韩黄视频| 精品久久久三级丝袜| 日韩精品电影一区亚洲| 日韩三区在线观看| 国产91丝袜在线播放| 亚洲综合一区二区三区| 欧美一二三四在线| 成人小视频在线| 亚洲国产精品久久久久婷婷884| 欧美电影免费观看完整版| 国产成人午夜99999| 亚洲国产另类精品专区| 久久久国产精华| 欧美日韩一区国产| 国产+成+人+亚洲欧洲自线| 夜色激情一区二区| 久久先锋资源网| 欧美色爱综合网| 国产成人无遮挡在线视频| 天天综合色天天综合| 91精品国产福利在线观看| 久久99久久99| 亚洲免费av高清| 亚洲精品一区二区三区蜜桃下载| 91在线看国产| 国内成人免费视频| 亚洲高清免费观看| 国产精品美女www爽爽爽| 欧美一二三四区在线| 在线亚洲欧美专区二区| 成人免费毛片嘿嘿连载视频| 日韩影院精彩在线| 亚洲线精品一区二区三区八戒| 欧美激情一区二区三区| 欧美成人a∨高清免费观看| 欧美亚洲国产一卡| bt7086福利一区国产| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲影视在线观看| 国产精品久久久久桃色tv| 欧美成人官网二区| 欧美日韩不卡在线| 欧美亚洲免费在线一区| 91视频免费播放| 不卡视频免费播放| 国产成人午夜精品5599| 国产一区二区在线免费观看| 日本sm残虐另类| 青娱乐精品视频| 日韩avvvv在线播放| 亚洲超丰满肉感bbw| 午夜精品福利久久久| 亚洲自拍偷拍欧美| 亚洲国产你懂的| 午夜精品久久久久久久99水蜜桃| 亚洲欧美一区二区久久| 亚洲天天做日日做天天谢日日欢| 欧美国产1区2区| 国产精品国产三级国产| 一色屋精品亚洲香蕉网站| 亚洲欧洲精品一区二区精品久久久 | 免费看欧美女人艹b| 奇米亚洲午夜久久精品| 美国毛片一区二区| 久久成人免费日本黄色| 久久99精品国产麻豆婷婷| 黄色资源网久久资源365| 国产在线视视频有精品| 国产精品69毛片高清亚洲| 成人免费av资源| av中文一区二区三区| 欧美专区在线观看一区| 欧美一区三区四区| 久久久久久久久久久黄色| 亚洲欧洲另类国产综合| 亚洲国产日日夜夜| 蜜桃久久av一区| 国产精品一区二区你懂的| 国产盗摄精品一区二区三区在线| 成年人网站91| 欧美怡红院视频| 精品久久久久av影院| 欧美国产视频在线| 亚洲成人一区二区| 国产在线看一区| 91玉足脚交白嫩脚丫在线播放| 欧美日韩中文字幕精品| 日韩美女在线视频| 中文字幕亚洲在| 日韩二区三区在线观看| 国产成人午夜精品5599| 欧美日韩一区在线观看| 精品国产免费人成在线观看| 中文字幕一区二区三区不卡在线| 天堂成人免费av电影一区| 国产剧情一区二区| 欧美色图12p| 国产日韩欧美精品一区| 亚洲丰满少妇videoshd| 国产成人精品一区二区三区四区| 色欧美88888久久久久久影院| 日韩美女在线视频| 亚洲精品一二三四区| 韩国欧美国产1区| 在线精品视频免费观看| 久久嫩草精品久久久久| 亚洲电影激情视频网站| 成人毛片老司机大片| 7777精品伊人久久久大香线蕉的| 国产精品美女久久久久aⅴ国产馆| 日韩中文字幕av电影| 91免费版在线| 国产无一区二区| 蜜臀av在线播放一区二区三区| 色丁香久综合在线久综合在线观看| 久久综合九色综合欧美就去吻| 一个色在线综合| 99久久99久久精品免费观看| 精品1区2区在线观看| 婷婷开心激情综合| 91美女片黄在线观看91美女| 久久久久久免费网| 久色婷婷小香蕉久久| 欧美精品 日韩| 亚洲精品国产视频| www.日韩在线| 久久精品视频免费| 国产在线精品一区在线观看麻豆| 在线播放中文一区| 亚洲综合色丁香婷婷六月图片| 不卡av免费在线观看| 精品处破学生在线二十三| 天堂成人国产精品一区| 欧美日韩国产影片| 一区二区三区欧美在线观看| 色综合久久六月婷婷中文字幕| 中文字幕精品一区| 国产精品白丝jk黑袜喷水| 久久一区二区三区国产精品| 美国av一区二区| 欧美xxxx在线观看| 国产在线播放一区| 久久精品在线免费观看| 国产麻豆视频精品| 国产欧美精品一区aⅴ影院|