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

import java.io.*;

public class ASTProgram extends SimpleNode 
{
	/*************************************************

					Constructor
	
	*************************************************/
	
	public ASTProgram(int id) 
	{
    	super(id);
  	}

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

	Loops through all the children of the program node
	and prints them out to the console in SVG code format
	
	*************************************************/

  	public void generate()
  	{
    	int test = sizeOfChild();
		String picture;
    	String[] temp = new String[test];

		picture = jjtGetChild(0).generateSVG();
		
	   	System.out.println(picture);
	   	
		for(int i = 1; i < sizeOfChild(); i++)
    	{
        	System.out.println(jjtGetChild(i).generateSVG());
    	}
   		System.out.println("</svg>");
    
   	}
   	
   	/*************************************************

	Generates the SVG file containing all the children
	of the root program node.
	
	*************************************************/
   	
   	public void generateFile()
   	{
   	   	String file = "test.svg";
    	
    	try
    	{
    		FileWriter fw = new FileWriter (file);
		    BufferedWriter bw = new BufferedWriter (fw);
		    PrintWriter outFile = new PrintWriter (bw);
		    
		    outFile.println(jjtGetChild(0).generateSVG());
		    
		    for(int i = 1; i < sizeOfChild(); ++i)
    		{
        		outFile.println(jjtGetChild(i).generateSVG());
    		}
    		
   			outFile.println("</svg>");
   			outFile.println("");
   			
   			outFile.close();
    
    		System.out.println("Output to file " + file);
  		}
  
  		catch(IOException exception)
  		{ 
    		System.out.print("Error: " + exception); 
			System.exit(1); 
  		}
   	}
   	
   	/*************************************************

	Methods needed by Node interface
	
	*************************************************/
   	
   	public int getBrush()
  	{
  		return 0;
  	}
  	 
  	 public String getColour()
  	{
  		return null;
  	}
  	
  	public String getParentType()
  	{
  		return null;
  	}
  	
  	public int getOffsetX()
  	{
  		return 0;
  	}
  
  	public int getOffsetY()
	{
  		return 0;
  	}
  	
  	public int getScaleX()
  	{
  		return 0;
  	}
  
  	public int getScaleY()
  	{
  		return 0;
  	}
  	
  	public int getRepeatX()
  	{
  		return 0;
  	}
  	
  	public int getRepeatY()
  	{
  		return 0;
  	}
  	
  	public int getNoRepeat()
  	{
  		return 0;
  	}
}
