private TrieNode lookupTrieNode(TrieNode rootNode,String userContext,int index){
  if (index >= userContext.length()) {
    rootNode=(rootNode == mRoot) ? null : rootNode;
    return rootNode;
  }
  int curContent=(int)userContext.charAt(index);
  if (rootNode.hasChild(curContent)) {
    return lookupTrieNode(rootNode.getChild(curContent),userContext,index + 1);
  }
 else   if (rootNode == mRoot) {
    return lookupTrieNode(rootNode,userContext,index + 1);
  }
 else {
    return lookupTrieNode(rootNode.getVineNode(),userContext,index);
  }
}

private TrieNode lookupTrieNode ( TrieNode rootNode , String userContext , int index ) { if ( index >= userContext . length ( ) ) { rootNode = ( rootNode == mRoot ) ? null : rootNode ; return rootNode ; } int curContent = ( int ) userContext . charAt ( index ) ; if ( rootNode . hasChild ( curContent ) ) { return lookupTrieNode ( rootNode . getChild ( curContent ) , userContext , index + 1 ) ; } else if ( rootNode == mRoot ) { return lookupTrieNode ( rootNode , userContext , index + 1 ) ; } else { return lookupTrieNode ( rootNode . getVineNode ( ) , userContext , index ) ; } }
given the context , tries to find the context of greatest length within the trie . the maximum length will naturally be the max depth of the trie . null is returned only if even a context of length 1 can ' t be found .
