blob: 84fb51dff41879a5d266902d9839d699233e1075 [file] [log] [blame]
/**
* Copyright (c)2020 CEA LIST, Committer Name, 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
* Gabriel Pedroza (CEA LIST) gabriel.pedroza@cea.fr
*
*/
package org.eclipse.papyrus.pdp4eng.designer.engine.api;
import org.eclipse.papyrus.pdp4eng.designer.engine.api.internal.StrategyEngine;
/**
* Req003.002: the engine shall be a singleton.
*
*/
public class StrategyEngineFactory {
protected IStrategyEngine strategyEngine;
private StrategyEngineFactory() {
super();
}
private static StrategyEngineFactory instance=null;
public static StrategyEngineFactory getInstance() {
if( instance==null) {
instance= new StrategyEngineFactory();
}
return instance;
}
/**
*
* @return get the current engine
*/
public IStrategyEngine getCurrentEngine() {
if( strategyEngine==null) {
createEngine();
}
return strategyEngine;
}
/**
* create a default engine
* if you want to instanciate an new engine, you can inherit and add your own method of engine creation :D
*/
public void createEngine() {
strategyEngine= new StrategyEngine();
}
}