Home | History | Annotate | Download | only in impl
      1 //  2016 and later: Unicode, Inc. and others.
      2 // License & terms of use: http://www.unicode.org/copyright.html#License
      3 /*
      4  ******************************************************************************
      5  * Copyright (C) 1996-2009, International Business Machines Corporation and   *
      6  * others. All Rights Reserved.                                               *
      7  ******************************************************************************
      8  */
      9 
     10 /*
     11  * @author Shaopeng Jia
     12  */
     13 
     14 package com.ibm.icu.impl;
     15 
     16 import com.ibm.icu.impl.PropsVectors.CompactHandler;
     17 
     18 public class PVecToTrieCompactHandler implements CompactHandler {
     19     public IntTrieBuilder builder;
     20     public int initialValue;
     21 
     22     @Override
     23     public void setRowIndexForErrorValue(int rowIndex) {
     24     }
     25 
     26     @Override
     27     public void setRowIndexForInitialValue(int rowIndex) {
     28         initialValue = rowIndex;
     29     }
     30 
     31     @Override
     32     public void setRowIndexForRange(int start, int end, int rowIndex) {
     33         builder.setRange(start, end + 1, rowIndex, true);
     34     }
     35 
     36     @Override
     37     public void startRealValues(int rowIndex) {
     38         if (rowIndex > 0xffff) {
     39             // too many rows for a 16-bit trie
     40             throw new IndexOutOfBoundsException();
     41         } else {
     42             builder = new IntTrieBuilder(null, 100000, initialValue,
     43                     initialValue, false);
     44         }
     45     }
     46 }
     47