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

import java.io.*;

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

	public ASTMain(DrawPhase2 p, int id) 
	{
		super(p, id);
	}

	public void generate(FileWriter SVGFile,String SVG, String HTML,
						int X, int Y, String colour, int brush)
	{
		FileHeader(SVGFile);
		try
		{
			for(int count = 2; count < jjtGetNumChildren(); count++)
			{//int count = 2;
				jjtGetChild(count).generate(SVGFile,X, Y, colour, brush);
			}
			FileComplete(SVGFile);
			SVGFile.close();

			Generate_HTML_File(SVG, HTML);
		}
		catch(Exception e)
		{
			e.printStackTrace();
			System.err.println ("Error writing to file");
		}
	}

	public void Generate_HTML_File(String SVGFileName, String HTMLFileName)
	{
		try
		{
			FileWriter HTMLFile = new FileWriter(HTMLFileName);

			HTMLFile.write("<html>\n<embed src = \"" 
			+ SVGFileName 
			+ "\" width = \"" + ((ASTInt)jjtGetChild(0)).val 
			+ "\" height = \"" + ((ASTInt)jjtGetChild(1)).val 
			+ "\" />\n</html>");
			HTMLFile.close();
		}
		catch(Exception e)
		{
			System.out.println("ERROR creating HTML file \"" + HTMLFileName + "\"");
		}
	}
}
