Java 类gnu.trove.map.hash.TCharObjectHashMap 实例源码

项目:EmbeddableSearch    文件:Trie.java   
/**
 * Private internal method to recursively add the wordPart to the trie structure
 * 
 * @param wordPart Word part to be added to the trie
 */
private int addInternal(TrieNode node, String wordPart, boolean isFullWord, int cost) {
    cost += 1;
    // LOGGER.debugprintln("\t\t" + this.getClass().getSimpleName() +
    // ": adding wordPart: " + wordPart + ", currentCost: " + cost);

    int length = wordPart.length();
    node.children = (node.children != null) ? node.children : new TCharObjectHashMap<TrieNode>(1, 0.9f);

    char c = getChar(wordPart);
    TrieNode child = node.children.get(c);

    if (child == null) {
        child = new TrieNode(c);
        node.children.put(c, child);
    }

    if (length == 1) { // This is the end of the string and not on the root
                        // node, add a child marker to denote end of suffix
        child.isEnd = true;
        child.isFullWordEnd = child.isFullWordEnd || isFullWord;
    } else {
        String subString = getSubstring(wordPart);

        cost += addInternal(child, subString, isFullWord, cost);

        if (createFullTrie && node.isRootNode()) { // full tree and root node
            cost += addInternal(node, subString, false, cost);
        }
    }
    return cost;
}
项目:zuul-trie-matcher-spring-cloud-starter    文件:CharHashMapTrieNode.java   
/**
 * Creates new instance of {@link CharHashMapTrieNode}.
 */
public CharHashMapTrieNode() {
    next = new TCharObjectHashMap<CharHashMapTrieNode<T>>();
}
项目:stringsearch    文件:DefaultStorageFactory.java   
public <V> Map<Character, V> createMap() {
    return new TCharObjectMapDecorator<V>(new TCharObjectHashMap<V>(0));
}
项目:zuul-trie-matcher-spring-cloud-starter    文件:CharHashMapTrieNode.java   
/**
 * Creates new instance of {@link CharHashMapTrieNode} with specific initial capacity.
 *
 * @param initialCapacity the initial capacity
 */
public CharHashMapTrieNode(int initialCapacity) {
    next = new TCharObjectHashMap<CharHashMapTrieNode<T>>(initialCapacity);
}
项目:zuul-trie-matcher-spring-cloud-starter    文件:CharHashMapTrieNode.java   
/**
 * Creates new instance of {@link CharHashMapTrieNode} with specific initial capacity and load factor.
 *
 * @param initialCapacity the initial capacity
 * @param loadFactor      the load factor
 */
public CharHashMapTrieNode(int initialCapacity, float loadFactor) {
    next = new TCharObjectHashMap<CharHashMapTrieNode<T>>(initialCapacity, loadFactor);
}