<commit_before>package eu.ydp.empiria.player.client.module.texteditor;

import com.google.gwt.json.client.JSONArray;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.xml.client.Element;
import com.google.inject.Inject;
import eu.ydp.empiria.player.client.module.*;
import eu.ydp.empiria.player.client.module.texteditor.presenter.TextEditorPresenter;
import eu.ydp.empiria.player.client.module.texteditor.structure.TextEditorBean;
import eu.ydp.gwtutil.client.gin.scopes.module.ModuleScoped;

public class TextEditorModule extends SimpleModuleBase implements IStateful, IUniqueModule, IActivity, ILifecycleModule {

	private final TextEditorPresenter presenter;
	private final StateEncoder stateEncoder;
	private final TextEditorBean textEditorBean;

	@Inject
	public TextEditorModule(@ModuleScoped TextEditorPresenter presenter, StateEncoder stateEncoder, TextEditorBean textEditorBean) {
		this.presenter = presenter;
		this.stateEncoder = stateEncoder;
		this.textEditorBean = textEditorBean;
	}

	@Override
	protected void initModule(Element element) {
		presenter.init(getModuleId());
	}

	@Override
	public void lock(boolean lock) {
		if (lock) {
		presenter.lock();
		} else {
			presenter.unlock();
		}
	}

	@Override
	public void reset() {
	}

	@Override
	public JSONArray getState() {
		String content = presenter.getContent();
		return stateEncoder.encodeState(content);
	}

	@Override
	public void setState(JSONArray newState) {
		String state = stateEncoder.decodeState(newState);
		presenter.setContent(state);
	}

	@Override
	public void markAnswers(boolean mark) {
		lock(mark);
	}

	@Override<commit_msg>[YPUB-6497] Resetting module state<commit_after>package eu.ydp.empiria.player.client.module.texteditor;

import com.google.gwt.json.client.JSONArray;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.xml.client.Element;
import com.google.inject.Inject;
import eu.ydp.empiria.player.client.module.*;
import eu.ydp.empiria.player.client.module.texteditor.presenter.TextEditorPresenter;
import eu.ydp.empiria.player.client.module.texteditor.structure.TextEditorBean;
import eu.ydp.gwtutil.client.gin.scopes.module.ModuleScoped;

public class TextEditorModule extends SimpleModuleBase implements IStateful, IUniqueModule, IActivity, ILifecycleModule {

	private final TextEditorPresenter presenter;
	private final StateEncoder stateEncoder;
	private final TextEditorBean textEditorBean;

	@Inject
	public TextEditorModule(@ModuleScoped TextEditorPresenter presenter, StateEncoder stateEncoder, TextEditorBean textEditorBean) {
		this.presenter = presenter;
		this.stateEncoder = stateEncoder;
		this.textEditorBean = textEditorBean;
	}

	@Override
	protected void initModule(Element element) {
		presenter.init(getModuleId());
	}

	@Override
	public void lock(boolean lock) {
		if (lock) {
			presenter.lock();
		} else {
			presenter.unlock();
		}
	}

	@Override
	public void reset() {
		presenter.setContent("");
	}

	@Override
	public JSONArray getState() {
		String content = presenter.getContent();
		return stateEncoder.encodeState(content);
	}

	@Override
	public void setState(JSONArray newState) {
		String state = stateEncoder.decodeState(newState);
		presenter.setContent(state);
	}

	@Override
	public void markAnswers(boolean mark) {
		lock(mark);
	}

	@Override
{'fraction_non_alphanumeric': 0.10072158749248346, 'fraction_numerical': 0.0012026458208057728, 'mean_word_length': 5.472762645914397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2894487', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1041, 'n_words': 203}