//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// 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>
 */

import hlt.language.design.backend.Runtime;

public class JumpOnTrue extends Relocatable
{
  public JumpOnTrue ()
    {
      setName("JUMP_ON_TRUE");
    }

  public JumpOnTrue (int address)
    {
      setName("JUMP_ON_TRUE");
      _address = address;
    }

  public final void execute (Runtime r)
    {
      if (r.popBoolean())
        r.setIP(_address);
      else
        r.incIP();
    }

  public final Relocatable relocate (int address)
    {
      return new JumpOnTrue(address);
    }
}
