public static String serializeExpression(Node s){
  if (s instanceof ASTTerm) {
    ASTTerm a=(ASTTerm)s;
    return (a.isNotFlag() ? "!" : "") + " " + a.getTerm();
  }
  String prefix="";
  String suffix="";
  String join=" ";
  if (s instanceof ASTExpression) {
    ASTExpression a=(ASTExpression)s;
    prefix=(a.isNotFlag() ? "!" : "") + "(";
    suffix=")";
    join=" " + a.getType() + " ";
  }
  List<String> children=new ArrayList<String>();
  for (int i=0; i < s.jjtGetNumChildren(); i++) {
    children.add(serializeExpression(s.jjtGetChild(i)));
  }
  return prefix + StringUtils.join(children,join) + suffix;
}

public static String serializeExpression ( Node s ) { if ( s instanceof ASTTerm ) { ASTTerm a = ( ASTTerm ) s ; return ( a . isNotFlag ( ) ? "!" : "" ) + " " + a . getTerm ( ) ; } String prefix = "" ; String suffix = "" ; String join = " " ; if ( s instanceof ASTExpression ) { ASTExpression a = ( ASTExpression ) s ; prefix = ( a . isNotFlag ( ) ? "!" : "" ) + "(" ; suffix = ")" ; join = " " + a . getType ( ) + " " ; } List < String > children = new ArrayList < String > ( ) ; for ( int i = 0 ; i < s . jjtGetNumChildren ( ) ; i ++ ) { children . add ( serializeExpression ( s . jjtGetChild ( i ) ) ) ; } return prefix + StringUtils . join ( children , join ) + suffix ; }
serialize a node ( and it ' s children ) to a parsable string .
