Search in sources :

Example 6 with TailPatriciaTrie

use of org.trie4j.patricia.TailPatriciaTrie in project trie4j by takawitter.

the class IterateDoubleArrayNodesTest method test.

@Test
public void test() throws Exception {
    Trie t = new TailPatriciaTrie();
    for (String w : new String[] { "hello", "world", "java", "hell", "he" }) {
        t.insert(w);
    }
    DoubleArray da = new DoubleArray(t);
    Assert.assertTrue(da.contains("hello"));
    Assert.assertEquals(15, da.nodeSize());
    CountingVisitor c = new CountingVisitor();
    Algorithms.traverseByBreadth(da.getRoot(), c);
    Assert.assertEquals(15, c.getCount());
}
Also used : TailPatriciaTrie(org.trie4j.patricia.TailPatriciaTrie) TailPatriciaTrie(org.trie4j.patricia.TailPatriciaTrie) Trie(org.trie4j.Trie) PatriciaTrie(org.trie4j.patricia.PatriciaTrie) Test(org.junit.Test)

Aggregations

TailPatriciaTrie (org.trie4j.patricia.TailPatriciaTrie)6 WikipediaTitles (org.trie4j.test.WikipediaTitles)4 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 Test (org.junit.Test)2 TailLOUDSTrie (org.trie4j.louds.TailLOUDSTrie)2 DataOutputStream (java.io.DataOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Trie (org.trie4j.Trie)1 BytesSuccinctBitVector (org.trie4j.bv.BytesSuccinctBitVector)1 PatriciaTrie (org.trie4j.patricia.PatriciaTrie)1 SBVConcatTailArrayBuilder (org.trie4j.tail.SBVConcatTailArrayBuilder)1 ConcatTailBuilder (org.trie4j.tail.builder.ConcatTailBuilder)1 IntArray (org.trie4j.util.IntArray)1