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;
}
};
}
Aggregations