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

/**
 * This is the class for boolean constants.
 *
 * @version     Last modified on Tue Jan 21 08:05:36 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 BooleanConstant extends Constant
  {
    /**
     * Constructs a new <tt>BooleanConstant</tt> with the given value.
     */
    public BooleanConstant (boolean value)
    {
      _sort = Taxonomy.BOOLEAN;
      _value = value;
    }

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

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

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

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

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

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

  }