//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// PLEASE DO NOT EDIT WITHOUT THE EXPLICIT CONSENT OF THE AUTHOR! \\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\

package hlt.language.design.instructions;

/**
 * @version     Last modified on Wed Jun 20 14:29:51 2012 by hak
 * @author      <a href="mailto:hak@acm.org">Hassan A&iuml;t-Kaci</a>
 * @copyright   &copy; <a href="http://www.hassan-ait-kaci.net/">by the author</a>
 * @copyright   &copy; 2000-2002 <a href="http://www.hlt.fr/">HLT, S.A.</a>
 */

import hlt.language.design.backend.Runtime;
import hlt.language.design.backend.RuntimeSet;

public class NextRealCircOffSet extends Instruction
{
  public NextRealCircOffSet ()
    {
      setName("NEXT_C_R_OFFSET");
    }

  public final void execute (Runtime r)
    {
      RuntimeSet set = (RuntimeSet)r.popObject("can't access the element of a null set");
      int cpt = r.popInt();
      double value = r.popReal();
      int i = 0;
      while (i < cpt) {       
        value = set.nextc(value); 
        i++;
      }
      r.pushReal(value);
      r.incIP();
    }
}
