<commit_before>package org.yakindu.sct.simulation.ui.model.presenter;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.ecore.EObject;
import org.yakindu.sct.model.sexec.ReactionFired;
import org.yakindu.sct.model.sexec.Trace;
import org.yakindu.sct.model.sexec.TraceStateEntered;
import org.yakindu.sct.model.sexec.TraceStateExited;
import org.yakindu.sct.model.sgraph.Vertex;
import org.yakindu.sct.simulation.core.runtime.IExecutionContext;

import de.itemis.gmf.runtime.commons.highlighting.HighlightingParameters;

/**
 * @author <NAME> - Initial contribution and API
 * 
 */
public class DefaultDynamicNotationHandler extends AbstractDynamicNotationHandler {

	private static final HighlightingParameters TRANSITION_PARAMS = new HighlightingParameters(
			0, ColorConstants.darkGreen, ColorConstants.gray, false);

	private EObject lastTakenTransition = null;

	public void restoreNotationState(IExecutionContext context) {
		for (Vertex vertex : context.getAllActiveStates()) {
			getHighlightingSupport().fadeIn(vertex,
					HighlightingParameters.DEFAULT);
		}
		getHighlightingSupport().fadeIn(lastTakenTransition, TRANSITION_PARAMS);

	}

	public void visualizeStep(final TraceStateEntered trace) {
		getHighlightingSupport().fadeIn(
				((TraceStateEntered) trace).getState().getSourceElement(),
				HighlightingParameters.DEFAULT);
	}

	public void visualizeStep(final TraceStateExited trace) {
		getHighlightingSupport().fadeOut(
				((TraceStateExited) trace).getState().getSourceElement(),
				HighlightingParameters.DEFAULT);
	}

	public void visualizeStep(final ReactionFired trace) {
		EObject transition = trace.getReaction().getSourceElement();
		if (lastTakenTransition != null) {
			getHighlightingSupport().fadeOut(lastTakenTransition,
					TRANSITION_PARAMS);
		}
		getHighlightingSupport().fadeIn(transition, TRANSITION_PARAMS);
		lastTakenTransition = transition;
	}

	// dispatch
	public void visualizeStep(final Trace trace) {
		if (trace instanceof TraceStateEntered)
			visualizeStep((TraceStateEntered) trace);
		if (trace instanceof TraceStateExited)
			visualizeStep((TraceStateExited) trace);
		if (trace instanceof ReactionFired)
			visualizeStep((ReactionFired) trace);
	}
}<commit_msg>Last check in for this year ;-) <commit_after>package org.yakindu.sct.simulation.ui.model.presenter;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.ecore.EObject;
import org.yakindu.sct.model.sexec.ReactionFired;
import org.yakindu.sct.model.sexec.Trace;
import org.yakindu.sct.model.sexec.TraceNodeExecuted;
import org.yakindu.sct.model.sexec.TraceStateEntered;
import org.yakindu.sct.model.sexec.TraceStateExited;
import org.yakindu.sct.model.sgraph.Vertex;
import org.yakindu.sct.simulation.core.runtime.IExecutionContext;

import de.itemis.gmf.runtime.commons.highlighting.HighlightingParameters;

/**
 * @author <NAME> - Initial contribution and API
 * @author <NAME> - Additions
 * 
 */
public class DefaultDynamicNotationHandler extends AbstractDynamicNotationHandler {

	private static final HighlightingParameters TRANSITION_PARAMS = new HighlightingParameters(
			0, ColorConstants.darkGreen, ColorConstants.gray, false);

	private List<EObject> lastTransitionPath = new ArrayList<EObject>();

	public void restoreNotationState(IExecutionContext context) {
		for (Vertex vertex : context.getAllActiveStates()) {
			getHighlightingSupport().fadeIn(vertex,
					HighlightingParameters.DEFAULT);
		}
		for (EObject obj : lastTransitionPath) {
			getHighlightingSupport().fadeIn(obj, TRANSITION_PARAMS);
		}

	}

	public void visualizeStep(final TraceStateEntered trace) {
		getHighlightingSupport().fadeIn(
				((TraceStateEntered) trace).getState().getSourceElement(),
				HighlightingParameters.DEFAULT);
	}

	public void visualizeStep(final TraceStateExited trace) {
		getHighlightingSupport().fadeOut(
				((TraceStateExited) trace).getState().getSourceElement(),
				HighlightingParameters.DEFAULT);
		
		for (EObject obj : lastTransitionPath) {
			getHighlightingSupport().fadeOut(obj, TRANSITION_PARAMS);
		}
		lastTransitionPath.clear();
	}

	public void visualizeStep(final ReactionFired trace) {
		EObject transition = trace.getReaction().getSourceElement();
//		if (lastTransitionPath != null) {
//			getHighlightingSupport().fadeOut(lastTransitionPath,
//					TRANSITION_PARAMS);
//		}
		getHighlightingSupport().fadeIn(transition, TRANSITION_PARAMS);
		lastTransitionPath.add(transition);
	}

	public void visualizeStep(final TraceNodeExecuted trace) {
		EObject node = trace.getNode().getSourceElement();
//		getHighlightingSupport().flash(node, HighlightingParameters.DEFAULT);
		getHighlightingSupport().fadeIn(node, TRANSITION_PARAMS);
		lastTransitionPath.add(node);
	}

	// dispatch
	public void visualizeStep(final Trace trace) {
		if (trace instanceof TraceStateEntered)
			visualizeStep((TraceStateEntered) trace);
		if (trace instanceof TraceStateExited)
			visualizeStep((TraceStateExited) trace);
		if (trace instanceof ReactionFired)
			visualizeStep((ReactionFired) trace);
		if (trace instanceof TraceNodeExecuted)
			visualizeStep((TraceNodeExecuted) trace);
	}
}
{'fraction_non_alphanumeric': 0.1027068535227491, 'fraction_numerical': 0.0007679017085813016, 'mean_word_length': 5.928191489361702, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '1380161', 'n_tokens_mistral': 1750, 'n_tokens_neox': 1566, 'n_words': 279}