01: package com.ibm.icu.dev.test.normalizer;
02:
03: import java.util.Hashtable;
04:
05: /**
06: *******************************************************************************
07: * Copyright (C) 1998-2003, International Business Machines Corporation and *
08: * Unicode, Inc. All Rights Reserved. *
09: *******************************************************************************
10: *
11: * Integer-String hash table. Uses Java Hashtable for now.
12: * @author Mark Davis
13: */
14:
15: public class IntStringHashtable {
16: static final String copyright = "Copyright (C) 1998-2003 International Business Machines Corporation and Unicode, Inc.";
17:
18: public IntStringHashtable(String defaultValue) {
19: this .defaultValue = defaultValue;
20: }
21:
22: public void put(int key, String value) {
23: if (value == defaultValue) {
24: table.remove(new Integer(key));
25: } else {
26: table.put(new Integer(key), value);
27: }
28: }
29:
30: public String get(int key) {
31: Object value = table.get(new Integer(key));
32: if (value == null)
33: return defaultValue;
34: return (String) value;
35: }
36:
37: private String defaultValue;
38: private Hashtable table = new Hashtable();
39: }
|