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

public class ASTRepeat extends SimpleNode 
{
  int repeatPointer = 0;

  public ASTRepeat(int id) {
    super(id);
  }

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

  public String getType()
  {
    return "Repeat";
  }

  /*-----------------------------------------------*/
  /* Returns Repeat Offset X                       */
  /*-----------------------------------------------*/
  public int getRepeatValueX()
  {
    int repeatX = getRepeatX() + (repeatPointer * ((ASTInt) jjtGetChild(0)).val);
    return repeatX;
  }

  /*-----------------------------------------------*/
  /* Returns Repeat Offset Y                       */
  /*-----------------------------------------------*/
  public int getRepeatValueY()
  {
    int repeatY = getRepeatY() + (repeatPointer * ((ASTInt) jjtGetChild(1)).val);
    return repeatY;
  }

  /*-----------------------------------------------*/
  /* Loops through Children                        */
  /*-----------------------------------------------*/
  public String getString()
  {
    String children = "";
    int numberToRepeat = ((ASTInt) jjtGetChild(2)).val;

    for (repeatPointer = 0; repeatPointer < numberToRepeat; repeatPointer++)
    {
      for (int i=3; i < jjtGetNumChildren(); i++) 
      {
        children = children + jjtGetChild(i).getString();
      }
    }
    return children;    
  }
}
