Search in sources :

Example 1 with LOUDSBvTree

use of org.trie4j.louds.bvtree.LOUDSBvTree in project trie4j by takawitter.

the class AbstractWikipediaSerializeTest method getBvTreeClassName.

static String getBvTreeClassName(Trie trie) {
    if (trie instanceof TailLOUDSTrie) {
        StringBuilder b = new StringBuilder("(");
        BvTree bvTree = ((TailLOUDSTrie) trie).getBvTree();
        b.append(bvTree.getClass().getSimpleName());
        if (bvTree instanceof LOUDSBvTree) {
            b.append("(");
            b.append(((LOUDSBvTree) bvTree).getSbv().getClass().getSimpleName());
            b.append(")");
        } else if (bvTree instanceof LOUDSPPBvTree) {
            b.append("(");
            LOUDSPPBvTree pbvt = (LOUDSPPBvTree) bvTree;
            b.append("r0:").append(pbvt.getR0().getClass().getSimpleName()).append(",r1:").append(pbvt.getR1().getClass().getSimpleName()).append(")");
        }
        b.append(")");
        return b.toString();
    } else {
        return "";
    }
}
Also used : LOUDSBvTree(org.trie4j.louds.bvtree.LOUDSBvTree) TailLOUDSTrie(org.trie4j.louds.TailLOUDSTrie) LOUDSPPBvTree(org.trie4j.louds.bvtree.LOUDSPPBvTree) BvTree(org.trie4j.louds.bvtree.BvTree) LOUDSPPBvTree(org.trie4j.louds.bvtree.LOUDSPPBvTree) LOUDSBvTree(org.trie4j.louds.bvtree.LOUDSBvTree)

Example 2 with LOUDSBvTree

use of org.trie4j.louds.bvtree.LOUDSBvTree in project trie4j by takawitter.

the class TrieWriter method writeBvTree.

public void writeBvTree(BvTree bvTree) throws IOException {
    if (bvTree instanceof LOUDSBvTree) {
        dos.writeShort(TYPE_BVTREE_LOUDS);
        writeLOUDSBvTree((LOUDSBvTree) bvTree);
    } else if (bvTree instanceof LOUDSPPBvTree) {
        dos.writeShort(TYPE_BVTREE_LOUDSPP);
        writeLOUDSPPBvTree((LOUDSPPBvTree) bvTree);
    } else {
        throw new IOException("unknown bv tree: " + bvTree.getClass().getName());
    }
}
Also used : LOUDSBvTree(org.trie4j.louds.bvtree.LOUDSBvTree) LOUDSPPBvTree(org.trie4j.louds.bvtree.LOUDSPPBvTree) IOException(java.io.IOException)

Example 3 with LOUDSBvTree

use of org.trie4j.louds.bvtree.LOUDSBvTree in project trie4j by takawitter.

the class TailLOUDSTrieWithSuffixTrieTailArrayWikipediaMonitoredSBVTest method buildSecondTrie.

@Override
protected Trie buildSecondTrie(Trie first) {
    bv.resetCounts();
    TailLOUDSTrie t = new TailLOUDSTrie(first, new LOUDSBvTree(bv), new SuffixTrieTailArray(first.size()), new NodeListener() {

        @Override
        public void listen(Node node, int id) {
        }
    });
    t.trimToSize();
    return t;
}
Also used : LOUDSBvTree(org.trie4j.louds.bvtree.LOUDSBvTree) NodeListener(org.trie4j.louds.TailLOUDSTrie.NodeListener) Node(org.trie4j.Node) SuffixTrieTailArray(org.trie4j.tail.SuffixTrieTailArray)

Aggregations

LOUDSBvTree (org.trie4j.louds.bvtree.LOUDSBvTree)3 LOUDSPPBvTree (org.trie4j.louds.bvtree.LOUDSPPBvTree)2 IOException (java.io.IOException)1 Node (org.trie4j.Node)1 TailLOUDSTrie (org.trie4j.louds.TailLOUDSTrie)1 NodeListener (org.trie4j.louds.TailLOUDSTrie.NodeListener)1 BvTree (org.trie4j.louds.bvtree.BvTree)1 SuffixTrieTailArray (org.trie4j.tail.SuffixTrieTailArray)1