mirror of
https://github.com/Echtzeitsysteme/BioPMFramework.git
synced 2024-06-03 10:32:02 +00:00
First Configuration
This commit is contained in:
parent
bb4b69f7c9
commit
b60af5d825
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>de.tu.darmstadt.es.BiochemicalSimulationFramework.utils</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,11 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Utils
|
||||
Bundle-SymbolicName: de.tu.darmstadt.es.BiochemicalSimulationFramework.utils
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: de.tu.darmstadt.es.BiochemicalSimulationFramework,
|
||||
de.tu.darmstadt.es.KappaRules,
|
||||
de.tu.darmstadt.es.PatternMatchingEngine.democles,
|
||||
de.tu.darmstadt.es.PatternMatchingEngine.viatra
|
||||
Export-Package: de.tu.darmstadt.es.BiochemicalSimulationFramework.utils
|
|
@ -0,0 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -0,0 +1,30 @@
|
|||
package de.tu.darmstadt.es.BiochemicalSimulationFramework.utils;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
|
||||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.VIATRAEngine;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.SimulatorConfigurator;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.NaivePatternMatchingController;
|
||||
|
||||
|
||||
public class FrameworkHelper {
|
||||
|
||||
private static FrameworkHelper instance;
|
||||
|
||||
private FrameworkHelper() {
|
||||
|
||||
}
|
||||
|
||||
public static FrameworkHelper instance() {
|
||||
if(instance == null)
|
||||
instance = new FrameworkHelper();
|
||||
return instance;
|
||||
}
|
||||
|
||||
public SimulatorConfigurator getDefaultConfig(String packageName) {
|
||||
return new SimulatorConfigurator(packageName, new ResourceSetImpl(), NaivePatternMatchingController.class, VIATRAEngine.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -10,8 +10,7 @@ Export-Package: de.tu.darmstadt.es.biochemicalSimulationFramework,
|
|||
de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.modification,
|
||||
de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine,
|
||||
de.tu.darmstadt.es.biochemicalSimulationFramework.persistence,
|
||||
de.tu.darmstadt.es.biochemicalSimulationFramework.splitter,
|
||||
de.tu.darmstadt.es.biochemicalSimulationFramework.utils
|
||||
de.tu.darmstadt.es.biochemicalSimulationFramework.splitter
|
||||
Require-Bundle: de.tu.darmstadt.es.geolibrary.MetaSpecification,
|
||||
de.tu.darmstadt.es.KappaRules,
|
||||
org.eclipse.emf.ecore
|
||||
|
|
|
@ -1,11 +1,49 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.internal.splitter.HybridSplitter;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.internal.splitter.NoneSplitter;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.internal.utils.FrameworkFactory;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.HybridPatternMatchingController;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.PatternMatchingController;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.geolibrary.GeoLibrary;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.persistence.Persistence;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.splitter.Splitter;
|
||||
|
||||
public class SimulatorConfigurator {
|
||||
|
||||
public SimulatorConfigurator (String packageName, ResourceSet resourceSet, Splitter splitter, Class<? extends PatternMatchingController> pmControllerType, Class<? extends PatternMatchingEngine> engineType) {
|
||||
this(packageName, resourceSet, splitter, pmControllerType, engineType, null);
|
||||
}
|
||||
|
||||
public SimulatorConfigurator (String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingController> pmControllerType, Class<? extends PatternMatchingEngine> engineType) {
|
||||
this(packageName, resourceSet, null, pmControllerType, engineType, null);
|
||||
}
|
||||
|
||||
public SimulatorConfigurator (String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingController> pmControllerType, Class<? extends PatternMatchingEngine> engineType, Class<? extends GeoLibrary> geoLibType) {
|
||||
this(packageName, resourceSet, null, pmControllerType, engineType, geoLibType);
|
||||
}
|
||||
|
||||
public SimulatorConfigurator (String packageName, ResourceSet resourceSet, Splitter splitter,Class<? extends PatternMatchingController> pmControllerType, Class<? extends PatternMatchingEngine> engineType, Class<? extends GeoLibrary> geoLibType) {
|
||||
Splitter currentSplitter;
|
||||
if(splitter == null) {
|
||||
currentSplitter = new NoneSplitter();
|
||||
}else {
|
||||
currentSplitter = splitter;
|
||||
}
|
||||
|
||||
if(HybridPatternMatchingController.class.isAssignableFrom(pmControllerType)) {
|
||||
this.splitter = new HybridSplitter(currentSplitter);
|
||||
}
|
||||
else {
|
||||
this.splitter = currentSplitter;
|
||||
}
|
||||
|
||||
patternMatchingController = FrameworkFactory.instance().createPatternMatchingController(packageName, resourceSet, engineType, geoLibType, pmControllerType);
|
||||
}
|
||||
|
||||
private Splitter splitter;
|
||||
|
||||
private PatternMatchingController patternMatchingController;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.internal.geolibrary;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.geolibrary.GeoLibrary;
|
||||
|
||||
public class NoneGeoLibrary extends GeoLibrary {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.internal.splitter;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.splitter.Splitter;
|
||||
|
||||
public class HybridSplitter extends Splitter {
|
||||
private Splitter otherSplitter;
|
||||
|
||||
public HybridSplitter(Splitter other) {
|
||||
otherSplitter = other;
|
||||
}
|
||||
|
||||
public Splitter getOtherSplitter() {
|
||||
return otherSplitter;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.internal.splitter;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.splitter.Splitter;
|
||||
|
||||
public class NoneSplitter extends Splitter{
|
||||
|
||||
}
|
|
@ -5,9 +5,13 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
||||
import de.tu.darmstadt.es.KappaRules.KappaRuleContainer;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.PatternMatchingController;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.geolibrary.GeoLibrary;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public class FrameworkFactory {
|
||||
|
@ -24,28 +28,58 @@ public class FrameworkFactory {
|
|||
}
|
||||
|
||||
public <PM extends PatternMatchingEngine> PM createPatternMatchingEngine (String packageName, ResourceSet resourceSet, Class<PM> clazz) {
|
||||
|
||||
Optional<Constructor<?>> constructorMonad = Arrays.asList(clazz.getConstructors()).parallelStream().filter(this::findConstructor).findFirst();
|
||||
if(constructorMonad.isPresent()) {
|
||||
Constructor<?> constructor = constructorMonad.get();
|
||||
try {
|
||||
Object engine = constructor.newInstance(packageName,resourceSet);
|
||||
if(engine instanceof PatternMatchingEngine) {
|
||||
return clazz.cast(engine);
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||
| InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return create(clazz, packageName, resourceSet);
|
||||
}
|
||||
|
||||
public <PMC extends PatternMatchingController> PMC createPatternMatchingController (String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingEngine> engineType, Class<? extends GeoLibrary> geoLibType, Class<PMC> clazz) {
|
||||
if(geoLibType == null) {
|
||||
return create(clazz, packageName, resourceSet, engineType);
|
||||
}else {
|
||||
return create(clazz, packageName, resourceSet, engineType, geoLibType);
|
||||
}
|
||||
}
|
||||
|
||||
public <GL extends GeoLibrary> GL createGeoLibrary(Class<GL> clazz) {
|
||||
return create(clazz);
|
||||
}
|
||||
|
||||
private <T extends Object> T create (Class<T> clazz, Object... arguments) {
|
||||
List<Class<?>> paramTypeList = Arrays.asList(arguments).parallelStream().map(Object::getClass).collect(Collectors.toList());
|
||||
Optional<Constructor<?>> constructorMonad = findConstructor(clazz, paramTypeList);
|
||||
return create(constructorMonad, clazz, arguments);
|
||||
}
|
||||
|
||||
private <T extends Object> T create (Optional<Constructor<?>> constructorMonad, Class<T> clazz, Object... arguments) {
|
||||
if(constructorMonad.isPresent()){
|
||||
Constructor<?> constructor = constructorMonad.get();
|
||||
try {
|
||||
Object object = constructor.newInstance(arguments);
|
||||
if(clazz.isInstance(object)) {
|
||||
return clazz.cast(object);
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Optional<Constructor<?>> findConstructor(Class<?> clazz ,List<Class<?>> paramTypes){
|
||||
return Arrays.asList(clazz.getConstructors()).parallelStream().filter(constructor -> isConstructor(constructor, paramTypes)).findFirst();
|
||||
}
|
||||
|
||||
private boolean findConstructor(Constructor<?> constructor) {
|
||||
if(constructor.getParameterCount() == 2) {
|
||||
List<Class<?>> parameterTypes = Arrays.asList(constructor.getParameterTypes());
|
||||
return parameterTypes.stream().anyMatch(String.class::isAssignableFrom) && parameterTypes.stream().anyMatch(ResourceSet.class::isAssignableFrom);
|
||||
private boolean isConstructor(Constructor<?> constructor, List<Class<?>> paramTypes) {
|
||||
if(constructor.getParameterCount() == paramTypes.size()) {
|
||||
Class<?>[] constructorTypes = constructor.getParameterTypes();
|
||||
for(int index = 0; index < paramTypes.size(); ++index) {
|
||||
if(!constructorTypes[index].isAssignableFrom(paramTypes.get(index))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.geolibrary.GeoLibrary;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public class HybridPatternMatchingController extends PatternMatchingController {
|
||||
|
||||
public HybridPatternMatchingController(String packageName, ResourceSet resourceSet,
|
||||
Class<? extends PatternMatchingEngine> engineType, Class<? extends GeoLibrary> geoLibType) {
|
||||
super(packageName, resourceSet, engineType, geoLibType);
|
||||
}
|
||||
|
||||
public HybridPatternMatchingController(String packageName, ResourceSet resourceSet,
|
||||
Class<? extends PatternMatchingEngine> engineType) {
|
||||
super(packageName, resourceSet, engineType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
||||
import de.tu.darmstadt.es.KappaRules.KappaRuleContainer;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.geolibrary.GeoLibrary;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public class NaivePatternMatchingController extends PatternMatchingController {
|
||||
|
||||
public NaivePatternMatchingController(String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingEngine> engineType) {
|
||||
super(packageName, resourceSet, engineType);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
public NaivePatternMatchingController(String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingEngine> engineType, Class<? extends GeoLibrary> geoLibType) {
|
||||
super(packageName, resourceSet, engineType, geoLibType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,51 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
||||
import de.tu.darmstadt.es.KappaRules.KappaRuleContainer;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.internal.geolibrary.NoneGeoLibrary;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.internal.utils.FrameworkFactory;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.geolibrary.GeoLibrary;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.modification.Modification;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public abstract class PatternMatchingController {
|
||||
private GeoLibrary geoLib;
|
||||
|
||||
private List<Modification> modifications;
|
||||
protected GeoLibrary geoLib;
|
||||
|
||||
private PatternMatchingEngine patternMatchingEngine;
|
||||
protected Map<String, Modification> modifications;
|
||||
|
||||
public void createPatternMatchingEngine (String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingEngine> clazz) {
|
||||
protected PatternMatchingEngine patternMatchingEngine;
|
||||
|
||||
private String packageName;
|
||||
|
||||
protected ResourceSet resourceSet;
|
||||
|
||||
public PatternMatchingController(String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingEngine> engineType) {
|
||||
this(packageName,resourceSet, engineType, null);
|
||||
}
|
||||
|
||||
public PatternMatchingController(String packageName, ResourceSet resourceSet, Class<? extends PatternMatchingEngine> engineType, Class<? extends GeoLibrary> geoLibType) {
|
||||
this.packageName = packageName;
|
||||
this.resourceSet = resourceSet;
|
||||
if(engineType != null) {
|
||||
createPatternMatchingEngine(engineType);
|
||||
}
|
||||
|
||||
if(geoLibType == null) {
|
||||
geoLib = new NoneGeoLibrary();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void convertKappaRuleContainerToModifications(KappaRuleContainer krc) {
|
||||
|
||||
}
|
||||
|
||||
private void createPatternMatchingEngine (Class<? extends PatternMatchingEngine> clazz) {
|
||||
patternMatchingEngine = FrameworkFactory.instance().createPatternMatchingEngine(packageName, resourceSet, clazz);
|
||||
}
|
||||
|
||||
|
@ -24,8 +53,8 @@ public abstract class PatternMatchingController {
|
|||
return geoLib;
|
||||
}
|
||||
|
||||
public List<Modification> getModifications() {
|
||||
return modifications;
|
||||
public Collection<Modification> getModifications() {
|
||||
return modifications.values();
|
||||
}
|
||||
|
||||
public PatternMatchingEngine getPatternMatchingEngine() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.modification;
|
||||
|
||||
public class Modification {
|
||||
|
||||
public Modification() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine;
|
||||
|
||||
public abstract class Manipulation {
|
||||
|
||||
}
|
|
@ -2,8 +2,6 @@ package de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontrol
|
|||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.utils.FrameworkHelper;
|
||||
|
||||
public abstract class PatternMatchingEngine{
|
||||
|
||||
private static final String PACKAGE_SUFFIX = ".patterns";
|
||||
|
@ -16,7 +14,6 @@ public abstract class PatternMatchingEngine{
|
|||
this.packageName = packageName;
|
||||
this.patternPackageName = packageName + PACKAGE_SUFFIX;
|
||||
this.resourceSet = resourceSet;
|
||||
FrameworkHelper.instance().addEngine(this);
|
||||
}
|
||||
|
||||
public abstract void createController();
|
||||
|
@ -26,4 +23,6 @@ public abstract class PatternMatchingEngine{
|
|||
public abstract void run(Object... objects);
|
||||
|
||||
public abstract MainClassTemplate getMainClassTemplate();
|
||||
|
||||
public abstract Manipulation getManipulation();
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.splitter;
|
||||
|
||||
|
||||
public class HybridSplitter extends Splitter {
|
||||
private Splitter splitter;
|
||||
|
||||
public Splitter getSplitter() {
|
||||
return splitter;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package de.tu.darmstadt.es.biochemicalSimulationFramework.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.internal.utils.FrameworkFactory;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public class FrameworkHelper {
|
||||
|
||||
private static FrameworkHelper instance;
|
||||
|
||||
private Map<Class<? extends PatternMatchingEngine>,PatternMatchingEngine> engines;
|
||||
|
||||
private FrameworkHelper() {
|
||||
engines = new HashMap<>();
|
||||
}
|
||||
|
||||
public static FrameworkHelper instance() {
|
||||
if(instance == null)
|
||||
instance = new FrameworkHelper();
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void addEngine(PatternMatchingEngine engine) {
|
||||
engines.put(engine.getClass(), engine);
|
||||
}
|
||||
|
||||
public Collection<PatternMatchingEngine> getEngines(){
|
||||
return engines.values();
|
||||
}
|
||||
|
||||
public <PM extends PatternMatchingEngine> PM getPatternMatcher (Class<PM> clazz) {
|
||||
PatternMatchingEngine engine = engines.get(clazz);
|
||||
if(engine != null) {
|
||||
return clazz.cast(engine);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public <PM extends PatternMatchingEngine> PM getOrCreatePatternMatcher (Class<PM> clazz, String packageName) {
|
||||
PatternMatchingEngine engine = engines.get(clazz);
|
||||
if(engine != null) {
|
||||
return clazz.cast(engine);
|
||||
}
|
||||
return FrameworkFactory.instance().createPatternMatchingEngine(packageName, new ResourceSetImpl(), clazz);
|
||||
}
|
||||
}
|
|
@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.xtext,
|
|||
de.tu.darmstadt.es.PatternMatchingEngine.viatra,
|
||||
org.eclipse.viatra.query.patternlanguage,
|
||||
org.eclipse.viatra.query.patternlanguage.emf,
|
||||
de.tu.darmstadt.es.xtext.utils;bundle-version="1.0.0"
|
||||
de.tu.darmstadt.es.xtext.utils;bundle-version="1.0.0",
|
||||
de.tu.darmstadt.es.BiochemicalSimulationFramework.utils;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: de.tu.darmstadt.es,
|
||||
de.tu.darmstadt.es.generator,
|
||||
|
|
|
@ -13,11 +13,15 @@ import org.eclipse.viatra.query.patternlanguage.patternLanguage.PatternModel;
|
|||
import org.eclipse.xtext.generator.AbstractGenerator;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.generator.IGeneratorContext;
|
||||
import org.eclipse.xtext.xtext.generator.web.WebIntegrationFragment.Framework;
|
||||
|
||||
import de.tu.darmstadt.es.BiochemicalSimulationFramework.utils.FrameworkHelper;
|
||||
import de.tu.darmstadt.es.KappaRules.KappaRuleContainer;
|
||||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.VIATRAEngine;
|
||||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.modelconverter.RuleToPatternConverter;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.SimulatorConfigurator;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.NaivePatternMatchingController;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.PatternMatchingController;
|
||||
import de.tu.darmstadt.es.converter.KappaRuleConverter;
|
||||
import de.tu.darmstadt.es.converter.KappaStructureConverter;
|
||||
import de.tu.darmstadt.es.converter.NeoKappaExpressionSolver;
|
||||
|
@ -58,10 +62,11 @@ public class AbstractNeoKappaGernerator extends AbstractGenerator{
|
|||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
NaivePatternMatchingController naivePatternMatchingController = new NaivePatternMatchingController();
|
||||
naivePatternMatchingController.createPatternMatchingEngine(getProjectName(resource), new ResourceSetImpl(), VIATRAEngine.class);
|
||||
|
||||
naivePatternMatchingController.getPatternMatchingEngine().getConverter().convertToPatternModel(kappaRuleContainer);
|
||||
SimulatorConfigurator simConfig = FrameworkHelper.instance().getDefaultConfig(getProjectName(resource));
|
||||
PatternMatchingController pmc = simConfig.getPatternMatchingController();
|
||||
pmc.getPatternMatchingEngine().getConverter().convertToPatternModel(kappaRuleContainer);
|
||||
|
||||
|
||||
|
||||
// VIATRAEngine engine = new VIATRAEngine(getProjectName(resource), new ResourceSetImpl());
|
||||
// engine.convertToPatternModel(kappaRuleContainer);
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
|
|||
import de.tu.darmstadt.es.KappaRules.KappaRuleContainer;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.EnginePatternConverter;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.MainClassTemplate;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.Manipulation;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public class DemoclesEngine extends PatternMatchingEngine{
|
||||
|
@ -40,6 +41,12 @@ public class DemoclesEngine extends PatternMatchingEngine{
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Manipulation getManipulation() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,9 +5,6 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.viatra.query.patternlanguage.emf.eMFPatternLanguage.PatternModel;
|
||||
|
||||
import de.tu.darmstadt.es.KappaRules.KappaRuleContainer;
|
||||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.modelconverter.RuleToPatternConverter;
|
||||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.runtime.IRuleHandler;
|
||||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.runtime.RuleHandler;
|
||||
|
@ -15,6 +12,7 @@ import de.tu.darmstadt.es.PatternMatchingEngine.viatra.runtime.ViatraRuntime;
|
|||
import de.tu.darmstadt.es.PatternMatchingEngine.viatra.template.VIATRAMainTemplate;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.EnginePatternConverter;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.MainClassTemplate;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.Manipulation;
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.PatternMatchingEngine;
|
||||
|
||||
public class VIATRAEngine extends PatternMatchingEngine{
|
||||
|
@ -87,5 +85,11 @@ public class VIATRAEngine extends PatternMatchingEngine{
|
|||
mainTemplate = new VIATRAMainTemplate(packageName);
|
||||
return mainTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Manipulation getManipulation() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package de.tu.darmstadt.es.PatternMatchingEngine.viatra.manipulation;
|
||||
|
||||
import de.tu.darmstadt.es.biochemicalSimulationFramework.patternmatchingcontroller.patternmatchingengine.Manipulation;
|
||||
|
||||
public class VIATRAManipulator extends Manipulation {
|
||||
|
||||
}
|
Loading…
Reference in a new issue