<commit_before>package controller;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import simulationObjects.Turtle;
import commands.Command;
import compiler.Compiler;
import exceptions.ParsingException;
import exceptions.UnbalancedBracketsException;

public class MainController {
    private Compiler compiler = new Compiler();
    private Turtle turtle;
    private ArrayList<String> history = new ArrayList<String>();

    private Map<String, ArrayList<Command<Turtle, Void>>> cache = new HashMap<String, ArrayList<Command<Turtle, Void>>>();

    public void passInput(String input) throws ParsingException,
	    UnbalancedBracketsException {
	history.add(input);
	ArrayList<Command<Turtle, Void>> commands;

	if (cache.containsKey(input)) {
	    commands = cache.get(input);
	} else {
	    commands = compiler.compile(input);
	    cache.put(input, commands);
	}

	for (Command<Turtle, Void> c : commands) {
	    c.run(turtle);
	}
    }

    public Turtle getTurtle() throws FileNotFoundException {
	return new Turtle(turtle);
    }

    public ArrayList<String> getHistory() {
	return new ArrayList<String>(history);
    }
}<commit_msg>Separated view aspects and model aspects of Turtle into 2 separate classes. current Turtle.java will serve as model, TurtleView.java will serve as view<commit_after>package controller;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import simulationObjects.Turtle;
import commands.Command;
import compiler.Compiler;
import exceptions.ParsingException;
import exceptions.UnbalancedBracketsException;

public class MainController {
    private Compiler compiler = new Compiler();
    private Turtle turtle;
    private ArrayList<String> history = new ArrayList<String>();

    private Map<String, ArrayList<Command<Turtle, Void>>> cache = new HashMap<String, ArrayList<Command<Turtle, Void>>>();

    public void passInput(String input) throws ParsingException,
	    UnbalancedBracketsException {
	history.add(input);
	ArrayList<Command<Turtle, Void>> commands;

	if (cache.containsKey(input)) {
	    commands = cache.get(input);
	} else {
	    commands = compiler.compile(input);
	    cache.put(input, commands);
	}

	for (Command<Turtle, Void> c : commands) {
	    c.run(turtle);
	}
    }

    public Turtle getTurtle() {
    	return new Turtle(turtle);
    }

    public ArrayList<String> getHistory() {
    	return new ArrayList<String>(history);
    }
}
{'fraction_non_alphanumeric': 0.1042242400315831, 'fraction_numerical': 0.00039478878799842083, 'mean_word_length': 4.707207207207207, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '109045', 'n_tokens_mistral': 771, 'n_tokens_neox': 702, 'n_words': 190}