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

public class ASTColour extends SimpleNode 
{
	String colour;
	
	/*************************************************

					Constructors

	*************************************************/
	
	public ASTColour(int id) 
	{
    	super(id);
  	}

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

	Loops through the children of the colour node and
	prints each one out to the console

	*************************************************/
  
  	public void generate()
  	{
  		int i, k = jjtGetNumChildren();
  		
  		colour = ((ASTLiteral) jjtGetChild(0)).name;
  		
  		/*************************************************

		if the first child is not a colour element then begin
		loop of shapes with first child

		*************************************************/
  		
  		if(colour.equals("null"))
  		{
  		   	for (i = 0; i < k; i++)
  		   	{
        		System.out.println(jjtGetChild(i).generateSVG());
        	
        	}
        }
        
        /*************************************************

		if first child is colour, begin loop with second child

		*************************************************/
        else
        {
        	for (i = 1; i < k; i++)
        	{
        		System.out.println(jjtGetChild(i).generateSVG());
        	}
        }
  		  		 		
  	}
  	
  	/*************************************************

	Method similar to above, except returns a string containing
	code rather than printing to console

	*************************************************/
  	
  	public String generateSVG()
  	{
  		int i, k = jjtGetNumChildren();
  		String temp ="";
  		
  		colour = ((ASTLiteral) jjtGetChild(0)).name;
  		
  		if(colour.equals("null"))
  		{
  			for (i = 0; i < k; i++)
     		{
        		temp = temp + jjtGetChild(i).generateSVG();
        	}
        }
        
        else
        {
        	for (i = 1; i < k; i++)
     		{
        		temp = temp + jjtGetChild(i).generateSVG();
        	}
        }
  		
  		return temp;
  	}
  	
  	/*************************************************

	Methods required by Node interface

	*************************************************/
  	
   	public int getBrush()
  	{
  		return 0;
  	}
  	
  	/*************************************************

	Returns the colour given by the user

	*************************************************/
  	
  	public String getColour()
  	{
    	colour = ((ASTLiteral) jjtGetChild(0)).name;
    	
    	return colour;
  	}
  	
  	/*************************************************

	Returns the node type for distinction between colour,
	brush, offset, scale and repeat

	*************************************************/
  	
  	public String getParentType()
  	{
  		String type = "colour";
  		
  		return type;
  	}
  	
  	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;
  	}
  	
}
