blob: 4bca0dfc3a2f4f9ee7d36f1ed05da1061d7ebe2b [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2020 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.moka.parametric.tasks;
import org.eclipse.papyrus.moka.engine.uml.scheduling.UMLRootExecution;
import org.eclipse.papyrus.moka.engine.uml.scheduling.UMLTaskExecutionFactory;
import org.eclipse.papyrus.moka.parametric.ParametricEvaluator;
import org.eclipse.papyrus.moka.parametric.PostParametricEvaluationTask;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.InstanceSpecification;
public class CausalParametricTaskExecutionFactory extends UMLTaskExecutionFactory{
/**
* Factory instance
*/
private static CausalParametricTaskExecutionFactory FACTORY;
/**
* Create (if required) and return the factory instance
*
* @return the task factory
*/
public static CausalParametricTaskExecutionFactory getInstance() {
if (FACTORY == null) {
FACTORY = new CausalParametricTaskExecutionFactory();
}
return FACTORY;
}
private ParametricEvaluator evaluator;
protected PostParametricEvaluationTask postEvalTask;
@Override
public UMLRootExecution<?> createRootExecution(Element executionRoot) {
RootParametricTaskExecution rootExecution = null;
if (executionRoot instanceof InstanceSpecification) {
rootExecution = new RootParametricTaskExecution(executionLoop, (InstanceSpecification) executionRoot);
rootExecution.setEvaluator(evaluator);
rootExecution.setPostEvalTask(postEvalTask);
return rootExecution;
}
return super.createRootExecution(executionRoot);
}
public ParametricEvaluator getEvaluator() {
return evaluator;
}
public void setEvaluator(ParametricEvaluator evaluator) {
this.evaluator = evaluator;
}
public PostParametricEvaluationTask getPostEvalTask() {
return postEvalTask;
}
public void setPostEvalTask(PostParametricEvaluationTask postEvalTask) {
this.postEvalTask = postEvalTask;
}
}