Search in sources :

Example 1 with ClassicalBMachine

use of de.prob.model.classicalb.ClassicalBMachine in project prob2 by bendisposto.

the class Transition method getParameterPredicates.

/**
 * @return a list of string predicates representing the value of the
 *         parameters for this transition
 */
public List<String> getParameterPredicates() {
    if (isArtificialTransition()) {
        return Collections.emptyList();
    }
    evaluate(FormulaExpand.EXPAND);
    List<String> predicates = new ArrayList<>();
    AbstractElement mainComponent = stateSpace.getMainComponent();
    List<String> paramNames = new ArrayList<>();
    if (mainComponent instanceof ClassicalBMachine) {
        Operation op = ((ClassicalBMachine) mainComponent).getOperation(getName());
        paramNames = op.getParameters();
    } else if (mainComponent instanceof EventBMachine) {
        Event event = ((EventBMachine) mainComponent).getEvent(getName());
        for (EventParameter eventParameter : event.getParameters()) {
            paramNames.add(eventParameter.getName());
        }
    }
    if (paramNames.size() == this.params.size()) {
        for (int i = 0; i < paramNames.size(); i++) {
            predicates.add(paramNames.get(i) + " = " + this.params.get(i));
        }
    }
    return predicates;
}
Also used : EventParameter(de.prob.model.eventb.EventParameter) AbstractElement(de.prob.model.representation.AbstractElement) ClassicalBMachine(de.prob.model.classicalb.ClassicalBMachine) ArrayList(java.util.ArrayList) Event(de.prob.model.eventb.Event) EventBMachine(de.prob.model.eventb.EventBMachine) Operation(de.prob.model.classicalb.Operation)

Example 2 with ClassicalBMachine

use of de.prob.model.classicalb.ClassicalBMachine in project prob2 by bendisposto.

the class RulesModelFactory method extract.

public ExtractedModel<RulesModel> extract(File runnerFile, RulesProject rulesProject) {
    RulesModel rulesModel = modelCreator.get();
    rulesModel = rulesModel.create(runnerFile, rulesProject);
    return new ExtractedModel<>(rulesModel, new ClassicalBMachine(rulesProject.getBModels().get(0).getMachineName()));
}
Also used : ClassicalBMachine(de.prob.model.classicalb.ClassicalBMachine) ExtractedModel(de.prob.scripting.ExtractedModel)

Aggregations

ClassicalBMachine (de.prob.model.classicalb.ClassicalBMachine)2 Operation (de.prob.model.classicalb.Operation)1 Event (de.prob.model.eventb.Event)1 EventBMachine (de.prob.model.eventb.EventBMachine)1 EventParameter (de.prob.model.eventb.EventParameter)1 AbstractElement (de.prob.model.representation.AbstractElement)1 ExtractedModel (de.prob.scripting.ExtractedModel)1 ArrayList (java.util.ArrayList)1