// FILE. . . . . /home/hak/hlt/src/hlt/osfv2/base/NotSortExpression.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Mon Sep 02 09:15:10 2013

/**
 * @version     Last modified on Tue Jan 21 08:05:50 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;

/**
 * This is the class of a 'not' sort expression. It consists of a sort
 * expression which is its argument.
 */
public class NotSortExpression extends SortExpression
  {
    public NotSortExpression (SortExpression arg)
    {
      _arg = arg;
      _context = arg.context();
    }

    private SortExpression _arg;

    public SortExpression arg ()
    {
      return _arg;
    }

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

    public String displayForm ()
    {
      String form = "!"+_arg.displayForm();
      return isParenthesized() ? "("+form+")" : form;
    }

    public boolean equals (Object other)
    {
      if (!(other instanceof NotSortExpression))
	return false;

      return _arg.equals(((NotSortExpression)other).arg());
    }
  }
