01: // Copyright 2000 Samuele Pedroni
02:
03: package org.python.core;
04:
05: import java.lang.ref.Reference;
06: import java.lang.ref.ReferenceQueue;
07: import java.lang.ref.WeakReference;
08:
09: public class WeakInternalTables extends AutoInternalTables {
10:
11: private static class Ref extends WeakReference {
12: Object key;
13:
14: short type;
15:
16: Ref(short type, Object key, Object obj, ReferenceQueue queue) {
17: super (obj, queue);
18: this .type = type;
19: this .key = key;
20: }
21: }
22:
23: protected Reference newAutoRef(short type, Object key, Object obj) {
24: return new Ref(type, key, obj, this .queue);
25: }
26:
27: protected short getAutoRefType(Reference ref) {
28: return ((Ref) ref).type;
29: }
30:
31: protected Object getAutoRefKey(Reference ref) {
32: return ((Ref) ref).key;
33: }
34:
35: }
|