| /********************************************************************* |
| * Copyright (c) 2019 The University of York. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| **********************************************************************/ |
| package org.eclipse.epsilon.executors; |
| |
| import org.eclipse.epsilon.executors.ecl.EclExecutor; |
| import org.eclipse.epsilon.executors.egl.EglExecutor; |
| import org.eclipse.epsilon.executors.egl.EgxExecutor; |
| import org.eclipse.epsilon.executors.eol.EolExecutor; |
| import org.eclipse.epsilon.executors.etl.EtlExecutor; |
| import org.eclipse.epsilon.executors.evl.EvlExecutor; |
| |
| |
| /** |
| * A factory for the different executors. |
| * |
| * @author Horacio Hoyos Rodriguez |
| */ |
| public class EpsilonEngineExecutorFactory { |
| |
| @SuppressWarnings("unchecked") |
| public <E extends IEpsilonLanguageExecutor> E getExecutor(String engineName) { |
| |
| switch (engineName.substring(0, 3).toUpperCase()) { |
| case "ECL": |
| return (E) new EclExecutor(); |
| case "EGL": |
| return (E) new EglExecutor(); |
| case "EGX": |
| return (E) new EgxExecutor(); |
| case "EOL": |
| return (E) new EolExecutor(); |
| case "ETL": |
| return (E) new EtlExecutor(); |
| case "EVL": |
| return (E) new EvlExecutor(); |
| default: |
| return null; |
| } |
| } |
| |
| } |