use of de.prob.model.brules.RulesModelFactory in project prob2 by bendisposto.
the class Api method brules_load.
/**
* Load a B rules machine from the given file.
*
* @param file the path of the file to load
* @param prefs the preferences to use
* @return the {@link StateSpace} for the loaded machine
*/
public StateSpace brules_load(final String file, final Map<String, String> prefs) throws IOException {
final RulesModelFactory bRulesFactory = modelFactoryProvider.getBRulesFactory();
final RulesProject rulesProject = new RulesProject();
final ParsingBehaviour parsingBehaviour = new ParsingBehaviour();
parsingBehaviour.setAddLineNumbers(true);
rulesProject.setParsingBehaviour(parsingBehaviour);
rulesProject.parseProject(new File(file));
rulesProject.checkAndTranslateProject();
if (rulesProject.hasErrors()) {
throw new ProBError(new BCompoundException(rulesProject.getBExceptionList()));
}
return bRulesFactory.extract(new File(file), rulesProject).load(prefs);
}
Aggregations