/* Generated By:JJTree: Do not edit this line. ASTProgram.java */

import java.io.*; 

public class ASTProgram extends SimpleNode {
  public ASTProgram(int id) {
    super(id);
  }

  public ASTProgram(drawphase3 p, int id) {
    super(p, id);
  }

  public void generate() 
  {
    try
    {
      /*-----------------------------------------------*/
      /* Top Parent writes svg code to screen and file */
      /*-----------------------------------------------*/
      String fileSVG = "outPut.svg";
      String fileHTML = "outPut.html";
      String svgCode = "";
    
      FileWriter fwSVG = new FileWriter (fileSVG);
      BufferedWriter bwSVG = new BufferedWriter(fwSVG);
      PrintWriter outFileSVG = new PrintWriter (bwSVG);

      FileWriter fwHTML = new FileWriter (fileHTML);
      BufferedWriter bwHTML = new BufferedWriter(fwHTML);
      PrintWriter outFileHTML = new PrintWriter (bwHTML);
    

      svgCode = "<svg width=\"" + ((ASTInt) jjtGetChild(0)).val + "\" height=\"" + ((ASTInt) jjtGetChild(1)).val + "\" >";
    
      for(int i=2; i < jjtGetNumChildren(); i++) 
      {
        svgCode = svgCode + "\n" + jjtGetChild(i).getString();
      }

      svgCode = svgCode + "\n</svg>";
      System.out.println(svgCode);
      outFileSVG.println(svgCode);
      outFileSVG.close();

	/*-----------------------------------------*/
      /* Makes HTML File for displaying SVG Code */
      /*-----------------------------------------*/
      outFileHTML.println("<html>\n<embed src=\"" + fileSVG + "\" width=\"" + ((ASTInt) jjtGetChild(0)).val + "\" height=\"" + ((ASTInt) jjtGetChild(1)).val + "\"/>\n</html>");
      outFileHTML.close();
    }
    catch(IOException exception) { }
  }
}
