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

/**************************************************************

File				: ASTRepeat.java
Auther				: M. Spiller
Registration #		: Y0259667
Date				: Thursday 13th november 2003
Unit				: CMP-2A25 Programming - Software Development Techniques
Description			: Repeat class containing loop toregenerate objects

**************************************************************/

import java.io.*;

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

	public ASTRepeat(DrawPhase3 p, int id) 
	{
		super(p, id);
	}

    public void generate(FileWriter SVGFile, int Xsc, int Ysc, 
							int X, int Y, String colour, int brush)
    {
		//loop to repeat draw method
        for(int count = 0; count < ((ASTInt)jjtGetChild(2)).val; count++)
		{
			//applies increments to X and Y values
			int Xnew = X + ((ASTInt)jjtGetChild(0)).val * Xsc * count;
			int Ynew = Y + ((ASTInt)jjtGetChild(1)).val * Ysc * count;

			// generates object with incremented values
            jjtGetChild(3).generate(SVGFile, Xsc, Ysc, Xnew, Ynew, colour, brush);
		}
    }
}
