Programming-Language-Design / src / ast / expression / classes / UnaryMinus.java
UnaryMinus.java
Raw
package ast.expression.classes;

import ast.expression.AbstractExpression;
import ast.expression.Expression;
import visitor.Visitor;

public class UnaryMinus extends AbstractExpression {

    Expression value;

    public UnaryMinus(int line, int column, Expression value) {
        super(line, column);
        this.value = value;
    }

    public Expression getValue() {
        return value;
    }

    public void setValue(Expression value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "-" + getValue();
    }

    @Override
    public <TP, TR> TR accept(Visitor<TP, TR> v, TP param) {
        return v.visit(this, param);
    }
}