// FILE. . . . . /home/hak/hlt/src/hlt/osfv2/base/FloatConstant.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Mon Sep 02 16:47:11 2013

/**
 * This is the class for floating point number constants.
 *
 * @version     Last modified on Tue Jan 21 08:05:47 2014 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>
 */

package hlt.osf.base;

import hlt.osf.exec.Taxonomy;

public class FloatConstant extends Constant
  {
    /**
     * Constructs a new <tt>FloatConstant</tt> with the given value.
     */
    public FloatConstant (double value)
    {
      _sort = Taxonomy.FLOAT;
      _value = value;
    }

    /**
     * The value if this constant.
     */
    private double _value;

    /**
     * Return the value of this <tt>FloatConstant</tt>.
     */
    public double value ()
    {
      return _value;
    }

    /**
     * Returns <tt>true</tt> iff the specified object is a
     * <tt>FloatConstant</tt> carrying the same value as this one.
     */
    public boolean equals (Object other)
    {
      if (!(other instanceof FloatConstant))
	return false;

      return _value == ((FloatConstant)other).value();
    }

    /**
     * Returns a <tt>String</tt> representation of this
     * <tt>FloatConstant</tt>.
     */
    public String toString ()
    {
      return Double.toString(_value);
    }

    public String displayForm ()
    {
      return toString();
    }

  }