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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? compactheapcanvas.java

?? 深入java 虛擬機(jī)中的一個(gè)Java程序
?? JAVA
字號(hào):
/*
* Copyright (c) 1996, 1997 Bill Venners. All Rights Reserved.
*
* This Java source file is part of the Interactive Illustrations Web
* Site, which is delivered in the applets directory of the CD-ROM
* that accompanies the book "Inside the Java Virtual Machine" by Bill
* Venners, published by McGraw-Hill, 1997,ISBN: 0-07-913248-0. This
* source file is provided for evaluation purposes only, but you can
* redistribute it under certain conditions, described in the full
* copyright notice below.
*
* Full Copyright Notice:
*
* All the web pages and Java applets delivered in the applets
* directory of the CD-ROM, consisting of ".html," ".gif," ".class,"
* and ".java" files, are copyrighted (c) 1996, 1997 by Bill
* Venners, and all rights are reserved.  This material may be copied
* and placed on any commercial or non-commercial web server on any
* network (including the internet) provided that the following
* guidelines are followed:
*
* a. All the web pages and Java Applets (".html," ".gif," ".class,"
* and ".java" files), including the source code, that are delivered
* in the applets directory of the CD-ROM that
* accompanies the book must be published together on the same web
* site.
*
* b. All the web pages and Java Applets (".html," ".gif," ".class,"
* and ".java" files) must be published "as is" and may not be altered
* in any way.
*
* c. All use and access to this web site must be free, and no fees
* can be charged to view these materials, unless express written
* permission is obtained from Bill Venners.
*
* d. The web pages and Java Applets may not be distributed on any
* media, other than a web server on a network, and may not accompany
* any book or publication.
*
* BILL VENNERS 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 PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  BILL VENNERS
* SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY A LICENSEE AS A
* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*/
import java.awt.*;

/**
* This class is the canvas on which is drawn the images
* of the object and handle pools on the compact heap
* canvas. All of this drawing is done by the paint()
* method of this class.
*
* @author  Bill Venners
*/
public class CompactHeapCanvas extends Canvas {

    private GCHeap gcHeap;
    private final int poolImageInsets = 5;

    CompactHeapCanvas(GCHeap heap) {
        gcHeap = heap;
    }

    public void paint(Graphics g) {

        // First calculate the positions of the goodies on the canvas based on the width
        // and height of the canvas.
        Dimension dim = size();

        // Divide width into three equal portions. The left portion will hold the handle pool.
        // The right portion will hold the object pool. The middle portion will have arrows
        // that go from valid handles to their respective objects.
        int xHandlePoolPortion = 0;
        int xArrowPortion = dim.width / 3;
        int xObjectPoolPortion = 2 * xArrowPortion;

        Font font = getFont();
        FontMetrics fm = getFontMetrics(font);

        int labelHeight = fm.getAscent() + fm.getDescent() + (2 * poolImageInsets);

        int heightAvailableForPools = dim.height - labelHeight - poolImageInsets;
        int objectPoolIntsCount = gcHeap.getObjectPoolSize();
        int handlePoolIntsCount = gcHeap.getHandlePoolSize() * 2;

        int maxIntsCount = objectPoolIntsCount;
        if (maxIntsCount < handlePoolIntsCount) {
            maxIntsCount = handlePoolIntsCount;
        }

        int yPixelsPerInt = heightAvailableForPools / maxIntsCount;

        int handlePoolHeight = handlePoolIntsCount * yPixelsPerInt;
        int objectPoolHeight = objectPoolIntsCount * yPixelsPerInt;

        int poolsWidth = xArrowPortion - poolImageInsets;

        int xTextStart = poolsWidth - fm.stringWidth(HeapOfFishStrings.handlePool);
        if (xTextStart < 0) {
            xTextStart = 0;
        }
        xTextStart /= 2;

        int yStart = (dim.height - handlePoolHeight - labelHeight - (2 * poolImageInsets)) / 2;
        if (yStart < 0) {
            yStart = 0;
        }
        g.setColor(Color.white);
        g.drawString(HeapOfFishStrings.handlePool, poolImageInsets + xTextStart, poolImageInsets + yStart + fm.getAscent());
        int yHandlePoolRect = yStart + labelHeight;
        g.fillRect(xHandlePoolPortion + poolImageInsets, yHandlePoolRect, poolsWidth, handlePoolHeight);

        xTextStart = poolsWidth - fm.stringWidth(HeapOfFishStrings.objectPool);
        if (xTextStart < 0) {
            xTextStart = 0;
        }
        xTextStart /= 2;

        yStart = (dim.height - objectPoolHeight - labelHeight - (2 * poolImageInsets)) / 2;
        if (yStart < 0) {
            yStart = 0;
        }

        //g.setColor(Color.white);
        g.drawString(HeapOfFishStrings.objectPool, xObjectPoolPortion + xTextStart, poolImageInsets + yStart + fm.getAscent());
        int yObjectPoolRect = yStart + labelHeight;
        //g.setColor(Color.white);
        g.fillRect(xObjectPoolPortion, yObjectPoolRect, poolsWidth, objectPoolHeight);

        // Draw the headers in the object pool
        g.setColor(Color.black);
        int i = 0;
        while (i < objectPoolIntsCount) {

            for (int j = 0; j < yPixelsPerInt; ++j) {
                int yLinePos = yObjectPoolRect + (i * yPixelsPerInt) + j;
                g.drawLine(xObjectPoolPortion, yLinePos, xObjectPoolPortion + poolsWidth - 1, yLinePos);
            }
            int header = gcHeap.getObjectPool(i);
            int length = gcHeap.getMemBlockLength(header);
            if (length <= 0) { // In case object pool gets corrupted, don't hang up.
                break;
            }
            i += length;
        }

        for (i = 0; i < gcHeap.getHandlePoolSize(); ++i) {
            ObjectHandle oh = gcHeap.getObjectHandle(i + 1);
            if (!oh.free) {

                Color color = Color.red;
                int objectSizeInInts = 3;
                if (oh.fish.getFishColor() == Color.cyan) {
                    color = Color.cyan;
                    objectSizeInInts = 2;
                }
                else if (oh.fish.getFishColor() == Color.yellow) {
                    color = Color.yellow;
                    objectSizeInInts = 1;
                }
                g.setColor(color);

                // Draw bar across handle pool
                for (int j = 0; j < yPixelsPerInt * 2; ++j) {
                    int yLinePos = yHandlePoolRect + (i * yPixelsPerInt * 2) + j;
                    g.drawLine(xHandlePoolPortion + poolImageInsets, yLinePos, xHandlePoolPortion + poolImageInsets + poolsWidth - 1, yLinePos);
                }

                // Draw colored bars to represent object in the object pool
                for (int j = 0; j < yPixelsPerInt * objectSizeInInts; ++j) {
                    int yLinePos = yObjectPoolRect + (oh.objectPos * yPixelsPerInt) + j;
                    g.drawLine(xObjectPoolPortion, yLinePos, xObjectPoolPortion + poolsWidth - 1, yLinePos);
                }

                // Draw a line from the handle to the object to show that the handle
                // points to the object.
                int yArrowStart = yHandlePoolRect + (i * yPixelsPerInt * 2) + yPixelsPerInt;
                int yArrowEnd = yObjectPoolRect + (oh.objectPos * yPixelsPerInt) + ((yPixelsPerInt * objectSizeInInts) / 2);
                g.drawLine(xHandlePoolPortion + poolImageInsets + poolsWidth + 2, yArrowStart,
                    xObjectPoolPortion - 3, yArrowEnd);
            }
        }
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品国产更新| 麻豆成人综合网| 亚洲精品一区二区三区在线观看| 91丨porny丨国产| 另类调教123区| 国产成人av电影免费在线观看| 国产视频一区在线观看| 欧美精品一级二级| 色综合天天综合在线视频| 蜜桃av噜噜一区二区三区小说| 亚洲欧美另类久久久精品| 久久九九久久九九| 日韩一区二区精品葵司在线 | 韩国毛片一区二区三区| 亚洲观看高清完整版在线观看| 国产精品久久久久久久浪潮网站 | 国产精品一区二区在线看| 日韩不卡一二三区| 亚洲福利一二三区| 亚洲少妇中出一区| 国产精品久久久久永久免费观看| 精品国产百合女同互慰| 91精品国产91热久久久做人人| 日本精品一区二区三区四区的功能| 国产99久久久久| 国产精品一品二品| 国产一区不卡视频| 久久福利视频一区二区| 蜜臂av日日欢夜夜爽一区| 日韩和的一区二区| 日一区二区三区| 日本va欧美va精品| 日本不卡的三区四区五区| 日韩精品一级中文字幕精品视频免费观看 | 欧美高清视频一二三区| 欧美日韩国产经典色站一区二区三区 | 精品一区二区三区香蕉蜜桃| 青青草成人在线观看| 麻豆精品一二三| 九九**精品视频免费播放| 老汉av免费一区二区三区| 免费观看在线色综合| 美女在线视频一区| 国内国产精品久久| 国产激情一区二区三区四区| 国产suv精品一区二区三区| 国产成人综合网| av资源网一区| 色噜噜夜夜夜综合网| 欧美日韩一区国产| 日韩一二三区视频| 久久综合网色—综合色88| 国产视频亚洲色图| 亚洲视频一二三区| 亚洲国产精品自拍| 久久国内精品视频| 国产91精品欧美| 色综合久久66| 日韩三级高清在线| 日本一区二区动态图| 亚洲欧美经典视频| 看片网站欧美日韩| 久久久久国产免费免费| 日韩三级免费观看| 中文欧美字幕免费| 亚洲成人三级小说| 国产一区二区导航在线播放| 97精品视频在线观看自产线路二| 欧美性猛片aaaaaaa做受| 91精品国产入口在线| 国产亚洲综合色| 亚洲精品欧美综合四区| 免费一级欧美片在线观看| 成人免费视频视频在线观看免费| 在线视频中文字幕一区二区| 精品奇米国产一区二区三区| 最新国产精品久久精品| 日韩和欧美一区二区| 成人午夜视频免费看| 欧美男女性生活在线直播观看| xnxx国产精品| 亚洲一卡二卡三卡四卡| 国产成人在线影院| 欧美美女网站色| 国产精品欧美一区喷水| 日韩高清一级片| 91在线国产福利| 精品国产不卡一区二区三区| 夜夜嗨av一区二区三区中文字幕| 九九国产精品视频| 欧美色综合网站| 国产精品卡一卡二卡三| 久久精品久久综合| 日本精品免费观看高清观看| 久久久久久久久蜜桃| 亚洲成av人片在线观看无码| 波多野结衣精品在线| 日韩限制级电影在线观看| 一区二区三区高清在线| 国产乱妇无码大片在线观看| 欧美日韩成人在线| 亚洲欧美国产77777| 国产福利91精品| 欧美成人vr18sexvr| 五月婷婷激情综合网| 91色乱码一区二区三区| 中文字幕高清一区| 玖玖九九国产精品| 欧美电影一区二区| 亚洲大片在线观看| 色8久久精品久久久久久蜜| 国产精品污网站| 国内精品第一页| 亚洲精品一区二区三区福利 | 亚洲va天堂va国产va久| 91蜜桃免费观看视频| 亚洲国产高清aⅴ视频| 狠狠色丁香久久婷婷综合丁香| 正在播放亚洲一区| 亚洲国产精品久久不卡毛片 | 日韩一级免费观看| 视频一区二区中文字幕| 欧美亚洲国产bt| 亚洲大片一区二区三区| 欧美性大战久久久| 亚洲一区成人在线| 欧美日韩一二三| 五月婷婷欧美视频| 91精品午夜视频| 蜜桃视频在线一区| 精品国产三级a在线观看| 久久精品免费观看| 久久综合狠狠综合| 国产91清纯白嫩初高中在线观看| 久久久久久久久久久久久女国产乱| 精品伊人久久久久7777人| 精品国产亚洲在线| 亚洲欧美另类久久久精品| 亚洲成av人片在线| 欧美高清视频一二三区 | 强制捆绑调教一区二区| 91精品国产色综合久久| 麻豆91在线看| 久久精品亚洲乱码伦伦中文 | 91美女在线观看| 一区二区久久久| 欧美日韩国产区一| 久久精品国产99| 国产欧美日韩精品a在线观看| 国产精品18久久久久久vr| 国产日韩欧美a| 色综合激情久久| 免费人成网站在线观看欧美高清| 欧美岛国在线观看| 成人精品国产福利| 亚洲精品国产第一综合99久久| 欧美日韩精品综合在线| 捆绑紧缚一区二区三区视频| 国产欧美日本一区二区三区| 91社区在线播放| 无吗不卡中文字幕| 久久精品亚洲精品国产欧美kt∨ | 亚洲女与黑人做爰| 欧美日韩国产一区| 狠狠狠色丁香婷婷综合激情| 国产精品看片你懂得| 欧美片网站yy| 国产成人av电影在线播放| 一区二区成人在线视频| 日韩欧美成人一区二区| 成人黄色一级视频| 日韩av一级片| 国产精品成人免费精品自在线观看 | 国内精品国产成人| 亚洲精品va在线观看| 欧美不卡在线视频| 在线免费亚洲电影| 国产成人亚洲综合a∨婷婷图片| 一区二区三区欧美视频| 亚洲精品在线免费观看视频| 91啪亚洲精品| 国产一区二区三区免费播放| 一区二区免费在线| 国产日韩av一区二区| 欧美日韩精品一区视频| 成人精品视频一区二区三区| 日韩电影在线一区二区三区| 国产精品萝li| 日韩一级欧美一级| 欧美午夜精品一区二区三区| 国产福利不卡视频| 免费观看一级特黄欧美大片| 亚洲柠檬福利资源导航| 国产偷国产偷精品高清尤物| 69成人精品免费视频| 91网站最新网址| 国产麻豆精品一区二区| 日韩成人免费在线| 一区二区三区在线观看国产| 国产日韩欧美不卡|