]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/tests/core/src/com/ibm/icu/dev/test/normalizer/IntHashtable.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / tests / core / src / com / ibm / icu / dev / test / normalizer / IntHashtable.java
1 package com.ibm.icu.dev.test.normalizer;\r
2 \r
3 import java.util.Hashtable;\r
4 \r
5 /**\r
6  *******************************************************************************\r
7  * Copyright (C) 1998-2007, International Business Machines Corporation and    *\r
8  * Unicode, Inc. All Rights Reserved.                                          *\r
9  *******************************************************************************\r
10  *\r
11  * Integer hash table. Uses Java Hashtable for now.\r
12  * @author Mark Davis\r
13  */\r
14  \r
15 public class IntHashtable {\r
16 //    static final String copyright = "Copyright (C) 1998-2003 International Business Machines Corporation and Unicode, Inc.";\r
17     \r
18     public IntHashtable (int defaultValue) {\r
19         this.defaultValue = defaultValue;\r
20     }\r
21     \r
22     public void put(int key, int value) {\r
23         if (value == defaultValue) {\r
24             table.remove(new Integer(key));\r
25         } else {\r
26             table.put(new Integer(key), new Integer(value));\r
27         }\r
28     }\r
29     \r
30     public int get(int key) {\r
31         Object value = table.get(new Integer(key));\r
32         if (value == null) return defaultValue;\r
33         return ((Integer)value).intValue();\r
34     }\r
35     \r
36     private int defaultValue;\r
37     private Hashtable table = new Hashtable();\r
38 }