SortExpression.java

// FILE. . . . . /home/hak/hlt/src/hlt/osf/base/SortExpression.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hp-Dv7
// STARTED ON. . Mon Nov 05 19:13:27 2012



This is the mother class of all OSF sort expressions to be interpreted in a given context of a sort ordering. It is instantiated by specific classes corresponding to specific expressions.

Author:  Hassan Aït-Kaci
Copyright:  © by the author
Version:  Last modified on Thu Jan 17 18:11:20 2013 by hak



package hlt.osf.base;

import hlt.osf.exec.Context;
import hlt.osf.util.BitCode;
import hlt.osf.io.DisplayManager;



This is the class of all OSF sort expressions. It will always evaluate as a code, which then can be retrieved as an explicit sort or a disjunctive sort.


abstract public class SortExpression extends OsfExpression
  {
    /* ************************************************************************ */

    

This returns the type of Boolean expression this sort expression is; one of:
  • Context.SYM() if this is a sort symbol;
  • Context.DIS() if this is a disjunctive sort;
  • Context.NOT() if this is a negated sort expression;
  • Context.AND() if this is a sort-expression conjunction;
  • Context.OR () if this is a sort-expression disjunction;
  • Context.BNT() if this is a sort-expression complementation.


    abstract public byte type ();

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

    public boolean isSymbol ()
    {
      return type() == Context.SYM();
    }

    public boolean isDisjunction ()
    {
      return type() == Context.DIS();
    }

    public boolean isNot ()
    {
      return type() == Context.NOT();
    }

    public boolean isAnd ()
    {
      return type() == Context.AND();
    }

    public boolean isOr ()
    {
      return type() == Context.OR();
    }

    public boolean isButnot ()
    {
      return type() == Context.BNT();
    }

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

    

This is this sort expression's bit code in its context.


    private BitCode _value;

    

Returns this sort expression's bit code in its context.


    public BitCode value ()
    {
      return _value == null
	? (_value = _context.evaluate(this))
	: _value;
    }

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

    

This is the string form of this sort's (possibly disjunctive) maximal lower bound after it has been evaluated in its context.


    private String _maxLowerBound;

    

Returns the string form of this sort's (possibly disjunctive) maximal lower bound after it has been evaluated in its context.


    public String maxLowerBound ()
    {
      return _maxLowerBound == null
	? (_maxLowerBound = _context.decodedString(value()))
	: _maxLowerBound;
    }

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

    

This is a flag indicating whether this expression is parenthesized or not. This is used for rendering its original string form.


    private boolean _isParenthesized = false;

    

This returns whether or not this expression is parenthesized. This is used for rendering its original string form.


    public boolean isParenthesized ()
    {
      return _isParenthesized;
    }

    

This sets whether or not this expression is to be parenthesized. This is used for rendering its original string form.


    public SortExpression setParenthesized (boolean value)
    {
      _isParenthesized = value;
      return this;
    }

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

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


This file was generated on Wed Jan 30 13:26:29 CET 2013 from file SortExpression.java
by the hlt.language.tools.Hilite Java tool written by Hassan Aït-Kaci