package ir2.td6;

import java.util.Stack;

import ir2.td6.tools.And;
import ir2.td6.tools.Not;
import ir2.td6.tools.Or;
import ir2.td6.tools.Parenthesis;
import ir2.td6.tools.Start__Expr;
import ir2.td6.tools.Value;
import ir2.td6.tools.Visitor;

public class BooleanVisitorToComplete extends Visitor<Void,Void,Void,Throwable> {
    private Stack<Boolean> stack = new Stack<Boolean>(); 
	
	@Override
	public Void visit(And and, Void param) throws Throwable {
		
		return null;
	}

	@Override
	public Void visit(Not not, Void param) throws Throwable {
		
		return null;
	}

	@Override
	public Void visit(Or or, Void param) throws Throwable {
		
		return null;
	}

	@Override
	public Void visit(Parenthesis parenthesis, Void param) throws Throwable {		
		return parenthesis.getExpr().accept(this, param);
	}

	@Override
	public Void visit(Start__Expr start__expr, Void param) throws Throwable {
		return start__expr.getExpr().accept(this, param);
	}

	@Override
	public Void visit(Value value, Void param) throws Throwable {
		stack.push(value.isVal());
		return null;
	}
	
    public boolean getResult(){
    	return stack.pop();
    }	
}
