Class Term.Ref

  • Enclosing class:
    Term

    public static final class Term.Ref
    extends Term
    A reference to a Symbol.
    • Field Detail

      • symbol

        protected final Symbol symbol
    • Constructor Detail

      • Ref

        public Ref​(Symbol symbol)
    • Method Detail

      • getSymbol

        public Symbol getSymbol()
      • getVariable

        public Variable getVariable()
      • getRetType

        public int getRetType()
        Description copied from class: Term
        Gets the term's "natural" return type.
        Specified by:
        getRetType in class Term
        Returns:
        the type, should always be one of the TYPE_X constants defined in this class.
      • evalB

        public boolean evalB​(EvalEnv env)
        Description copied from class: Term
        Evaluates this term to a boolean value.
        Specified by:
        evalB in class Term
        Parameters:
        env - the application dependant environment.
        Returns:
        a boolean value
      • evalI

        public int evalI​(EvalEnv env)
        Description copied from class: Term
        Evaluates this term to an int value.
        Specified by:
        evalI in class Term
        Parameters:
        env - the application dependant environment.
        Returns:
        an int value
      • evalD

        public double evalD​(EvalEnv env)
        Description copied from class: Term
        Evaluates this term to a double value.
        Specified by:
        evalD in class Term
        Parameters:
        env - the application dependant environment.
        Returns:
        a double value
      • evalS

        public String evalS​(EvalEnv env)
        Description copied from class: Term
        Evaluates this term to a String value. The default implementation simply returns the value of Term.toString().
        Overrides:
        evalS in class Term
        Parameters:
        env - the application dependant environment.
        Returns:
        a String value
      • toString

        public String toString()
        Description copied from class: Term
        Returns a string representation of this term which can be used for debugging.
        Specified by:
        toString in class Term
      • accept

        public <T> T accept​(TermVisitor<T> visitor)
        Description copied from class: Term
        Visitor support.
        Specified by:
        accept in class Term
        Parameters:
        visitor - A visitor.
      • isConst

        public boolean isConst()
        Specified by:
        isConst in class Term
        Returns:
        true, if this term evaluates to the same constant value regardless of any EvalEnv, even null.
      • compare

        public int compare​(Term other)
        Specified by:
        compare in class Term
      • pre

        public int pre()
        Specified by:
        pre in class Term