protected String toString(TrieNode node){
  StringBuffer result;
  int i;
  StringBuffer indentation;
  result=new StringBuffer();
  indentation=new StringBuffer();
  for (i=0; i < node.getLevel(); i++) {
    indentation.append(" | ");
  }
  result.append(indentation.toString());
  if (node.getChar() == null) {
    result.append("<root>");
  }
 else   if (node.getChar() == TrieNode.STOP) {
    result.append("STOP");
  }
 else {
    result.append("'" + node.getChar() + "'");
  }
  result.append("\n");
  for (i=0; i < node.getChildCount(); i++) {
    result.append(toString((TrieNode)node.getChildAt(i)));
  }
  return result.toString();
}

protected String toString ( TrieNode node ) { StringBuffer result ; int i ; StringBuffer indentation ; result = new StringBuffer ( ) ; indentation = new StringBuffer ( ) ; for ( i = 0 ; i < node . getLevel ( ) ; i ++ ) { indentation . append ( " | " ) ; } result . append ( indentation . toString ( ) ) ; if ( node . getChar ( ) == null ) { result . append ( "<root>" ) ; } else if ( node . getChar ( ) == TrieNode . STOP ) { result . append ( "STOP" ) ; } else { result . append ( "'" + node . getChar ( ) + "'" ) ; } result . append ( "\n" ) ; for ( i = 0 ; i < node . getChildCount ( ) ; i ++ ) { result . append ( toString ( ( TrieNode ) node . getChildAt ( i ) ) ) ; } return result . toString ( ) ; }
returns the node as string
