// FILE. . . . . /home/hak/hlt/src/hlt/osf/base/Constant.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Mon Sep 02 16:25:40 2013

/**
 * This is class for constants of a built-in sort. It defines constants
 * of built-in sorts, such as integers, floating-point numbers,
 * booleans, strings, . It is an abstract class because it does not
 * itself carry the value of such an constant. This is done by a
 * concrete subclass of <tt>Constant</tt>, depending on the type of
 * value of the constant. Here are the concrete subclasses of
 * <tt>Constant</tt>:
 *
 * <ol>
 *
 * <li><tt><a href="IntegerConstant.html">IntegerConstant</a></tt>, the
 * class of objects carrying an integer value (<i>i.e.</i>, an
 * <tt>int</tt>); </li>
 *
 * <li><tt><a href="CharConstant.html">CharConstant</a></tt>, the class
 * of objects carrying a character value (<i>i.e.</i>, a <tt>char</tt>);
 * </li>
 *
 * <li><tt><a href="FloatConstant.html">FloatConstant</a></tt>, the
 * class of objects carrying a double-precision floating point value
 * (<i>i.e.</i>, a <tt>double</tt>); </li>
 *
 * <li><tt><a href="StringConstant.html">StringConstant</a></tt>, the
 * class of objects carrying a <tt>string</tt> value; </li>
 *
 * <li><tt><a href="BooleanConstant.html">BooleanConstant</a></tt>, the
 * class of objects carrying a <tt>boolean</tt> value (<i>i.e.</i>,
 * <tt>true</tt> or <tt>false</tt>); </li>
 *
 * </ol>
 *
 * @version     Last modified on Mon May 18 08:46:01 2015 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;

public abstract class Constant
  {
    protected Sort _sort;

    public Sort sort ()
    {
      return _sort;
    }

    public boolean isInteger ()
    {
      return _sort.name() == "int";
    }
    
    public boolean isChar ()
    {
      return _sort.name() == "char";
    }
    
    public boolean isFloat ()
    {
      return _sort.name() == "float";
    }
    
    public boolean isString ()
    {
      return _sort.name() == "string";
    }

    public boolean isBoolean ()
    {
      return _sort.name() == "boolean";
    }

    public abstract String displayForm ();
    
  }