blob: c8edfb000899afc8fbad0425e8403d5c3e0acdfc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
/* */ package NET.worlds.core;
/* */
/* */ import NET.worlds.scape.Persister;
/* */ import NET.worlds.scape.Restorer;
/* */ import NET.worlds.scape.Saver;
/* */ import NET.worlds.scape.TooNewException;
/* */ import java.io.IOException;
/* */ import java.util.Enumeration;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class Hashtable<K, V>
/* */ extends java.util.Hashtable<K, V>
/* */ implements Persister
/* */ {
/* */ private static final long serialVersionUID = 1133311923215053895L;
/* */
/* */ public Hashtable(int initialCapacity, float loadFactor)
/* */ {
/* 38 */ super(initialCapacity, loadFactor);
/* */ }
/* */
/* */
/* */
/* */ public Hashtable(int initialCapacity)
/* */ {
/* 45 */ super(initialCapacity);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Hashtable() {}
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Object getKey(Object obj)
/* */ {
/* 65 */ Enumeration<K> e = keys();
/* 66 */ while (e.hasMoreElements()) {
/* 67 */ Object key = e.nextElement();
/* 68 */ if (get(key) == obj)
/* 69 */ return key;
/* */ }
/* 71 */ return null;
/* */ }
/* */
/* 74 */ private static Object classCookie = new Object();
/* */
/* */
/* */
/* */ public void saveState(Saver s)
/* */ throws IOException
/* */ {
/* 81 */ s.saveVersion(0, classCookie);
/* 82 */ int count = 0;
/* 83 */ Enumeration<K> e = keys();
/* 84 */ while (e.hasMoreElements()) {
/* 85 */ Object key = e.nextElement();
/* 86 */ Object obj = get(key);
/* 87 */ if ((((key instanceof String)) || ((key instanceof Persister))) &&
/* 88 */ ((obj instanceof Persister))) {
/* 89 */ count++;
/* */ }
/* */ }
/* */
/* 93 */ s.saveInt(count);
/* 94 */ e = keys();
/* 95 */ while (e.hasMoreElements()) {
/* 96 */ Object key = e.nextElement();
/* 97 */ Object obj = get(key);
/* 98 */ if ((((key instanceof String)) || ((key instanceof Persister))) &&
/* 99 */ ((obj instanceof Persister))) {
/* 100 */ if ((key instanceof String)) {
/* 101 */ s.saveBoolean(true);
/* 102 */ s.saveString((String)key);
/* */ } else {
/* 104 */ s.saveBoolean(false);
/* 105 */ s.save((Persister)key);
/* */ }
/* 107 */ s.save((Persister)obj);
/* */ }
/* */ }
/* */ }
/* */
/* */ public void restoreState(Restorer r) throws IOException, TooNewException {
/* 113 */ int count = restoreCount(r);
/* 114 */ for (int i = 0; i < count; i++) {
/* 115 */ restoreEntry(r);
/* */ }
/* */ }
/* */
/* */
/* */ public void postRestore(int version) {}
/* */
/* */
/* */ public int restoreCount(Restorer r)
/* */ throws IOException, TooNewException
/* */ {
/* 126 */ switch (r.restoreVersion(classCookie)) {
/* */ case 0:
/* 128 */ return r.restoreInt();
/* */ }
/* 130 */ throw new TooNewException();
/* */ }
/* */
/* */
/* */
/* */ public void restoreEntry(Restorer r)
/* */ throws IOException, TooNewException
/* */ {
/* */ K key;
/* */
/* */ K key;
/* */
/* 142 */ if (r.restoreBoolean()) {
/* 143 */ key = r.restoreString();
/* */ } else
/* 145 */ key = r.restore();
/* 146 */ V obj = r.restore();
/* 147 */ put(key, obj);
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\core\Hashtable.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|