private void toWagonFormat(DecisionNode node,DataOutputStream out,String extension,PrintWriter pw) throws IOException {
  if (out != null) {
    writeStringToOutput("((" + node.getNodeDefinition() + ")",out);
  }
 else {
  }
  if (pw != null) {
    pw.println("((" + node.getNodeDefinition() + ")");
  }
  for (int i=0; i < node.getNumberOfDaugthers(); i++) {
    if (node.getDaughter(i) == null) {
      String nullDaughter="";
      if (i + 1 != node.getNumberOfDaugthers()) {
        nullDaughter="((() 0))";
      }
 else {
        if (extension != null) {
          nullDaughter="((() 0)))" + extension;
        }
 else {
          nullDaughter="((() 0)))";
        }
      }
      if (out != null) {
        writeStringToOutput(nullDaughter,out);
      }
 else {
      }
      if (pw != null) {
        pw.println(" " + nullDaughter);
      }
    }
 else {
      if (i + 1 != node.getNumberOfDaugthers()) {
        toWagonFormat(node.getDaughter(i),out,"",pw);
      }
 else {
        if (extension != null) {
          toWagonFormat(node.getDaughter(i),out,")" + extension,pw);
        }
 else {
          toWagonFormat(node.getDaughter(i),out,")",pw);
        }
      }
    }
  }
}

private void toWagonFormat ( DecisionNode node , DataOutputStream out , String extension , PrintWriter pw ) throws IOException { if ( out != null ) { writeStringToOutput ( "((" + node . getNodeDefinition ( ) + ")" , out ) ; } else { } if ( pw != null ) { pw . println ( "((" + node . getNodeDefinition ( ) + ")" ) ; } for ( int i = 0 ; i < node . getNumberOfDaugthers ( ) ; i ++ ) { if ( node . getDaughter ( i ) == null ) { String nullDaughter = "" ; if ( i + 1 != node . getNumberOfDaugthers ( ) ) { nullDaughter = "((() 0))" ; } else { if ( extension != null ) { nullDaughter = "((() 0)))" + extension ; } else { nullDaughter = "((() 0)))" ; } } if ( out != null ) { writeStringToOutput ( nullDaughter , out ) ; } else { } if ( pw != null ) { pw . println ( " " + nullDaughter ) ; } } else { if ( i + 1 != node . getNumberOfDaugthers ( ) ) { toWagonFormat ( node . getDaughter ( i ) , out , "" , pw ) ; } else { if ( extension != null ) { toWagonFormat ( node . getDaughter ( i ) , out , ")" + extension , pw ) ; } else { toWagonFormat ( node . getDaughter ( i ) , out , ")" , pw ) ; } } } } }
writes the cart to the given dataout in wagon format
