⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idimpl2.java

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 JAVA
字号:
package org.python.core;import java.lang.ref.WeakReference;import java.lang.ref.ReferenceQueue;import java.util.HashMap;public class IdImpl2 extends IdImpl {        public static class WeakIdentityMap {                private ReferenceQueue refqueue = new ReferenceQueue();        private HashMap hashmap = new HashMap();                private void cleanup() {            Object k;            while ((k = refqueue.poll()) != null) {                hashmap.remove(k);            }        }                        private class WeakIdKey extends WeakReference {            private int hashcode;                        WeakIdKey(Object obj) {                super(obj,refqueue);                hashcode = System.identityHashCode(obj);                            }                        public int hashCode() {                return hashcode;            }                        public boolean equals(Object other) {                Object obj = this.get();                if (obj != null) {                    return obj == ((WeakIdKey)other).get();                } else {                    return this == other;                }                            }        }                public int _internal_map_size() {            return hashmap.size();        }                public void put(Object key,Object val) {            cleanup();            hashmap.put(new WeakIdKey(key),val);        }                public Object get(Object key) {            cleanup();            return hashmap.get(new WeakIdKey(key));        }        public void remove(Object key) {            cleanup();            hashmap.remove(new WeakIdKey(key));                }    }    private WeakIdentityMap id_map = new WeakIdentityMap();    private long sequential_id = 0;     public long id(PyObject o) {        if (o instanceof PyJavaInstance) {            return java_obj_id(((PyJavaInstance)o).javaProxy);        } else {            return java_obj_id(o);        }                }    // XXX maybe should display both this id and identityHashCode    // XXX preserve the old "at ###" style?    public String idstr(PyObject o) {        return Long.toString(id(o));    }    public synchronized long java_obj_id(Object o) {        Long cand = (Long)id_map.get(o);        if (cand == null) {            sequential_id++;            long new_id = sequential_id;                       id_map.put(o,new Long(new_id));            return new_id;                    }        return cand.longValue();    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -