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