package evaluator;
import java.util.HashMap;
import java.util.Map;


public class Evaluator {
	Node mainNode;
	public Map<Character, MutableDouble> getKeys(){
		Map<Character, MutableDouble> map = new HashMap<Character, MutableDouble>();
		mainNode.addKeys(map);
		return map;
	}
	public void parse(String function){
		 mainNode = new Node(Lexer.lex(function));
		 mainNode.simplify();
	}
	
	public double evaluate(Map<Character, MutableDouble> varSet) throws Exception{
		return mainNode.eval(varSet);
	}
	public double evaluate() throws Exception{
		return mainNode.eval();
	}
	
	public String toString(){
		return mainNode.toString();
	}
	
	public void derive(Character key){
		mainNode = mainNode.derive(key);
		mainNode.simplify();
	}
	
	public static void main(String[] args){
		Evaluator eval = new Evaluator();
		eval.parse("X^2");
		eval.derive('X');
		System.out.println(eval.toString());
	}
}
@@ -737,167 +737,5 @@
 %0A%09%7D%0A
-%09%0A%09public static void main(String%5B%5D args)%7B%0A%09%09Evaluator eval = new Evaluator();%0A%09%09eval.parse(%22X%5E2%22);%0A%09%09eval.derive('X');%0A%09%09System.out.println(eval.toString());%0A%09%7D%0A
 %7D

delete tester method now handled by EvaluatorTest