Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify concurrent API #20

Merged
merged 29 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
529b16e
Create ICCSLSolver + simplify concurrent API
ebousse Oct 4, 2019
6756220
Adapt VCD addon to new API
ebousse Oct 10, 2019
0677823
Fix warnings in VCD addon
ebousse Oct 10, 2019
411dbf4
Remove addFutureAction from concurrent engine API
ebousse Oct 10, 2019
0bb0bae
Remove unused imports in GemocLanguageDesignerBuilder
ebousse Oct 10, 2019
6f71816
Big refactoring attempt
ebousse Oct 10, 2019
5daab05
Revert lots of attempts, split implem/api
ebousse Oct 10, 2019
61d819f
Fix few mistakes with MoccmlModelExecutionContext
ebousse Oct 10, 2019
ad8760a
Forgot to re-add renamed and new files
ebousse Oct 10, 2019
aea139f
Re-remove getSolver and setSolver
ebousse Oct 10, 2019
495afb0
Add many @Override + new abstract concurrent solver-based engine
ebousse Oct 10, 2019
a2a42de
Better manage types in concurrent tracing addon
ebousse Oct 10, 2019
96839df
Add few missing @Override
ebousse Oct 10, 2019
cb54ef8
Add few missing @Override
ebousse Oct 10, 2019
e2e7ee8
Fix missing code executor in platform
ebousse Oct 14, 2019
c5d8c1f
Move code to abstract concurrent engine + simplify API + other
ebousse Oct 14, 2019
5bce665
Add missing new DeciderExecption class
ebousse Oct 14, 2019
f2755bd
Add AbstractConcurrentLauncher to share concurrent Launcher code
ebousse Oct 16, 2019
5182ec0
Add new abstract classes and remove extension point singleton
ebousse Oct 22, 2019
8d23072
Improve some import declarations
ebousse Oct 22, 2019
f545340
Remove some bin folders from examples
ebousse Oct 22, 2019
14062dc
Merge branch 'master' of github.com:eclipse/gemoc-studio-execution-mo…
ebousse Nov 14, 2019
c176a88
Fix compilation problem language extension
ebousse Nov 14, 2019
6a2b7f7
Remove need to have EP + add choice of run decider
ebousse Nov 14, 2019
c0ea99b
Align tfsm example with new Moccml EP
ebousse Nov 14, 2019
7f735b1
Align SigPML example too new Moccml EP
ebousse Nov 14, 2019
22ba25a
Simplify new default run decider API
ebousse Nov 14, 2019
da99f66
Fix wrong exception declaration in createExecutionPlatform
ebousse Nov 14, 2019
8077676
Share among concurrent engines the init of the decider
ebousse Nov 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -40,17 +39,15 @@
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.gemoc.execution.concurrent.ccsljavaengine.commons.ConcurrentModelExecutionContext;
import org.eclipse.gemoc.execution.concurrent.ccsljavaengine.commons.MoccmlModelExecutionContext;
import org.eclipse.gemoc.execution.concurrent.ccsljavaengine.concurrentmse.FeedbackMSE;
import org.eclipse.gemoc.execution.concurrent.ccsljavaengine.extensions.timesquare.Activator;
import org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.api.core.IConcurrentExecutionContext;
import org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.api.core.AbstractConcurrentModelExecutionContext;
import org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.utils.ccsl.QvtoTransformationPerformer;
import org.eclipse.gemoc.moccml.mapping.feedback.feedback.ActionModel;
import org.eclipse.gemoc.moccml.mapping.feedback.feedback.ModelSpecificEvent;
import org.eclipse.gemoc.trace.commons.model.generictrace.GenericParallelStep;
import org.eclipse.gemoc.trace.commons.model.generictrace.GenericSmallStep;
import org.eclipse.gemoc.trace.commons.model.generictrace.GenericStep;
import org.eclipse.gemoc.trace.commons.model.generictrace.GenerictraceFactory;
import org.eclipse.gemoc.trace.commons.model.trace.MSE;
import org.eclipse.gemoc.trace.commons.model.trace.MSEModel;
Expand All @@ -68,7 +65,6 @@
import fr.inria.aoste.timesquare.ccslkernel.runtime.exceptions.SimulationException;
import fr.inria.aoste.timesquare.ccslkernel.solver.exception.SolverException;
import fr.inria.aoste.timesquare.ccslkernel.solver.launch.CCSLKernelSolverWrapper;
import fr.inria.aoste.timesquare.ccslkernel.solver.priorities.PrioritySolver;
import fr.inria.aoste.timesquare.instantrelation.CCSLRelationModel.OccurrenceRelation;
import fr.inria.aoste.timesquare.instantrelation.listener.RelationModelListener;
import fr.inria.aoste.timesquare.simulationpolicy.maxcardpolicy.MaxCardSimulationPolicy;
Expand All @@ -83,7 +79,7 @@
* Implementation of the ISolver dedicated to CCSL.
*
*/
public class CcslSolver implements org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.api.moc.ISolver {
public class CcslSolver implements org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.api.moc.ICCSLSolver {

protected CCSLKernelSolverWrapper solverWrapper = null;
protected URI solverInputURI = null;
Expand Down Expand Up @@ -357,20 +353,20 @@ public void revertForceClockEffect() {


@Override
public void initialize(IConcurrentExecutionContext context)
public void initialize(AbstractConcurrentModelExecutionContext context)
{
if (context instanceof ConcurrentModelExecutionContext){
_alternativeExecutionModelPath = ((ConcurrentModelExecutionContext)context).alternativeExecutionModelPath;
if (context instanceof MoccmlModelExecutionContext){
_alternativeExecutionModelPath = ((MoccmlModelExecutionContext)context).alternativeExecutionModelPath;
}
createSolver(context);
}

@Override
public void prepareBeforeModelLoading(IConcurrentExecutionContext context)
public void prepareBeforeModelLoading(AbstractConcurrentModelExecutionContext context)
{
generateMoC(context);
generateMoC((MoccmlModelExecutionContext)context);
}
private void generateMoC(IConcurrentExecutionContext context)
private void generateMoC(MoccmlModelExecutionContext context)
{
IExecutionWorkspace workspace = context.getWorkspace();
boolean mustGenerate = false;
Expand Down Expand Up @@ -446,7 +442,7 @@ private void generateMoC(IConcurrentExecutionContext context)
/**
* generates a MSEModel that wraps the FeedbackModel used by Timesquare
*/
private void generateMSEModel(final IConcurrentExecutionContext context){
private void generateMSEModel(final AbstractConcurrentModelExecutionContext context){
final URI feedbackURI = URI.createPlatformResourceURI(getFeedbackPathFromMSEModelPath(context.getWorkspace().getMSEModelPath()).toString(), true);
final URI mseModelURI = URI.createPlatformResourceURI(context.getWorkspace().getMSEModelPath().toString(), true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public GemocInstantRelationModelGenerator() {
ccslRelation = modelFactory.createOccurrenceRelationModel();
}

@Override
public void setIOutputTraceList(IOutputTraceList outputlist) {
irml.setIOutputTraceList(outputlist);
}
Expand All @@ -117,6 +118,7 @@ public GemocInstantRelationModelGenerator(IOutputTraceList outputlist) {
*
* @return A list of ClockConstraint
*/
@Override
public EList<CCSLConstraintRef> getClockConstraintList() {
return ccslRelation.getRefsToCCSLConstraints();
}
Expand All @@ -128,6 +130,7 @@ public EList<CCSLConstraintRef> getClockConstraintList() {
* @param eObject
* a model element
*/
@Override
public void getModelRoot(EObject eObject) {
// TODO ..
irml.clear();
Expand All @@ -145,6 +148,7 @@ public void getModelRoot(EObject eObject) {
* @param stepTrace
* a StepTrace of a trace model
*/
@Override
public void addClockConstraint(LogicalStep stepTrace) {

if (stepTrace.getEventOccurrences().isEmpty())
Expand All @@ -158,11 +162,13 @@ public void addClockConstraint(LogicalStep stepTrace) {
// disp();
}

@Override
public void extract(EObject eo1) {
LookForExtensions.getDefault().getICCSLModel(eo1, this);
// disp();
}

@Override
public ArrayList<IDescription> getDescription() {
ArrayList<IDescription> desc = new ArrayList<IDescription>(lab.size());
for (AbstractCreator a : lab) {
Expand All @@ -171,6 +177,7 @@ public ArrayList<IDescription> getDescription() {
return desc;
}

@Override
public void disp() {
for (AbstractCreator clockConstraint : lab) {
System.out.println(clockConstraint.getDescription().toString());
Expand All @@ -185,6 +192,7 @@ public void disp() {
* A list of trace model paths
* @return A list of StepTrace
*/
@Override
public ArrayList<LogicalStep> loadTrace(IPath path) {
ArrayList<LogicalStep> steps = new ArrayList<LogicalStep>();

Expand All @@ -208,10 +216,12 @@ public ArrayList<LogicalStep> loadTrace(IPath path) {
return steps;
}

@Override
public ModelElementReference searchClock(EObject eo) {
return searchClock(new EObject[] { eo });
}

@Override
public ModelElementReference searchClock(EObject[] eObjects) {

boucle1: for (ModelElementReference mer : listClock) {
Expand All @@ -227,10 +237,12 @@ public ModelElementReference searchClock(EObject[] eObjects) {
return null;
}

@Override
public ModelElementReference searchConstraint(EObject eo) {
return searchConstraint(new EObject[] { eo });
}

@Override
public ModelElementReference searchConstraint(EObject[] eObjects) {
boucle1: for (ModelElementReference mer : listRelation) {
if (mer.getElementRef().size() == eObjects.length) {
Expand All @@ -244,18 +256,22 @@ public ModelElementReference searchConstraint(EObject[] eObjects) {
return null;
}

@Override
public List<ModelElementReference> getListClock() {
return listClock;
}

@Override
public List<ModelElementReference> getListRelation() {
return listRelation;
}

@Override
public void setListClock(List<ModelElementReference> listClock) {
this.listClock = listClock;
}

@Override
public void setListRelation(List<ModelElementReference> listrelation) {
this.listRelation = listrelation;
}
Expand All @@ -274,6 +290,7 @@ public void setListRelation(List<ModelElementReference> listrelation) {
* @param stepTrace
* a StepTrace of a trace model
*/
@Override
public void resolve(LogicalStep stepTrace) {
List<ResolveClockConstraintException> list = new ArrayList<ResolveClockConstraintException>();
try {
Expand Down Expand Up @@ -355,6 +372,7 @@ private void saveRelationModel(ResourceSet rs) {
* @param namefilein
* the file name of the instants relation model
*/
@Override
public void saveRelationModel(IPath folderin, String namefilein) {
local = folderin;
namefile = namefilein;
Expand All @@ -365,6 +383,7 @@ public void saveRelationModel(IPath folderin, String namefilein) {

}

@Override
public void saveRelationModel(ResourceSet rs, IPath folderin, String namefilein) {
local = folderin;
namefile = namefilein;
Expand All @@ -375,6 +394,7 @@ public void saveRelationModel(ResourceSet rs, IPath folderin, String namefilein)

}

@Override
public void unload() {
// TODO
try {
Expand All @@ -385,11 +405,13 @@ public void unload() {
}
}

@Override
public void aNewClockConstraint(CCSLConstraintRef clockConstraint) {
getClockConstraintList().add(clockConstraint);
irml.aNewClockConstraint(clockConstraint);
}

@Override
public AbstractCreator add(AbstractCreator ab) {
if (ab != null) {
if (ab.addChecking()) {
Expand All @@ -407,6 +429,7 @@ public AbstractCreator add(AbstractCreator ab) {
return ab;
}

@Override
public AbstractCreator add(AbstractCreator ab, ActivationCreator activationCreator) {
if (ab != null) {
if (ab.addChecking()) {
Expand All @@ -426,6 +449,7 @@ public AbstractCreator add(AbstractCreator ab, ActivationCreator activationCreat
return ab;
}

@Override
public CCSLConstraintRef addAndCreateAlternates(ModelElementReference a, ModelElementReference b, int a1, int b1,
boolean left, boolean rigth) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand All @@ -445,6 +469,7 @@ public CCSLConstraintRef addAndCreateAlternates(ModelElementReference a, ModelEl
return cref;
}

@Override
public CCSLConstraintRef addAndCreatePrecedes(ModelElementReference a, ModelElementReference b, int a1, int b1,
boolean strict) {

Expand All @@ -460,6 +485,7 @@ public CCSLConstraintRef addAndCreatePrecedes(ModelElementReference a, ModelElem
return cref;
}

@Override
public CCSLConstraintRef addAndCreateSync(ModelElementReference a, ModelElementReference b, int a1, int b1,
boolean left, boolean rigth) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand All @@ -480,6 +506,7 @@ public CCSLConstraintRef addAndCreateSync(ModelElementReference a, ModelElementR
return cref;
}

@Override
public CCSLConstraintRef addAndCreateEqual(ModelElementReference a, ModelElementReference b) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
cref.getCcslElements().add(a);
Expand All @@ -504,6 +531,7 @@ public CCSLConstraintRef addAndCreateEqual(ModelElementReference a, ModelElement
* (ModelElementReference)
* @return an element from the instantRelamtionModel named CCSLConstraintRef
*/
@Override
public CCSLConstraintRef addAndCreateConcatenation(ModelElementReference res, ModelElementReference c1,
ModelElementReference c2) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand Down Expand Up @@ -535,6 +563,7 @@ public CCSLConstraintRef addAndCreateConcatenation(ModelElementReference res, Mo
* (ModelElementReference)
* @return an element from the instantRelamtionModel named CCSLConstraintRef
*/
@Override
public CCSLConstraintRef addAndCreateUpTo(ModelElementReference res, ModelElementReference c1,
ModelElementReference c2) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand All @@ -557,6 +586,7 @@ public CCSLConstraintRef addAndCreateUpTo(ModelElementReference res, ModelElemen
return cref;
}

@Override
public CCSLConstraintRef addandCreateInf(ModelElementReference r, ModelElementReference lst[]) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
cref.getCcslElements().add(r);
Expand All @@ -573,6 +603,7 @@ public CCSLConstraintRef addandCreateInf(ModelElementReference r, ModelElementRe
return cref;
}

@Override
public CCSLConstraintRef addandCreateSup(ModelElementReference r, ModelElementReference lst[]) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
cref.getCcslElements().add(r);
Expand All @@ -590,6 +621,7 @@ public CCSLConstraintRef addandCreateSup(ModelElementReference r, ModelElementRe
return cref;
}

@Override
public CCSLConstraintRef addandCreateInterOrUnion(ModelElementReference r, ModelElementReference a,
ModelElementReference b) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand All @@ -605,6 +637,7 @@ public CCSLConstraintRef addandCreateInterOrUnion(ModelElementReference r, Model
return cref;
}

@Override
public CCSLConstraintRef addandCreateDelayedFor(ModelElementReference r, ModelElementReference a,
ModelElementReference b, int n) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand All @@ -625,6 +658,7 @@ public CCSLConstraintRef addandCreateDelayedFor(ModelElementReference r, ModelEl
return cref;
}

@Override
public CCSLConstraintRef addandCreateSampledOn(ModelElementReference sup, ModelElementReference superc,
ModelElementReference trigger, boolean strictly) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand All @@ -643,6 +677,7 @@ public CCSLConstraintRef addandCreateSampledOn(ModelElementReference sup, ModelE
return cref;
}

@Override
public CCSLConstraintRef addandCreateSustain(ModelElementReference res, ModelElementReference sustain,
ModelElementReference upto) {
CCSLConstraintRef cref = CCSLRelationModelFactory.eINSTANCE.createCCSLConstraintRef();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
delegate="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.Launcher"
delegate="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.MoccmlLauncher"
id="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher"
modes="run, debug"
name="Gemoc Concurrent eXecutable Model"
Expand Down Expand Up @@ -102,7 +102,7 @@
</extension>
<extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
class="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.LauncherTabGroup"
class="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.MoccmlLauncherTabGroup"
id="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.tabGroup"
type="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher">
</launchConfigurationTabGroup>
Expand All @@ -120,7 +120,7 @@
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.Launcher"
class="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.launcher.MoccmlLauncher"
description="Create a configuration to launch an Eclipse application in debug mode."
icon="icons/IconeGemocModel-16.png"
id="org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui.GemocExecutableReflectiveModel"
Expand Down
Loading