<commit_before>package monitoring.impl.monitors;

import structure.impl.NonSimpleNonDetQEA;
import structure.impl.Verdict;

public class IncrementalNonSimpleNonDetQEAMonitor extends
		IncrementalNonSimpleQEAMonitor<NonSimpleNonDetQEA> {

	public IncrementalNonSimpleNonDetQEAMonitor(NonSimpleNonDetQEA q) {
		super(q);
		// TODO Auto-generated constructor stub
	}

	@Override
	public Verdict step(int eventName, Object[] args) {
		// TODO Auto-generated method stub
		return null;<commit_msg>Method step(int eventName, Object[] args) implemented<commit_after>package monitoring.impl.monitors;

import java.util.IdentityHashMap;

import monitoring.impl.configs.NonDetConfig;
import structure.impl.NonSimpleNonDetQEA;
import structure.impl.Verdict;

/**
 * 
 * @author <NAME>
 * @author <NAME>
 */
public class IncrementalNonSimpleNonDetQEAMonitor extends
		IncrementalNonSimpleQEAMonitor<NonSimpleNonDetQEA> {

	private IdentityHashMap<Object, NonDetConfig> bindings;

	public IncrementalNonSimpleNonDetQEAMonitor(NonSimpleNonDetQEA qea) {
		super(qea);
		bindings = new IdentityHashMap<>();
	}

	@Override
	public Verdict step(int eventName, Object[] args) {

		boolean existingBinding = false;
		NonDetConfig config;

		// Obtain the value for the quantified variable
		// Assumption: The (unique) quantified variable is present in all events
		// and its always the first argument
		Object quantifiedVar = args[0];

		// Determine if the value received corresponds to an existing binding
		if (bindings.containsKey(quantifiedVar)) { // Existing quantified
													// variable binding
			// Get current configuration for the binding
			config = bindings.get(quantifiedVar);

			// Assign flag for counters update
			existingBinding = true;

		} else { // New quantified variable binding

			// Create configuration for the new binding
			config = new NonDetConfig(qea.getInitialState(), qea.newBinding());
		}

		// Flag needed to update counters later
		boolean startConfigFinal = qea.containsFinalState(config);

		// Compute next configuration
		config = qea.getNextConfig(config, eventName, args);

		// Flag needed to update counters later
		boolean endConfigFinal = qea.containsFinalState(config);

		// Update/add configuration for the binding
		bindings.put(quantifiedVar, config);

		// If applicable, update counters
		if (existingBinding) {
			if (startConfigFinal && !endConfigFinal) {
				bindingsInNonFinalStateCount++;
				bindingsInFinalStateCount--;
			} else if (!startConfigFinal && endConfigFinal) {
				bindingsInNonFinalStateCount--;
				bindingsInFinalStateCount++;
			}
		} else {
			if (endConfigFinal) {
				bindingsInFinalStateCount++;
			} else {
				bindingsInNonFinalStateCount++;
			}
		}

		// According to the quantification of the variable, return verdict
		if (qea.isQuantificationUniversal() && allBindingsInFinalState()
				|| !qea.isQuantificationUniversal()
				&& existsOneBindingInFinalState()) {
			return Verdict.WEAK_SUCCESS;
		}
		return Verdict.WEAK_FAILURE;
{'fraction_non_alphanumeric': 0.08770764119601329, 'fraction_numerical': 0.0003322259136212625, 'mean_word_length': 4.494525547445256, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '832990', 'n_tokens_mistral': 985, 'n_tokens_neox': 850, 'n_words': 223}