package xl.expr;
/**
 * An Expr object represents a real valued expression that may contain variables. The
 * value of a variable is obtained from an Environment object by specifying the name of
 * the variable.
 *
 * @see Environment
 * @author Lennart Andersson
 */
public abstract class Expr {
    /**
     * The toString method returns a String representation of this
     * expression without unnecessary parentheses.
     *
     * @return the String representation of this expression.
     */
    public String toString() {
        return toString(0);
    }
    /*
     * toString(prec) returns a string representation of this expression without
     * unnecessary parentheses. The prec argument specifies the precedence level
     * enclosing expression and is used to control the precedence of
     * parentheses.
     */
    public abstract String toString(int prec);
    /**
     * The value method returns the value of this expression.
     *
     * @param env is the Environment containing the values of variables.
     * @return the double value of this expression.
     */
    public abstract double value(Environment env);
}