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

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

public class Arithmetic extends AbstractExpression {

    Expression operand_1;
    Expression operand_2;
    String operator;

    public Arithmetic(int line, int column, Expression operand_1, String operator, Expression operand_2) {
        super(line, column);
        this.operand_1 = operand_1;
        this.operand_2 = operand_2;
        this.operator = operator;
    }

    public Expression getOperand_1() {
        return operand_1;
    }

    public Expression getOperand_2() {
        return operand_2;
    }

    public String getOperator() {
        return operator;
    }

    @Override
    public String toString() {
        return getOperand_1() + " " + getOperator() + " " + getOperand_2();
    }

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


}