Home | History | Annotate | Download | only in normalizer
      1 /* GENERATED SOURCE. DO NOT MODIFY. */
      2 //  2016 and later: Unicode, Inc. and others.
      3 // License & terms of use: http://www.unicode.org/copyright.html#License
      4 package android.icu.dev.test.normalizer;
      5 
      6 import java.util.HashMap;
      7 import java.util.Map;
      8 import android.icu.testsharding.MainTestShard;
      9 
     10 /**
     11  *******************************************************************************
     12  * Copyright (C) 2002-2010, International Business Machines Corporation and    *
     13  * Unicode, Inc. All Rights Reserved.                                          *
     14  *******************************************************************************
     15  *
     16  * Hashtable storing ints addressed by longs. Used
     17  * for storing of composition data.
     18  * @author Vladimir Weinstein
     19  */
     20 @MainTestShard
     21 public class LongHashtable {
     22 
     23     public LongHashtable (int defaultValue) {
     24         this.defaultValue = defaultValue;
     25     }
     26 
     27     public void put(long key, int value) {
     28         if (value == defaultValue) {
     29             table.remove(new Long(key));
     30         } else {
     31             table.put(new Long(key), new Integer(value));
     32         }
     33     }
     34 
     35     public int get(long key) {
     36         Integer value = table.get(new Long(key));
     37         if (value == null) return defaultValue;
     38         return value.intValue();
     39     }
     40 
     41     private int defaultValue;
     42     private Map<Long, Integer> table = new HashMap<Long, Integer>();
     43 
     44 }
     45