//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// 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 PushValueReal extends Instruction implements PushValue, PushReal
{
  private double _value;

  public PushValueReal ()
    {
      setName("PUSH_R");
    }

  public PushValueReal (double value)
    {
      setName("PUSH_R");
      _value = value;
    }

  final double value ()
    {
      return _value;
    }

  final void setValue (double value)
    {
      _value = value;
    }

  public final void execute (Runtime r)
    {
      r.pushReal(_value);
      r.incIP();
    }

  public final boolean equals (Object object)
    {
      if (this == object)
        return true;

      if (!(object instanceof PushValueReal))
        return false;

      return _value == ((PushValueReal)object).value();
    }

  public final int hashCode ()
    {
      return name().hashCode() + 100*(int)_value;
    }

  public final String toString ()
    {
      return name() + "(" + _value + ")";
    }
}
