diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/core/Hashtable.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/core/Hashtable.java')
| -rw-r--r-- | NET/worlds/core/Hashtable.java | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/NET/worlds/core/Hashtable.java b/NET/worlds/core/Hashtable.java new file mode 100644 index 0000000..c8edfb0 --- /dev/null +++ b/NET/worlds/core/Hashtable.java @@ -0,0 +1,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 + */
\ No newline at end of file |