Search in sources :

Example 1 with ExportArguments

use of edu.uah.rsesc.aadlsimulator.agree.ext.AGREESimulationExporter.ExportArguments 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

AGREESimulationEngine (edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationEngine)1 AGREESimulationState (edu.uah.rsesc.aadlsimulator.agree.engine.AGREESimulationState)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 Renaming (jkind.api.results.Renaming)1 Counterexample (jkind.results.Counterexample)1 ComponentImplementation (org.osate.aadl2.ComponentImplementation)1