/* */ 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 /* */ extends java.util.Hashtable /* */ 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 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 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 */