<commit_before>import java.awt.Color;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Function {

	public String name;
	public String string = "";
	public Color color = Color.BLUE;
	public int thickness = 2;
	public boolean enabled = true;

	private static ScriptEngineManager mgr = new ScriptEngineManager();
	private static ScriptEngine engine = mgr.getEngineByName("JavaScript");

	public Function(String newName) {
		name = newName;
	}

	public Function(Map<String, Object> map) {
		name = (String) map.get("Name");
		string = (String) map.get("String");
		color = new Color(((Number) map.get("Color RGB")).intValue());
		thickness = ((Number) map.get("Thickness")).intValue();
		enabled = (boolean) map.get("Enabled");
	}
	
	public double evaluate(double x) {
		try {
			return ((Number) engine.eval(string.replace("x", "(" + Double.toString(x) + ")"))).doubleValue();
		} catch (ScriptException e) {
			// TODO: The error message below is displayed once for every horizontal pixel. Fix it.
			// JOptionPane.showMessageDialog(Main.window, "Something's wrong with the function", "Error", JOptionPane.ERROR_MESSAGE);
//			e.printStackTrace();
			return 0;
		}
	}

	@Override
	public String toString() {
		return name;
	}
}<commit_msg>Removed Function(Map)<commit_after>import java.awt.Color;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Function {

	public String name;
	public String string = "";
	public Color color = Color.BLUE;
	public int thickness = 2;
	public boolean enabled = true;

	private static ScriptEngineManager mgr = new ScriptEngineManager();
	private static ScriptEngine engine = mgr.getEngineByName("JavaScript");

	public Function(String newName) {
		name = newName;
	}
	
	public double evaluate(double x) {
		try {
			return ((Number) engine.eval(string.replace("x", "(" + Double.toString(x) + ")"))).doubleValue();
		} catch (ScriptException e) {
			// TODO: The error message below is displayed once for every horizontal pixel. Fix it.
			// JOptionPane.showMessageDialog(Main.window, "Something's wrong with the function", "Error", JOptionPane.ERROR_MESSAGE);
//			e.printStackTrace();
			return 0;
		}
	}

	@Override
	public String toString() {
		return name;
	}
}
{'fraction_non_alphanumeric': 0.1274868047097036, 'fraction_numerical': 0.0016240357287860333, 'mean_word_length': 4.6255707762557075, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3780418', 'n_tokens_mistral': 776, 'n_tokens_neox': 722, 'n_words': 208}