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

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

?? longtree.java

?? struts spring ibatis
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/** * $RCSfile: LongTree.java,v $ * $Revision: 1.6 $ * $Date: 2003/03/03 21:33:45 $ * * Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved. * * This software is the proprietary information of CoolServlets, Inc. * Use is subject to license terms. */package com.struts2.framework.util;import java.io.Externalizable;import java.io.ObjectOutput;import java.io.IOException;import java.io.ObjectInput;/** * A simple tree structure for long values. It's nowhere near a complete tree * implementation since we don't really need one. However, if anyone is * interested in finishing this class, or optimizing it, that would be * appreciated.<p> * * The tree uses three arrays to keep the tree structure. It works as in the * following example: * * <pre> *   1 *   |-- 3 *   |-- |--4 *   |-- |--6 *   |-- 5 * * array index:   0 | 1 | 2 | 3 | 4 * * key:           1 | 3 | 4 | 5 | 6 * leftChild:     1 | 2 |-1 |-1 |-1 * rightChild    -1 | 3 | 4 |-1 |-1 * </pre> * * Where the key array holds key values, and the leftChild and rightChild arrays * are pointers to other array indices.<p> * * The tree holds a maximum of 65534 nodes. It is not intended to be thread-safe. * Based on algorithm found in the book "Introduction To Algorithms" by Cormen * et all, MIT Press, 1997. * * @author Matt Tucker */public final class LongTree implements Cacheable, Externalizable {    long [] keys;    //char arrays let us address get about 65K nodes.    char [] leftChildren;    char [] rightSiblings;    // Pointer to next available slot.    char nextIndex = 2;    /**     * Creates a new tree.     *     * @param rootKey the value of the root node of the tree.     * @param initialCapacity the maximum initial capacity of the tree.     */    public LongTree(long rootKey, int initialCapacity) {        keys = new long[initialCapacity+1];        leftChildren = new char[initialCapacity+1];        rightSiblings = new char[initialCapacity+1];        // New tree, so set the fields to null at root.        keys[1] = rootKey;        leftChildren[1] = 0;        rightSiblings[1] = 0;    }    /**     * Constructor for use with the Externalizable interface. Normal users     * of this class <b>should not</b> call this constructor.     */    public LongTree() {        // do nothing    }    /**     * Adds a child to the tree.     *     * @param parentKey the parent to add the new value to.     * @param newKey new value to add to the tree.     */    public void addChild(long parentKey, long newKey) {        // Find record for parent        char parentIndex = findKey(parentKey, (char)1);        if (parentIndex == 0) {            throw new IllegalArgumentException("Parent key " + parentKey +                    " not found when adding child " + newKey + ".");        }        // Expand the arrays if we've run out of room.        if (nextIndex == keys.length) {            // Can't grow above 2^16 elements.            if (keys.length == 65536) {                throw new IllegalStateException("Tree has exceeded max size and cannot grow!");            }            int oldSize = keys.length;            // Reserve room for new elements.            int newSize = (int)Math.ceil(oldSize * 1.5);            // Max size is 2^16 since the child arrrays use chars.            if (newSize > 65536) {                newSize = 65536;            }            // Grow keys array.            long [] newKeys = new long[newSize];            System.arraycopy(keys, 0, newKeys, 0, oldSize);            keys = newKeys;            // Grow left children array.            char [] newLeftChildren = new char[newSize];            System.arraycopy(leftChildren, 0, newLeftChildren, 0, oldSize);            leftChildren = newLeftChildren;            // Grow right children array.            char [] newRightSiblings = new char[newSize];            System.arraycopy(rightSiblings, 0, newRightSiblings, 0, oldSize);            rightSiblings = newRightSiblings;        }        // Create record for new key.        keys[nextIndex] = newKey;        leftChildren[nextIndex] = 0;        rightSiblings[nextIndex] = 0;        // Adjust references. Check to see if the parent has any children.        if (leftChildren[parentIndex] == 0) {            // No children, therefore make the new key the first child.            leftChildren[parentIndex] = nextIndex;        }        else {            // The parent has children, so find the right-most child.            long siblingIndex = leftChildren[parentIndex];            while (rightSiblings[new Long(siblingIndex).intValue()] != 0) {                siblingIndex = rightSiblings[new Long(siblingIndex).intValue()];            }            // Add the new entry as a sibling of that last child.            rightSiblings[new Long(siblingIndex).intValue()] = nextIndex;        }        // Finally, increment nextIndex so it's ready for next add.        nextIndex++;    }    /**     * Returns a parent of <code>childKey</code>.     */    public long getParent(long childKey) {        // If the root key was passed in, return -1;        if (keys[1] == childKey) {            return -1;        }        // Otherwise, perform a search to find the parent.        char childIndex = findKey(childKey, (char)1);        if (childIndex == 0) {            return -1;        }        // Adjust the childIndex pointer until we find the left most sibling of        // childKey.        char leftSiblingIndex = getLeftSiblingIndex(childIndex);        while (leftSiblingIndex != 0) {            childIndex = leftSiblingIndex;            leftSiblingIndex = getLeftSiblingIndex(childIndex);        }        // Now, search the leftChildren array until we find the parent of        // childIndex. First, search backwards from childIndex.        for(int i=childIndex-1; i>=0; i--) {            if (leftChildren[i] == childIndex) {                return keys[i];            }        }        // Now, search forward from childIndex.        for(int i=childIndex+1; i<=leftChildren.length; i++) {            if (leftChildren[i] == childIndex) {                return keys[i];            }        }        // We didn't find the parent, so giving up. This shouldn't happen.        return -1;    }    /**     * Returns a child of <code>parentKey</code> at index <code>index</code>.     */    public long getChild(long parentKey, int index) {        char parentIndex = findKey(parentKey, (char)1);        if (parentIndex == 0) {            return -1;        }        char siblingIndex = leftChildren[parentIndex];        if (siblingIndex == -1) {            return -1;        }        int i = index;        while (i > 0) {            siblingIndex = rightSiblings[siblingIndex];            if (siblingIndex == 0) {                return -1;            }            i--;        }        return keys[siblingIndex];    }    /**     * Returns the number of children of <code>parentKey</code>.     */    public int getChildCount(long parentKey) {        int count = 0;        char parentIndex = findKey(parentKey, (char)1);        if (parentIndex == 0) {            return 0;        }        char siblingIndex = leftChildren[parentIndex];        while (siblingIndex != 0) {            count++;            siblingIndex = rightSiblings[siblingIndex];        }        return count;    }    /**     * Returns an array of the children of the parentKey, or an empty array     * if there are no children or the parent key is not in the tree.     *     * @param parentKey the parent to get the children of.     * @return the children of parentKey     */    public long [] getChildren(long parentKey) {        int childCount = getChildCount(parentKey);        if (childCount == 0) {            return new long [0];        }        long [] children = new long[childCount];        int i = 0;        char parentIndex = findKey(parentKey, (char)1);        char siblingIndex = leftChildren[parentIndex];        while (siblingIndex != 0) {            children[i] = keys[siblingIndex];            i++;            siblingIndex = rightSiblings[siblingIndex];        }        return children;    }    /**     * Returns the index of <code>childKey</code> in <code>parentKey</code> or     * -1 if <code>childKey</code> is not a child of <code>parentKey</code>.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品一区二区三区四区| 亚洲一区在线观看免费观看电影高清| 日本女优在线视频一区二区| 91高清视频免费看| 国产三级精品三级| 国产精品一二三四区| 在线视频你懂得一区二区三区| 亚洲国产精华液网站w| 国产精品一色哟哟哟| 亚洲国产成人一区二区三区| 国产成人8x视频一区二区| 中文字幕乱码亚洲精品一区| 国产成人免费在线观看不卡| 久久精品在线免费观看| 国产高清亚洲一区| 中文一区二区完整视频在线观看| 成人午夜私人影院| 亚洲免费看黄网站| 欧美午夜一区二区| 视频一区二区国产| 精品蜜桃在线看| 国产+成+人+亚洲欧洲自线| 国产精品美女久久福利网站| 国产成人精品免费在线| 一区精品在线播放| 欧美伊人久久大香线蕉综合69| 日本在线不卡视频一二三区| 久久久久国色av免费看影院| 91亚洲精品乱码久久久久久蜜桃 | 欧美精品一区在线观看| 国产在线一区二区| 一区在线观看免费| 777欧美精品| 国产最新精品精品你懂的| 国产精品免费观看视频| 91福利在线看| 精品一区二区三区在线观看 | 欧美成人伊人久久综合网| 国产麻豆9l精品三级站| 国产目拍亚洲精品99久久精品| 色综合天天做天天爱| 亚洲精品免费视频| 精品日韩在线一区| 91网址在线看| 日本亚洲最大的色成网站www| 久久亚洲精品小早川怜子| 91国产福利在线| 国产美女精品在线| 亚洲国产va精品久久久不卡综合| 久久先锋影音av鲁色资源| 日本国产一区二区| 国产精品白丝av| 午夜久久久影院| 国产精品美女久久久久aⅴ| 91精品国产免费| 91免费看`日韩一区二区| 美女任你摸久久| 亚洲无线码一区二区三区| 日本一区二区免费在线| 51午夜精品国产| 一本到三区不卡视频| 国产很黄免费观看久久| 亚洲va天堂va国产va久| 国产精品伦一区| 精品嫩草影院久久| 精品视频一区 二区 三区| 成人毛片老司机大片| 激情综合网天天干| 午夜精品影院在线观看| 国产亚洲精品7777| 日韩欧美国产三级| 欧美午夜影院一区| 94-欧美-setu| 白白色 亚洲乱淫| 国产成人激情av| 久久国产免费看| 美日韩一区二区| 日韩国产欧美在线播放| 亚洲国产精品麻豆| 亚洲视频网在线直播| 欧美高清在线一区| 国产欧美精品一区二区色综合| 欧美韩日一区二区三区| 亚洲欧美在线高清| 一区二区三区日韩精品视频| 亚洲一区二区三区中文字幕| 日韩在线a电影| 韩国精品久久久| 粉嫩在线一区二区三区视频| av动漫一区二区| 欧洲精品一区二区| 日韩免费一区二区| 国产亚洲自拍一区| 亚洲欧美视频在线观看| 视频一区欧美精品| 国产专区欧美精品| 色综合久久久久综合体桃花网| 欧美三级韩国三级日本一级| 日韩一区二区三区电影在线观看| ww久久中文字幕| 最好看的中文字幕久久| 亚洲午夜精品久久久久久久久| 日韩高清不卡一区二区三区| 国产福利不卡视频| 日本高清不卡在线观看| 日韩精品中文字幕一区| 国产精品免费av| 亚洲影院久久精品| 极品尤物av久久免费看| 91黄色激情网站| 精品久久久久99| 亚洲欧美日韩久久| 久久国产人妖系列| 91福利精品第一导航| 日韩三级电影网址| 国产精品久久777777| 视频一区视频二区中文字幕| 夫妻av一区二区| 日韩一区二区三区电影在线观看| 国产精品久久久久久久浪潮网站| 舔着乳尖日韩一区| 国产凹凸在线观看一区二区| 欧美日韩三级在线| 日本一二三四高清不卡| 天天亚洲美女在线视频| 成人影视亚洲图片在线| 欧美一三区三区四区免费在线看| 中文字幕视频一区二区三区久| 日韩成人免费电影| 日本乱人伦一区| 久久精品欧美一区二区三区麻豆| 午夜免费久久看| 91偷拍与自偷拍精品| 精品国产百合女同互慰| 亚洲成av人影院在线观看网| 在线观看91av| 国产日韩亚洲欧美综合| 蜜臀精品一区二区三区在线观看| 99国产精品国产精品毛片| 久久久久久亚洲综合影院红桃 | 欧美一区二区三区视频免费| 国产精品久久久久永久免费观看| 精品无码三级在线观看视频| 欧美电影影音先锋| 亚洲成人精品一区二区| 成人国产在线观看| 国产亚洲欧美一级| 久国产精品韩国三级视频| 91精品国产麻豆国产自产在线| 亚洲综合图片区| 色偷偷一区二区三区| 国产精品高潮呻吟| 国产传媒日韩欧美成人| 精品国产乱码久久久久久久| 日韩黄色免费电影| 欧美日本韩国一区| 依依成人综合视频| 色天使色偷偷av一区二区| 亚洲天堂免费看| 色综合中文字幕国产| 国产精品欧美久久久久一区二区| 九一九一国产精品| 久久综合久色欧美综合狠狠| 久久99最新地址| 亚洲精品一区二区三区精华液| 免费观看91视频大全| 日韩欧美中文一区| 久久不见久久见免费视频7| 日韩一级完整毛片| 久久国产麻豆精品| 精品盗摄一区二区三区| 国产麻豆精品在线| 久久久久久久一区| 国产电影精品久久禁18| 国产欧美日韩精品a在线观看| 成人激情小说乱人伦| 亚洲欧洲性图库| 欧美亚洲禁片免费| 婷婷开心激情综合| 日韩精品资源二区在线| 国产精品69久久久久水密桃| 中文字幕一区二区三| 色婷婷久久久亚洲一区二区三区 | 亚洲色图视频网| 99久久国产综合精品麻豆 | 丝瓜av网站精品一区二区| 91 com成人网| 国产精品一二三区在线| 日韩码欧中文字| 欧美日韩三级在线| 精品一区二区三区影院在线午夜 | 国产亚洲精品精华液| 99re视频精品| 日韩精品成人一区二区三区| 日韩欧美的一区二区| 成人av综合一区| 亚洲成人第一页| 日本一区免费视频| 欧美亚洲国产怡红院影院| 美腿丝袜在线亚洲一区|