use of de.prob.model.classicalb.ClassicalBModel in project prob2 by bendisposto.
the class ClassicalBFactory method create.
public ExtractedModel<ClassicalBModel> create(final Start model) {
ClassicalBModel classicalBModel = modelCreator.get();
BParser bparser = new BParser();
final RecursiveMachineLoader rml = parseAllMachines(model, ".", new File(""), new CachingDefinitionFileProvider(), bparser);
classicalBModel = classicalBModel.create(model, rml, new File("from_string"), bparser);
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
use of de.prob.model.classicalb.ClassicalBModel in project prob2 by bendisposto.
the class ClassicalBFactory method create.
public ExtractedModel<ClassicalBModel> create(final String model) {
ClassicalBModel classicalBModel = modelCreator.get();
BParser bparser = new BParser();
Start ast = parseString(model, bparser);
final RecursiveMachineLoader rml = parseAllMachines(ast, ".", new File(""), bparser.getContentProvider(), bparser);
classicalBModel = classicalBModel.create(ast, rml, new File("from_string"), bparser);
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
use of de.prob.model.classicalb.ClassicalBModel in project prob2 by bendisposto.
the class ClassicalBFactory method extract.
@Override
public ExtractedModel<ClassicalBModel> extract(final String modelPath) throws IOException, ModelTranslationError {
ClassicalBModel classicalBModel = modelCreator.get();
File f = new File(modelPath);
BParser bparser = new BParser();
Start ast = parseFile(f, bparser);
RecursiveMachineLoader rml = parseAllMachines(ast, f.getParent(), f, bparser.getContentProvider(), bparser);
classicalBModel = classicalBModel.create(ast, rml, f, bparser);
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
use of de.prob.model.classicalb.ClassicalBModel in project prob2 by bendisposto.
the class TLAFactory method extract.
@Override
public ExtractedModel<ClassicalBModel> extract(final String fileName) throws IOException, ModelTranslationError {
ClassicalBModel classicalBModel = modelCreator.get();
File f = new File(fileName);
if (!f.exists()) {
throw new FileNotFoundException("The TLA Model" + fileName + " was not found.");
}
Translator translator;
Start ast;
try {
translator = new Translator(f.getAbsolutePath());
ast = translator.translate();
} catch (TLA2BException e) {
throw new ModelTranslationError("Translation Error: " + e.getMessage(), e);
}
BParser bparser = new BParser();
bparser.getDefinitions().addDefinitions(translator.getBDefinitions());
try {
final RecursiveMachineLoader rml = parseAllMachines(ast, f, bparser);
classicalBModel = classicalBModel.create(ast, rml, f, bparser);
} catch (BCompoundException e) {
throw new ModelTranslationError(e.getMessage(), e);
}
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
Aggregations