import org.speedblue.util.Trie;

public class ExampleTrieJava
{
  public static void main(String args[])
  {
    try
      {
	/// 100 set the default number of nodes in the trie
	Trie trie = new Trie(100);
      
	System.out.println("set [First String] = 1");
	trie.addEntry("First String", 1);
	System.out.println("set [Second String] = 2");
	trie.addEntry("Second String", 2);
	System.out.println("set [First Element] = 3");
	trie.addEntry("First Element", 3);
	System.out.println("set [Second Element] = 4");
	trie.addEntry("Second Element", 4);

	System.out.println("get [First String] = " + trie.getEntry("First String"));
	System.out.println("get [Second String] = " + trie.getEntry("Second String"));
	System.out.println("get [First Element] = " + trie.getEntry("First Element"));
	System.out.println("get [Second Element] = " + trie.getEntry("Second Element"));

	System.out.println("set [First String] = 10");
	trie.setEntry("First String", 10);
	System.out.println("get [First String] = " + trie.getEntry("First String"));
      
	// no match, return -1
	System.out.println("get [No match for this entry] = " + trie.getEntry("No match for this entry"));
      }
    catch (Exception e)
      {
	e.printStackTrace();
      }
  }
}
