X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=blobdiff_plain;f=Robust%2Fsrc%2FInterface%2FHashStrings.java;h=0f3bd801018cdec3281e9111110e7cff02191443;hp=67065786ad6ae35a74c30d2d5fb15d6504d7c745;hb=cdcf09c40af1419fa42932aae249cb79b69b5daf;hpb=0255eec41b9bc9b21eaf14a68c2a6bda28e51064 diff --git a/Robust/src/Interface/HashStrings.java b/Robust/src/Interface/HashStrings.java deleted file mode 100644 index 67065786..00000000 --- a/Robust/src/Interface/HashStrings.java +++ /dev/null @@ -1,39 +0,0 @@ -package Interface; - -class HashStrings { - Pair p[]; // entries in the hash table - int f; // number of full entries - public HashStrings() { p = new Pair[38]; f = 0; } - - public void put(String key, String value) { - int n = p.length; - if (f == n-1) return; // cheese -- a diary product - int i = key.hashCode() % n; - while (p[i] != null) { - if (key.equals(p[i].key)) { - p[i] = new Pair(key, value); - return; - } - i = (i+1) % n; - } - p[i] = new Pair(key, value); - f = f + 1; - } - - public String get(String key) { - int n = p.length; - int i = key.hashCode() % n; - while (p[i] != null) { - if (key.equals(p[i].key)) - return p[i].value; - i = (i+1) % n; - } - return null; - } - -} - -class Pair { - String key, value; - Pair (String key, String value) { this.key = key; this.value = value; } -}