Package com.ibm.icu.impl

Examples of com.ibm.icu.impl.IntTrieBuilder


        //IntTrieBuilder(int aliasdata[], int maxdatalength,
        //        int initialvalue, int leadunitvalue,
        //        boolean latin1linear)
       
        fTrie = new IntTrieBuilder(null,   //   Data array  (utrie will allocate one)
                                   100000//   Max Data Length
                                   0,       //   Initial value for all code points
                                   0,       //   Lead Surrogate unit value,
                                   true);   //   Keep Latin 1 in separately.
       
View Full Code Here


     * @param t build table
     * @param collator to update
     */
    private void assembleTable(BuildTable t, RuleBasedCollator collator)
    {
        IntTrieBuilder mapping = t.m_mapping_;
        Vector expansions = t.m_expansions_;
        ContractionTable contractions = t.m_contractions_;
        MaxExpansionTable maxexpansion = t.m_maxExpansions_;
       
        // contraction offset has to be in since we are building on the
        // UCA contractions
        // int beforeContractions = (HEADER_SIZE_
        //                         + paddedsize(expansions.size() << 2)) >>> 1;
        collator.m_contractionOffset_ = 0;
        int contractionsSize = constructTable(contractions);
       
        // the following operation depends on the trie data. Therefore, we have
        // to do it before the trie is compacted
        // sets jamo expansions
        getMaxExpansionJamo(mapping, maxexpansion, t.m_maxJamoExpansions_,
                            collator.m_isJamoSpecial_);
       
        // TODO: LATIN1 array is now in the utrie - it should be removed from
        // the calculation
        setAttributes(collator, t.m_options_);
        // copy expansions
        int size = expansions.size();
        collator.m_expansion_ = new int[size];
        for (int i = 0; i < size; i ++) {
            collator.m_expansion_[i] = ((Integer)expansions.get(i)).intValue();
        }
        // contractions block
        if (contractionsSize != 0) {
            // copy contraction index
            collator.m_contractionIndex_ = new char[contractionsSize];
            contractions.m_codePoints_.getChars(0, contractionsSize,
                                                collator.m_contractionIndex_,
                                                0);
            // copy contraction collation elements
            collator.m_contractionCE_ = new int[contractionsSize];
            for (int i = 0; i < contractionsSize; i ++) {
                collator.m_contractionCE_[i] = ((Integer)
                        contractions.m_CEs_.get(i)).intValue();
            }
        }
        // copy mapping table
        collator.m_trie_ = mapping.serialize(t,
                         RuleBasedCollator.DataManipulate.getInstance());
        // copy max expansion table
        // not copying the first element which is a dummy
        // to be in synch with icu4c's builder, we continue to use the
        // expansion offset
View Full Code Here

        // Do your own mallocs for the structure, array and have linear
        // Latin 1
            int trieinitialvalue = RuleBasedCollator.CE_SPECIAL_FLAG_
        | (CE_NOT_FOUND_TAG_ << 24);
        // temporary fix for jb3822, 0x100000 -> 30000
        m_mapping_ = new IntTrieBuilder(null, 0x30000, trieinitialvalue,
                                            trieinitialvalue, true);
        m_prefixLookup_ = new Hashtable();
        // uhash_open(prefixLookupHash, prefixLookupComp);
        m_contractions_ = new ContractionTable(m_mapping_);
        // copy UCA's maxexpansion and merge as we go along
View Full Code Here

         * @param table to clone
         */
        BuildTable(BuildTable table)
        {
            m_collator_ = table.m_collator_;
            m_mapping_ = new IntTrieBuilder(table.m_mapping_);
            m_expansions_ = (Vector)table.m_expansions_.clone();
            m_contractions_ = new ContractionTable(table.m_contractions_);
            m_contractions_.m_mapping_ = m_mapping_;
            m_options_ = table.m_options_;
            m_maxExpansions_ = new MaxExpansionTable(table.m_maxExpansions_);
View Full Code Here

   
    private void _testTrieRanges(SetRange setRanges[], int countSetRanges,
                                 CheckRange checkRanges[], int countCheckRanges,
                                 boolean latin1Linear)
    {
        IntTrieBuilder newTrie = new IntTrieBuilder(null, 2000,
                                                    checkRanges[0].value,
                                                    checkRanges[0].value,
                                                    latin1Linear);
   
        // set values from setRanges[]
        boolean ok = true;
        for (int i = 0; i < countSetRanges; ++ i) {
            int start = setRanges[i].start;
            int limit = setRanges[i].limit;
            int value = setRanges[i].value;
            boolean overwrite = setRanges[i].overwrite;
            if ((limit - start) == 1 && overwrite) {
                ok &= newTrie.setValue(start, value);
            }
            else {
                ok &= newTrie.setRange(start, limit, value, overwrite);
            }
        }
        if (!ok) {
            errln("setting values into a trie failed");
            return;
        }
   
        // verify that all these values are in the new Trie
        int start = 0;
        for (int i = 0; i < countCheckRanges; ++ i) {
            int limit = checkRanges[i].limit;
            int value = checkRanges[i].value;
   
            while (start < limit) {
                if (value != newTrie.getValue(start)) {
                    errln("newTrie [U+"
                          + Integer.toHexString(start) + "]==0x"
                          + Integer.toHexString(newTrie.getValue(start))
                          + " instead of 0x" + Integer.toHexString(value));
                }
                ++ start;
            }
        }
   
        IntTrie trie = newTrie.serialize(new _testFoldedValue(newTrie),
                                         new _testFoldingOffset());
   
        // test linear Latin-1 range from utrie_getData()
        if (latin1Linear) {
            start = 0;
View Full Code Here

     * @param t build table
     * @param collator to update
     */
    private void assembleTable(BuildTable t, RuleBasedCollator collator)
    {
        IntTrieBuilder mapping = t.m_mapping_;
        Vector expansions = t.m_expansions_;
        ContractionTable contractions = t.m_contractions_;
        MaxExpansionTable maxexpansion = t.m_maxExpansions_;
       
        // contraction offset has to be in since we are building on the
        // UCA contractions
        // int beforeContractions = (HEADER_SIZE_
        //                         + paddedsize(expansions.size() << 2)) >>> 1;
        collator.m_contractionOffset_ = 0;
        int contractionsSize = constructTable(contractions);
       
        // the following operation depends on the trie data. Therefore, we have
        // to do it before the trie is compacted
        // sets jamo expansions
        getMaxExpansionJamo(mapping, maxexpansion, t.m_maxJamoExpansions_,
                            collator.m_isJamoSpecial_);
       
        // TODO: LATIN1 array is now in the utrie - it should be removed from
        // the calculation
        setAttributes(collator, t.m_options_);
        // copy expansions
        int size = expansions.size();
        collator.m_expansion_ = new int[size];
        for (int i = 0; i < size; i ++) {
            collator.m_expansion_[i] = ((Integer)expansions.get(i)).intValue();
        }
        // contractions block
        if (contractionsSize != 0) {
            // copy contraction index
            collator.m_contractionIndex_ = new char[contractionsSize];
            contractions.m_codePoints_.getChars(0, contractionsSize,
                                                collator.m_contractionIndex_,
                                                0);
            // copy contraction collation elements
            collator.m_contractionCE_ = new int[contractionsSize];
            for (int i = 0; i < contractionsSize; i ++) {
                collator.m_contractionCE_[i] = ((Integer)
                        contractions.m_CEs_.get(i)).intValue();
            }
        }
        // copy mapping table
        collator.m_trie_ = mapping.serialize(t,
                         RuleBasedCollator.DataManipulate.getInstance());
        // copy max expansion table
        // not copying the first element which is a dummy
        // to be in synch with icu4c's builder, we continue to use the
        // expansion offset
View Full Code Here

        // Do your own mallocs for the structure, array and have linear
        // Latin 1
            int trieinitialvalue = RuleBasedCollator.CE_SPECIAL_FLAG_
        | (CE_NOT_FOUND_TAG_ << 24);
        // temporary fix for jb3822, 0x100000 -> 30000
        m_mapping_ = new IntTrieBuilder(null, 0x30000, trieinitialvalue,
                                            trieinitialvalue, true);
        m_prefixLookup_ = new Hashtable();
        // uhash_open(prefixLookupHash, prefixLookupComp);
        m_contractions_ = new ContractionTable(m_mapping_);
        // copy UCA's maxexpansion and merge as we go along
View Full Code Here

         * @param table to clone
         */
        BuildTable(BuildTable table)
        {
            m_collator_ = table.m_collator_;
            m_mapping_ = new IntTrieBuilder(table.m_mapping_);
            m_expansions_ = (Vector)table.m_expansions_.clone();
            m_contractions_ = new ContractionTable(table.m_contractions_);
            m_contractions_.m_mapping_ = m_mapping_;
            m_options_ = table.m_options_;
            m_maxExpansions_ = new MaxExpansionTable(table.m_maxExpansions_);
View Full Code Here

            //IntTrieBuilder(int aliasdata[], int maxdatalength,
            //        int initialvalue, int leadunitvalue,
            //        boolean latin1linear)
           
            fTrie = new IntTrieBuilder(null,   //   Data array  (utrie will allocate one)
                                       100000//   Max Data Length
                                       0,       //   Initial value for all code points
                                       0,       //   Lead Surrogate unit value,
                                       true);   //   Keep Latin 1 in separately.
           
View Full Code Here

   *            build table
   * @param collator
   *            to update
   */
  private void assembleTable(final BuildTable t, final RuleBasedCollator collator) {
    IntTrieBuilder mapping = t.m_mapping_;
    List<Integer> expansions = t.m_expansions_;
    ContractionTable contractions = t.m_contractions_;
    MaxExpansionTable maxexpansion = t.m_maxExpansions_;

    // contraction offset has to be in since we are building on the
    // UCA contractions
    // int beforeContractions = (HEADER_SIZE_
    // + paddedsize(expansions.size() << 2)) >>> 1;
    collator.m_contractionOffset_ = 0;
    int contractionsSize = constructTable(contractions);

    // the following operation depends on the trie data. Therefore, we have
    // to do it before the trie is compacted
    // sets jamo expansions
    getMaxExpansionJamo(mapping, maxexpansion, t.m_maxJamoExpansions_, collator.m_isJamoSpecial_);

    // TODO: LATIN1 array is now in the utrie - it should be removed from
    // the calculation
    setAttributes(collator, t.m_options_);
    // copy expansions
    int size = expansions.size();
    collator.m_expansion_ = new int[size];
    for (int i = 0; i < size; i++) {
      collator.m_expansion_[i] = expansions.get(i).intValue();
    }
    // contractions block
    if (contractionsSize != 0) {
      // copy contraction index
      collator.m_contractionIndex_ = new char[contractionsSize];
      contractions.m_codePoints_.getChars(0, contractionsSize, collator.m_contractionIndex_, 0);
      // copy contraction collation elements
      collator.m_contractionCE_ = new int[contractionsSize];
      for (int i = 0; i < contractionsSize; i++) {
        collator.m_contractionCE_[i] = contractions.m_CEs_.get(i).intValue();
      }
    }
    // copy mapping table
    collator.m_trie_ = mapping.serialize(t, RuleBasedCollator.DataManipulate.getInstance());
    // copy max expansion table
    // not copying the first element which is a dummy
    // to be in synch with icu4c's builder, we continue to use the
    // expansion offset
    // omitting expansion offset in builder
View Full Code Here

TOP

Related Classes of com.ibm.icu.impl.IntTrieBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.