package background;

import background.expressions.*;

public class ExpressionInterpreter {
	public VariableManager variableManager;
	
	public ExpressionInterpreter(VariableManager vm) {
		variableManager = vm;
		initializeEI();
	}
	
	public void initializeEI() {
		variableManager.addVariable("false", "boolean", "false", false);
		variableManager.addVariable("true", "boolean", "true", false);
		variableManager.getVariableByName("true").initialized = true;
		variableManager.getVariableByName("false").initialized = true;
	}
	
	
	public Integer interpretMath(String s) {
		MathTree mat = new MathTree(s, variableManager);
		return mat.getTreeValue();
	}
	
	public Boolean interpretLogic(String s) {
		LogicalTree log = new LogicalTree(s, variableManager);
		return log.getTreeValue();
	}

	public String interpretString(String s) {
		StringProcess sp = new StringProcess(s, variableManager);
		return sp.getStringValue();
	}

	public MathTree getMath(String s) {
		return new MathTree(s, variableManager);
	}
	
	public LogicalTree getLogic(String s) {
		return new LogicalTree(s, variableManager);
	}

	public StringProcess getString(String s) {
		return new StringProcess(s, variableManager);
	}

	
}
