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

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

?? treemap.java

?? This is a resource based on j2me embedded,if you dont understand,you can connection with me .
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
     * algorithms.     */    private static boolean colorOf(Entry p) {        return (p == null ? BLACK : p.color);    }    private static Entry  parentOf(Entry p) {         return (p == null ? null: p.parent);    }    private static void setColor(Entry p, boolean c) {         if (p != null)  p.color = c;     }    private static Entry  leftOf(Entry p) {         return (p == null)? null: p.left;     }    private static Entry  rightOf(Entry p) {         return (p == null)? null: p.right;     }    /** From CLR **/    private void rotateLeft(Entry p) {        Entry r = p.right;        p.right = r.left;        if (r.left != null)            r.left.parent = p;        r.parent = p.parent;        if (p.parent == null)            root = r;        else if (p.parent.left == p)            p.parent.left = r;        else            p.parent.right = r;        r.left = p;        p.parent = r;    }    /** From CLR **/    private void rotateRight(Entry p) {        Entry l = p.left;        p.left = l.right;        if (l.right != null) l.right.parent = p;        l.parent = p.parent;        if (p.parent == null)            root = l;        else if (p.parent.right == p)            p.parent.right = l;        else p.parent.left = l;        l.right = p;        p.parent = l;    }    /** From CLR **/    private void fixAfterInsertion(Entry x) {        x.color = RED;        while (x != null && x != root && x.parent.color == RED) {            if (parentOf(x) == leftOf(parentOf(parentOf(x)))) {                Entry y = rightOf(parentOf(parentOf(x)));                if (colorOf(y) == RED) {                    setColor(parentOf(x), BLACK);                    setColor(y, BLACK);                    setColor(parentOf(parentOf(x)), RED);                    x = parentOf(parentOf(x));                } else {                    if (x == rightOf(parentOf(x))) {                        x = parentOf(x);                        rotateLeft(x);                    }                    setColor(parentOf(x), BLACK);                    setColor(parentOf(parentOf(x)), RED);                    if (parentOf(parentOf(x)) != null)                         rotateRight(parentOf(parentOf(x)));                }            } else {                Entry y = leftOf(parentOf(parentOf(x)));                if (colorOf(y) == RED) {                    setColor(parentOf(x), BLACK);                    setColor(y, BLACK);                    setColor(parentOf(parentOf(x)), RED);                    x = parentOf(parentOf(x));                } else {                    if (x == leftOf(parentOf(x))) {                        x = parentOf(x);                        rotateRight(x);                    }                    setColor(parentOf(x),  BLACK);                    setColor(parentOf(parentOf(x)), RED);                    if (parentOf(parentOf(x)) != null)                         rotateLeft(parentOf(parentOf(x)));                }            }        }        root.color = BLACK;    }    /**     * Delete node p, and then rebalance the tree.     */    private void deleteEntry(Entry p) {        decrementSize();        // If strictly internal, copy successor's element to p and then make p        // point to successor.        if (p.left != null && p.right != null) {            Entry s = successor (p);            p.key = s.key;                   p.value = s.value;              p = s;        } // p has 2 children        // Start fixup at replacement node, if it exists.        Entry replacement = (p.left != null ? p.left : p.right);        if (replacement != null) {            // Link replacement to parent            replacement.parent = p.parent;            if (p.parent == null)                root = replacement;            else if (p == p.parent.left)                p.parent.left  = replacement;            else                p.parent.right = replacement;            // Null out links so they are OK to use by fixAfterDeletion.            p.left = p.right = p.parent = null;            // Fix replacement            if (p.color == BLACK)                fixAfterDeletion(replacement);        } else if (p.parent == null) { // return if we are the only node.            root = null;        } else { //  No children. Use self as phantom replacement and unlink.            if (p.color == BLACK)                fixAfterDeletion(p);            if (p.parent != null) {                if (p == p.parent.left)                    p.parent.left = null;                else if (p == p.parent.right)                    p.parent.right = null;                p.parent = null;            }        }    }    /** From CLR **/    private void fixAfterDeletion(Entry x) {        while (x != root && colorOf(x) == BLACK) {            if (x == leftOf(parentOf(x))) {                Entry sib = rightOf(parentOf(x));                if (colorOf(sib) == RED) {                    setColor(sib, BLACK);                    setColor(parentOf(x), RED);                    rotateLeft(parentOf(x));                    sib = rightOf(parentOf(x));                }                if (colorOf(leftOf(sib))  == BLACK &&                     colorOf(rightOf(sib)) == BLACK) {                    setColor(sib,  RED);                    x = parentOf(x);                } else {                    if (colorOf(rightOf(sib)) == BLACK) {                        setColor(leftOf(sib), BLACK);                        setColor(sib, RED);                        rotateRight(sib);                        sib = rightOf(parentOf(x));                    }                    setColor(sib, colorOf(parentOf(x)));                    setColor(parentOf(x), BLACK);                    setColor(rightOf(sib), BLACK);                    rotateLeft(parentOf(x));                    x = root;                }            } else { // symmetric                Entry sib = leftOf(parentOf(x));                if (colorOf(sib) == RED) {                    setColor(sib, BLACK);                    setColor(parentOf(x), RED);                    rotateRight(parentOf(x));                    sib = leftOf(parentOf(x));                }                if (colorOf(rightOf(sib)) == BLACK &&                     colorOf(leftOf(sib)) == BLACK) {                    setColor(sib,  RED);                    x = parentOf(x);                } else {                    if (colorOf(leftOf(sib)) == BLACK) {                        setColor(rightOf(sib), BLACK);                        setColor(sib, RED);                        rotateLeft(sib);                        sib = leftOf(parentOf(x));                    }                    setColor(sib, colorOf(parentOf(x)));                    setColor(parentOf(x), BLACK);                    setColor(leftOf(sib), BLACK);                    rotateRight(parentOf(x));                    x = root;                }            }        }        setColor(x, BLACK);     }    private static final long serialVersionUID = 919286545866124006L;    /**     * Save the state of the <tt>TreeMap</tt> instance to a stream (i.e.,     * serialize it).     *     * @serialData The <i>size</i> of the TreeMap (the number of key-value     *             mappings) is emitted (int), followed by the key (Object)     *             and value (Object) for each key-value mapping represented     *             by the TreeMap. The key-value mappings are emitted in     *             key-order (as determined by the TreeMap's Comparator,     *             or by the keys' natural ordering if the TreeMap has no     *             Comparator).     */    private void writeObject(java.io.ObjectOutputStream s)        throws java.io.IOException {        // Write out the Comparator and any hidden stuff        s.defaultWriteObject();        // Write out size (number of Mappings)        s.writeInt(size);        // Write out keys and values (alternating)        for (Iterator i = entrySet().iterator(); i.hasNext(); ) {            Entry e = (Entry)i.next();            s.writeObject(e.key);            s.writeObject(e.value);        }    }    /**     * Reconstitute the <tt>TreeMap</tt> instance from a stream (i.e.,     * deserialize it).     */    private void readObject(final java.io.ObjectInputStream s)        throws java.io.IOException, ClassNotFoundException {        // Read in the Comparator and any hidden stuff        s.defaultReadObject();        // Read in size        int size = s.readInt();        buildFromSorted(size, null, s, null);    }    /** Intended to be called only from TreeSet.readObject **/    void readTreeSet(int size, java.io.ObjectInputStream s, Object defaultVal)        throws java.io.IOException, ClassNotFoundException {        buildFromSorted(size, null, s, defaultVal);    }    /** Intended to be called only from TreeSet.addAll **/    void addAllForTreeSet(SortedSet set, Object defaultVal) {      try {          buildFromSorted(set.size(), set.iterator(), null, defaultVal);      } catch (java.io.IOException cannotHappen) {      } catch (ClassNotFoundException cannotHappen) {      }    }    /**     * Linear time tree building algorithm from sorted data.  Can accept keys     * and/or values from iterator or stream. This leads to too many     * parameters, but seems better than alternatives.  The four formats     * that this method accepts are:     *     *    1) An iterator of Map.Entries.  (it != null, defaultVal == null).     *    2) An iterator of keys.         (it != null, defaultVal != null).     *    3) A stream of alternating serialized keys and values.     *                                   (it == null, defaultVal == null).     *    4) A stream of serialized keys. (it == null, defaultVal != null).     *     * It is assumed that the comparator of the TreeMap is already set prior     * to calling this method.     *     * @param size the number of keys (or key-value pairs) to be read from     *        the iterator or stream.     * @param it If non-null, new entries are created from entries     *        or keys read from this iterator.     * @param it If non-null, new entries are created from keys and     *        possibly values read from this stream in serialized form.     *        Exactly one of it and str should be non-null.     * @param defaultVal if non-null, this default value is used for     *        each value in the map.  If null, each value is read from     *        iterator or stream, as described above.     * @throws IOException propagated from stream reads. This cannot     *         occur if str is null.     * @throws ClassNotFoundException propagated from readObject.      *         This cannot occur if str is null.     */    private void buildFromSorted(int size, Iterator it,                                  java.io.ObjectInputStream str,                                  Object defaultVal)        throws  java.io.IOException, ClassNotFoundException {        this.size = size;        root = buildFromSorted(0, 0, size-1, computeRedLevel(size),                               it, str, defaultVal);    }    /**     * Recursive "helper method" that does the real work of the     * of the previous method.  Identically named parameters have     * identical definitions.  Additional parameters are documented below.     * It is assumed that the comparator and size fields of the TreeMap are     * already set prior to calling this method.  (It ignores both fields.)     *     * @param level the current level of tree. Initial call should be 0.     * @param lo the first element index of this subtree. Initial should be 0.     * @param hi the last element index of this subtree.  Initial should be     *              size-1.     * @param redLevel the level at which nodes should be red.      *        Must be equal to computeRedLevel for tree of this size.     */    private static Entry buildFromSorted(int level, int lo, int hi,                                         int redLevel,                                         Iterator it,                                          java.io.ObjectInputStream str,                                         Object defaultVal)         throws  java.io.IOException, ClassNotFoundException {        /*         * Strategy: The root is the middlemost element. To get to it, we         * have to first recursively construct the entire left subtree,         * so as to grab all of its elements. We can then proceed with right         * subtree.          *         * The lo and hi arguments are the minimum and maximum         * indices to pull out of the iterator or stream for current subtree.         * They are not actually indexed, we just proceed sequentially,         * ensuring that items are extracted in corresponding order.         */        if (hi < lo) return null;        int mid = (lo + hi) / 2;                Entry left  = null;        if (lo < mid)             left = buildFromSorted(level+1, lo, mid - 1, redLevel,                                   it, str, defaultVal);                // extract key and/or value from iterator or stream        Object key;        Object value;        if (it != null) { // use iterator            if (defaultVal==null) {                Map.Entry entry = (Map.Entry) it.next();                key = entry.getKey();                value = entry.getValue();            } else {                key = it.next();                value = defaultVal;            }        } else { // use stream            key = str.readObject();            value = (defaultVal != null ? defaultVal : str.readObject());        }        Entry middle =  new Entry(key, value, null);                // color nodes in non-full bottommost level red        if (level == redLevel)            middle.color = RED;                if (left != null) {             middle.left = left;             left.parent = middle;         }                if (mid < hi) {            Entry right = buildFromSorted(level+1, mid+1, hi, redLevel,                                          it, str, defaultVal);            middle.right = right;            right.parent = middle;        }                return middle;    }    /**     * Find the level down to which to assign all nodes BLACK.  This is the     * last `full' level of the complete binary tree produced by     * buildTree. The remaining nodes are colored RED. (This makes a `nice'     * set of color assignments wrt future insertions.) This level number is     * computed by finding the number of splits needed to reach the zeroeth     * node.  (The answer is ~lg(N), but in any case must be computed by same     * quick O(lg(N)) loop.)     */    private static int computeRedLevel(int sz) {        int level = 0;        for (int m = sz - 1; m >= 0; m = m / 2 - 1)             level++;        return level;    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美日韩中文久久| 99精品视频在线播放观看| 麻豆精品在线播放| 成人激情电影免费在线观看| 欧美综合天天夜夜久久| 精品久久人人做人人爰| 一区二区三区久久久| 国产美女精品人人做人人爽| 欧美中文字幕不卡| 91丨porny丨蝌蚪视频| 99精品视频在线播放观看| 欧美日韩电影在线| 国产午夜精品一区二区| 国产成人av电影| 在线观看日产精品| 国产午夜亚洲精品午夜鲁丝片| 亚洲综合在线免费观看| 国产成人亚洲精品青草天美| 欧美日韩国产精品成人| 日韩一区欧美小说| 国产伦精品一区二区三区免费 | 国产精品美女久久久久久| 日韩高清欧美激情| 欧美中文字幕一区| 中文字幕在线不卡视频| 国产麻豆精品视频| 精品99一区二区三区| 爽爽淫人综合网网站| 91日韩一区二区三区| 国产精品乱码一区二区三区软件| 麻豆精品一区二区综合av| 欧美日韩中字一区| 亚洲一区二区三区国产| 91网页版在线| 亚洲人123区| 99视频精品在线| 国产欧美精品一区二区色综合 | 国产亚洲精品资源在线26u| 日本免费新一区视频| 欧美日韩成人在线| 香蕉加勒比综合久久| 欧美三级视频在线观看| 亚洲bdsm女犯bdsm网站| 在线播放视频一区| 青青草成人在线观看| 777午夜精品视频在线播放| 亚洲韩国一区二区三区| 欧美日韩国产精品自在自线| 婷婷一区二区三区| 欧美一区二区三区在线看| 免费在线成人网| 日韩免费在线观看| 国产精品一二三区| 国产精品国产三级国产| 91免费视频网| 丝袜美腿一区二区三区| 日韩一区和二区| 精品中文字幕一区二区小辣椒| 2021中文字幕一区亚洲| 国产一区二区精品久久99| 中文字幕一区三区| 在线观看国产日韩| 日本最新不卡在线| 国产日韩欧美麻豆| 色婷婷综合久久久| 美女免费视频一区二区| 国产色产综合产在线视频| 99久久精品国产麻豆演员表| 亚洲一区二区视频| 精品免费国产二区三区| 成人av午夜电影| 亚洲国产aⅴ天堂久久| 精品sm在线观看| 99久久久久久99| 日本在线观看不卡视频| 国产丝袜美腿一区二区三区| 色综合久久88色综合天天免费| 日韩黄色免费电影| 中文字幕av不卡| 欧美老肥妇做.爰bbww| 国产一区二区三区在线观看免费| 亚洲欧洲精品一区二区三区| 91精品国产乱码久久蜜臀| 国产成人免费xxxxxxxx| 亚洲国产日韩一区二区| 久久久久久97三级| 欧美伊人精品成人久久综合97| 精品一区二区三区视频在线观看| 最新国产成人在线观看| 日韩欧美电影在线| 欧美综合一区二区| 国产精品亚洲人在线观看| 亚欧色一区w666天堂| 中文子幕无线码一区tr| 日韩欧美在线综合网| 色一情一乱一乱一91av| 国产精品88av| 日本免费新一区视频| 亚洲精品国产一区二区三区四区在线| 日韩欧美你懂的| 欧美色偷偷大香| 99精品1区2区| 东方欧美亚洲色图在线| 精品一区二区三区视频在线观看 | 韩国av一区二区三区四区| 亚洲精品成人在线| 亚洲国产成人午夜在线一区| 欧美第一区第二区| 欧美日韩免费一区二区三区视频| 成人av网站在线观看免费| 国产一区二区h| 青娱乐精品视频| 日日夜夜一区二区| 亚洲一本大道在线| 一区二区免费在线播放| 日韩美女视频一区| 综合精品久久久| 国产精品毛片大码女人| 久久久国产午夜精品| 亚洲精品一区二区精华| 欧美大片日本大片免费观看| 日韩一区二区三区四区| 欧美一区二区三区四区五区| 欧美女孩性生活视频| 欧美日韩日本视频| 欧美一区二区免费视频| 欧美精品视频www在线观看| 欧美色国产精品| 制服丝袜在线91| 日韩精品一区二区三区三区免费| 91麻豆精品91久久久久久清纯| 在线播放91灌醉迷j高跟美女| 欧美日韩色一区| 欧美一级免费观看| 日韩免费高清电影| 久久久久久久久伊人| 国产亚洲欧美日韩在线一区| 欧美国产精品一区二区| 国产精品国产成人国产三级 | 亚洲美女精品一区| 一区二区高清在线| 偷拍一区二区三区四区| 免费视频一区二区| 国产乱妇无码大片在线观看| 成人精品视频一区二区三区 | 97精品超碰一区二区三区| 91偷拍与自偷拍精品| 在线亚洲免费视频| 7777精品伊人久久久大香线蕉最新版| 欧美精品日韩综合在线| 69p69国产精品| 国产日韩欧美在线一区| 亚洲欧洲制服丝袜| 日韩电影免费在线| 国产成人aaa| 欧美亚洲另类激情小说| 日韩一区二区三区四区五区六区| 久久久天堂av| 一二三四社区欧美黄| 久久精品国产999大香线蕉| 成人免费看视频| 欧美精品丝袜中出| 国产精品人人做人人爽人人添| 亚洲在线成人精品| 激情小说欧美图片| 欧美亚洲一区三区| 中文字幕乱码日本亚洲一区二区| 一区二区三区在线视频观看 | 亚洲一区二区三区小说| 久久99在线观看| 色综合天天综合| 日韩欧美国产小视频| 亚洲欧美色图小说| 黄页视频在线91| 欧美综合欧美视频| 国产欧美中文在线| 日韩精品亚洲专区| 97久久人人超碰| 久久综合久久综合亚洲| 亚洲国产日韩综合久久精品| 国产成人av电影| 欧美一区二区三区在| 亚洲精品国产a| 欧美在线|欧美| 另类小说欧美激情| 99视频国产精品| 日韩三级视频在线观看| 亚洲色图19p| 国产传媒一区在线| 欧美一区二区三区视频在线 | 中国av一区二区三区| 日本三级亚洲精品| 色哟哟精品一区| 国产精品久久久久久久第一福利| 久久精品国产亚洲高清剧情介绍| 欧美自拍偷拍一区| 亚洲日本va午夜在线影院| 国产福利一区在线| 欧美变态tickling挠脚心| 日韩精品五月天|