All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.epsilon.eol.concurrent.EolModuleParallel Maven / Gradle / Ivy

The newest version!
/*********************************************************************
 * Copyright (c) 2018 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.eol.concurrent;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.eclipse.epsilon.common.module.IModule;
import org.eclipse.epsilon.eol.EolModule;
import org.eclipse.epsilon.eol.execute.context.concurrent.EolContextParallel;
import org.eclipse.epsilon.eol.execute.context.concurrent.IEolContextParallel;

/**
 * 
 * @author Sina Madani
 * @since 1.6
 */
public class EolModuleParallel extends EolModule {
	
	public EolModuleParallel() {
		this(null);
	}
	
	public EolModuleParallel(IEolContextParallel context) {
		super(context != null ? context : new EolContextParallel());
	}
	
	@Override
	public IEolContextParallel getContext() {
		return (IEolContextParallel) super.getContext();
	}
	
	@Override
	protected HashMap> getImportConfiguration() {
		HashMap> importConfiguration = super.getImportConfiguration();
		importConfiguration.put("eol", EolModuleParallel.class);
		return importConfiguration;
	}
	
	
	protected static final Set CONFIG_PROPERTIES = new HashSet<>(2);
	static {
		CONFIG_PROPERTIES.add(IEolContextParallel.NUM_THREADS_CONFIG);
	}
	
	/**
	 * WARNING: This method should only be called by the DT plugin for initialization purposes,
	 * as the context will be reset!
	 */
	@Override
	public void configure(Map properties) throws IllegalArgumentException {
		super.configure(properties);
		setContext(IEolContextParallel.configureContext(properties, EolContextParallel::new, getContext()));
	}
	
	@Override
	public Set getConfigurationProperties() {
		return CONFIG_PROPERTIES;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy