Search in sources :

Example 1 with EventBModelTranslator

use of de.prob.model.eventb.translate.EventBModelTranslator in project prob2 by bendisposto.

the class Api method eventb_save.

/**
 * Save an EventB {@link StateSpace} to the given file.
 *
 * @param s the {@link StateSpace} to save, whose model must be an EventB model
 * @param path the path of the file to save to
 */
public void eventb_save(final StateSpace s, final String path) throws IOException, ModelTranslationError {
    final EventBModelTranslator translator = new EventBModelTranslator((EventBModel) s.getModel(), s.getMainComponent());
    try (final FileOutputStream fos = new FileOutputStream(path)) {
        final PrologTermOutput pto = new PrologTermOutput(fos, false);
        pto.openTerm("package");
        translator.printProlog(pto);
        pto.closeTerm();
        pto.fullstop();
        pto.flush();
    }
}
Also used : PrologTermOutput(de.prob.prolog.output.PrologTermOutput) FileOutputStream(java.io.FileOutputStream) EventBModelTranslator(de.prob.model.eventb.translate.EventBModelTranslator)

Aggregations

EventBModelTranslator (de.prob.model.eventb.translate.EventBModelTranslator)1 PrologTermOutput (de.prob.prolog.output.PrologTermOutput)1 FileOutputStream (java.io.FileOutputStream)1