<commit_before>package hu.bme.mit.trainbenchmark.benchmark.viatra.operations;

import java.util.Optional;

import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;

import hu.bme.mit.trainbenchmark.benchmark.operations.ModelOperation;
import hu.bme.mit.trainbenchmark.benchmark.operations.ModelOperationFactory;
import hu.bme.mit.trainbenchmark.benchmark.viatra.ActiveRouteMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.ConnectedSegmentsMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.PosLengthMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.RouteSensorMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.SemaphoreNeighborMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.SwitchMonitoredMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.SwitchSetMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.driver.ViatraDriver;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuery;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryActiveRoute;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryConnectedSegments;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryPosLength;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryRouteSensor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuerySemaphoreNeighbor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuerySwitchMonitored;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuerySwitchSet;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.ViatraTransformation;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairConnectedSegments;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairPosLength;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairRouteSensor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairSemaphoreNeighbor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairSwitchMonitored;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairSwitchSet;
import hu.bme.mit.trainbenchmark.constants.RailwayOperation;

public class ViatraModelOperationFactory extends ModelOperationFactory<BasePatternMatch, ViatraDriver> {

	protected ViatraModelOperationFactory() {

	}

	public static ViatraModelOperationFactory create() {
		return new ViatraModelOperationFactory();
	}

	@Override
	public ModelOperation<? extends BasePatternMatch, ViatraDriver> createOperation(
			final RailwayOperation operationEnum, final Optional<String> workspaceDir, final ViatraDriver driver)
					throws Exception {

		switch (operationEnum) {
		// ActiveRoute
		case ACTIVEROUTE: {
			final ViatraQuery<ActiveRouteMatch> query = new ViatraQueryActiveRoute(driver);
			final ModelOperation<ActiveRouteMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		
		// ConnectedSegments
		case CONNECTEDSEGMENTS: {
			final ViatraQuery<ConnectedSegmentsMatch> query = new ViatraQueryConnectedSegments(driver);
			final ModelOperation<ConnectedSegmentsMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case CONNECTEDSEGMENTS_INJECT: {
			// TODO

		}
		case CONNECTEDSEGMENTS_REPAIR: {
			final ViatraQuery<ConnectedSegmentsMatch> query = new ViatraQueryConnectedSegments(driver);
			final ViatraTransformationRepairConnectedSegments transformation = new ViatraTransformationRepairConnectedSegments(
					driver);
			final ModelOperation<ConnectedSegmentsMatch, ViatraDriver> operation = ModelOperation.of(query,
					transformation);
			return operation;
		}

			// PosLength
		case POSLENGTH: {
			final ViatraQuery<PosLengthMatch> query = new ViatraQueryPosLength(driver);
			final ModelOperation<PosLengthMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case POSLENGTH_INJECT: {
			// TODO
		}
		case POSLENGTH_REPAIR: {
			final ViatraQuery<PosLengthMatch> query = new ViatraQueryPosLength(driver);
			final ViatraTransformation transformation = new ViatraTransformationRepairPosLength(driver);
			final ModelOperation<PosLengthMatch, ViatraDriver> operation = ModelOperation.of(query, transformation);
			return operation;

		}

			// RouteSensor
		case ROUTESENSOR: {
			final ViatraQuery<RouteSensorMatch> query = new ViatraQueryRouteSensor(driver);
			final ModelOperation<RouteSensorMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case ROUTESENSOR_INJECT: {
			// TODO
		}
		case ROUTESENSOR_REPAIR: {
			final ViatraQuery<RouteSensorMatch> query = new ViatraQueryRouteSensor(driver);
			final ViatraTransformationRepairRouteSensor transformation = new ViatraTransformationRepairRouteSensor(
					driver);
			final ModelOperation<RouteSensorMatch, ViatraDriver> operation = ModelOperation.of(query, transformation);
			return operation;
		}

			// SemaphoreNeighbor
		case SEMAPHORENEIGHBOR: {
			final ViatraQuery<SemaphoreNeighborMatch> query = new ViatraQuerySemaphoreNeighbor(driver);
			final ModelOperation<SemaphoreNeighborMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case SEMAPHORENEIGHBOR_INJECT: {
			// TODO
		}<commit_msg>Resolved warning<commit_after>package hu.bme.mit.trainbenchmark.benchmark.viatra.operations;

import java.util.Optional;

import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;

import hu.bme.mit.trainbenchmark.benchmark.operations.ModelOperation;
import hu.bme.mit.trainbenchmark.benchmark.operations.ModelOperationFactory;
import hu.bme.mit.trainbenchmark.benchmark.viatra.ActiveRouteMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.ConnectedSegmentsMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.PosLengthMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.RouteSensorMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.SemaphoreNeighborMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.SwitchMonitoredMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.SwitchSetMatch;
import hu.bme.mit.trainbenchmark.benchmark.viatra.driver.ViatraDriver;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuery;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryActiveRoute;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryConnectedSegments;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryPosLength;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQueryRouteSensor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuerySemaphoreNeighbor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuerySwitchMonitored;
import hu.bme.mit.trainbenchmark.benchmark.viatra.queries.ViatraQuerySwitchSet;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairConnectedSegments;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairPosLength;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairRouteSensor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairSemaphoreNeighbor;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairSwitchMonitored;
import hu.bme.mit.trainbenchmark.benchmark.viatra.transformations.repair.ViatraTransformationRepairSwitchSet;
import hu.bme.mit.trainbenchmark.constants.RailwayOperation;

public class ViatraModelOperationFactory extends ModelOperationFactory<BasePatternMatch, ViatraDriver> {

	protected ViatraModelOperationFactory() {

	}

	public static ViatraModelOperationFactory create() {
		return new ViatraModelOperationFactory();
	}

	@Override
	public ModelOperation<? extends BasePatternMatch, ViatraDriver> createOperation(
			final RailwayOperation operationEnum, final Optional<String> workspaceDir, final ViatraDriver driver)
					throws Exception {

		switch (operationEnum) {
		// ActiveRoute
		case ACTIVEROUTE: {
			final ViatraQuery<ActiveRouteMatch> query = new ViatraQueryActiveRoute(driver);
			final ModelOperation<ActiveRouteMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		
		// ConnectedSegments
		case CONNECTEDSEGMENTS: {
			final ViatraQuery<ConnectedSegmentsMatch> query = new ViatraQueryConnectedSegments(driver);
			final ModelOperation<ConnectedSegmentsMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case CONNECTEDSEGMENTS_INJECT: {
			// TODO

		}
		case CONNECTEDSEGMENTS_REPAIR: {
			final ViatraQuery<ConnectedSegmentsMatch> query = new ViatraQueryConnectedSegments(driver);
			final ViatraTransformationRepairConnectedSegments transformation = new ViatraTransformationRepairConnectedSegments(
					driver);
			final ModelOperation<ConnectedSegmentsMatch, ViatraDriver> operation = ModelOperation.of(query,
					transformation);
			return operation;
		}

			// PosLength
		case POSLENGTH: {
			final ViatraQuery<PosLengthMatch> query = new ViatraQueryPosLength(driver);
			final ModelOperation<PosLengthMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case POSLENGTH_INJECT: {
			// TODO
		}
		case POSLENGTH_REPAIR: {
			final ViatraQuery<PosLengthMatch> query = new ViatraQueryPosLength(driver);
			final ViatraTransformationRepairPosLength transformation = new ViatraTransformationRepairPosLength(driver);
			final ModelOperation<PosLengthMatch, ViatraDriver> operation = ModelOperation.of(query, transformation);
			return operation;

		}

			// RouteSensor
		case ROUTESENSOR: {
			final ViatraQuery<RouteSensorMatch> query = new ViatraQueryRouteSensor(driver);
			final ModelOperation<RouteSensorMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case ROUTESENSOR_INJECT: {
			// TODO
		}
		case ROUTESENSOR_REPAIR: {
			final ViatraQuery<RouteSensorMatch> query = new ViatraQueryRouteSensor(driver);
			final ViatraTransformationRepairRouteSensor transformation = new ViatraTransformationRepairRouteSensor(
					driver);
			final ModelOperation<RouteSensorMatch, ViatraDriver> operation = ModelOperation.of(query, transformation);
			return operation;
		}

			// SemaphoreNeighbor
		case SEMAPHORENEIGHBOR: {
			final ViatraQuery<SemaphoreNeighborMatch> query = new ViatraQuerySemaphoreNeighbor(driver);
			final ModelOperation<SemaphoreNeighborMatch, ViatraDriver> operation = ModelOperation.of(query);
			return operation;
		}
		case SEMAPHORENEIGHBOR_INJECT: {
			// TODO
		}
{'fraction_non_alphanumeric': 0.08102620893318568, 'fraction_numerical': 0.0, 'mean_word_length': 6.541405706332638, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, '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': '3757507', 'n_tokens_mistral': 3680, 'n_tokens_neox': 3416, 'n_words': 483}