private static String canonizeTreeString(String str){
  String canon=str.trim();
  Pattern pattern=Pattern.compile("(@\\S+)\\(\\)");
  Matcher matcher=pattern.matcher(canon);
  while (matcher.find()) {
    canon=matcher.replaceFirst(matcher.group(1));
    matcher.reset(canon);
  }
  return canon.trim();
}

private static String canonizeTreeString ( String str ) { String canon = str . trim ( ) ; Pattern pattern = Pattern . compile ( "(@\\S+)\\(\\)" ) ; Matcher matcher = pattern . matcher ( canon ) ; while ( matcher . find ( ) ) { canon = matcher . replaceFirst ( matcher . group ( 1 ) ) ; matcher . reset ( canon ) ; } return canon . trim ( ) ; }
a method to canonize the tree representation .
