Search in sources :

Example 1 with AGREESimulationState

use of edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationState in project AGREE by loonwerks.

the class CounterexampleLoaderHelper method buildAgreeNameToSimulationStateElementMap.

private Map<String, Object> buildAgreeNameToSimulationStateElementMap(final AGREESimulationEngine simEngine) {
    final AGREESimulationState simState = simEngine.getCurrentState();
    final Map<String, Object> result = new HashMap<String, Object>();
    for (Object element : simState.getRootElements()) {
        populateAgreeNameToSimulationStateElementMap(result, simState, element);
    }
    return result;
}
Also used : AGREESimulationState(edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationState) HashMap(java.util.HashMap) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with AGREESimulationState

use of edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationState in project AGREE by loonwerks.

the class ExportAction method buildExportArguments.

private ExportArguments buildExportArguments() {
    final SimulationUIService simUiService = (SimulationUIService) Objects.requireNonNull(PlatformUI.getWorkbench().getService(SimulationUIService.class), "Unable to retrieve Simulation UI Service");
    final SimulatorState simulatorState = simUiService.getCurrentState();
    if (!(simulatorState.getEngineState() instanceof AGREESimulationState)) {
        throw new RuntimeException("Simulation engine state must be an AGREESimulationState");
    }
    if (!(simulatorState.getSimulationEngine() instanceof AGREESimulationEngine)) {
        throw new RuntimeException("Simulation engine must be an AGREESimulationEngine");
    }
    final AGREESimulationState agreeSimState = (AGREESimulationState) simulatorState.getEngineState();
    final AGREESimulationEngine engine = (AGREESimulationEngine) simulatorState.getSimulationEngine();
    final ComponentImplementation componentImplementation = engine.getSystemInstance().getComponentImplementation();
    final Counterexample cex = buildCounterexample(agreeSimState);
    final Renaming renaming = engine.getSimulationProgram().getAgreeRenaming();
    return new ExportArguments() {

        @Override
        public ComponentImplementation getComponentImplementation() {
            return componentImplementation;
        }

        @Override
        public Counterexample getCounterexample() {
            return cex;
        }

        @Override
        public Renaming getAgreeRenaming() {
            return renaming;
        }
    };
}
Also used : SimulationUIService(edu.uah.rsesc.aadlsimulator.ui.services.SimulationUIService) ComponentImplementation(org.osate.aadl2.ComponentImplementation) AGREESimulationState(edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationState) ExportArguments(edu.uah.rsesc.aadlsimulator.agree.ext.AGREESimulationExporter.ExportArguments) AGREESimulationEngine(edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationEngine) SimulatorState(edu.uah.rsesc.aadlsimulator.ui.services.SimulatorState) Counterexample(jkind.results.Counterexample) Renaming(jkind.api.results.Renaming)

Aggregations

AGREESimulationState (edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationState)2 AGREESimulationEngine (edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationEngine)1 ExportArguments (edu.uah.rsesc.aadlsimulator.agree.ext.AGREESimulationExporter.ExportArguments)1 SimulationUIService (edu.uah.rsesc.aadlsimulator.ui.services.SimulationUIService)1 SimulatorState (edu.uah.rsesc.aadlsimulator.ui.services.SimulatorState)1 HashMap (java.util.HashMap)1 Renaming (jkind.api.results.Renaming)1 Counterexample (jkind.results.Counterexample)1 EObject (org.eclipse.emf.ecore.EObject)1 ComponentImplementation (org.osate.aadl2.ComponentImplementation)1