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 hash table. Uses Java Hashtable for now.
12: * @author Mark Davis
13: */
14:
15: public class IntHashtable {
16: static final String copyright = "Copyright (C) 1998-2003 International Business Machines Corporation and Unicode, Inc.";
17:
18: public IntHashtable(int defaultValue) {
19: this .defaultValue = defaultValue;
20: }
21:
22: public void put(int key, int value) {
23: if (value == defaultValue) {
24: table.remove(new Integer(key));
25: } else {
26: table.put(new Integer(key), new Integer(value));
27: }
28: }
29:
30: public int get(int key) {
31: Object value = table.get(new Integer(key));
32: if (value == null)
33: return defaultValue;
34: return ((Integer) value).intValue();
35: }
36:
37: private int defaultValue;
38: private Hashtable table = new Hashtable();
39: }
|