// FILE. . . . . /home/hak/hlt/src/hlt/osfv1/base/SymbolSortExpression.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Mon Sep 02 09:16:49 2013

/**
 * @version     Last modified on Mon Sep 02 09:16:49 2013 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.Context;

/**
 * This is the class of atomic OSF expressions consisting of one sort
 * symbol name (a String).
 */
public class SymbolSortExpression extends SortExpression
  {
    /**
     * Constructs a symbol sort expression with the given name.
     */
    public SymbolSortExpression (String name)
    {
      _name = name.intern();
    }

    /**
     * Constructs a symbol sort expression with the given name and sets
     * its execution context to the given context.
     */
    public SymbolSortExpression (String name, Context context)
    {
      this(name);
      _context = context;
    }

    /* ************************************************************************ */

    private String _name;

    public String name ()
    {
      return _name;
    }

    public Sort sort ()
    {
      return _context.getSort(_name);
    }

    public byte type ()
    {
      return _context.SYM();
    }

    public String displayForm ()
    {
      return _name;
    }    
  }
