Search in sources :

Example 6 with ClassicalB

use of de.prob.animator.domainobjects.ClassicalB in project prob2 by bendisposto.

the class ConstraintBasedDeadlockCheckCommand method writeCommand.

@Override
public void writeCommand(final IPrologTermOutput pto) {
    pto.openTerm(PROLOG_COMMAND_NAME);
    if (formula != null) {
        formula.printProlog(pto);
    } else {
        new ClassicalB("1=1", FormulaExpand.EXPAND).printProlog(pto);
    }
    pto.printVariable(RESULT_VARIABLE);
    pto.closeTerm();
}
Also used : ClassicalB(de.prob.animator.domainobjects.ClassicalB)

Example 7 with ClassicalB

use of de.prob.animator.domainobjects.ClassicalB in project prob2 by bendisposto.

the class UnsatRegularCoreCommand method processResult.

@Override
public void processResult(ISimplifiedROMap<String, PrologTerm> bindings) {
    CompoundPrologTerm compoundTerm = BindingGenerator.getCompoundTerm(bindings.get(RESULT_VARIABLE), 0);
    String code = compoundTerm.getFunctor();
    if (pred instanceof EventB) {
        core = new EventB(code, FormulaExpand.EXPAND);
    } else {
        core = new ClassicalB(code, FormulaExpand.EXPAND);
    }
}
Also used : EventB(de.prob.animator.domainobjects.EventB) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) ClassicalB(de.prob.animator.domainobjects.ClassicalB)

Example 8 with ClassicalB

use of de.prob.animator.domainobjects.ClassicalB in project prob2 by bendisposto.

the class WeakestPreconditionCommand method processResult.

@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
    CompoundPrologTerm compoundTerm = BindingGenerator.getCompoundTerm(bindings.get(WEAKEST_PRECONDITION_VARIABLE), 0);
    String code = compoundTerm.getFunctor();
    if (predicate instanceof EventB) {
        result = new EventB(code, FormulaExpand.EXPAND);
    } else {
        result = new ClassicalB(code, FormulaExpand.EXPAND);
    }
}
Also used : EventB(de.prob.animator.domainobjects.EventB) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) ClassicalB(de.prob.animator.domainobjects.ClassicalB)

Example 9 with ClassicalB

use of de.prob.animator.domainobjects.ClassicalB in project prob2 by bendisposto.

the class StateSpace method isValidOperation.

/**
 * Tests to see if a combination of an operation name and a predicate is
 * valid from a given state.
 *
 * @param stateId
 *            {@link State} id for state to test
 * @param name
 *            {@link String} name of operation
 * @param predicate
 *            {@link String} predicate to test
 * @return true, if the operation is valid from the given state. False
 *         otherwise.
 */
public boolean isValidOperation(final State stateId, final String name, final String predicate) {
    final ClassicalB pred = new ClassicalB(predicate, FormulaExpand.EXPAND);
    GetOperationByPredicateCommand command = new GetOperationByPredicateCommand(this, stateId.getId(), name, pred, 1);
    execute(command);
    return !command.hasErrors();
}
Also used : GetOperationByPredicateCommand(de.prob.animator.command.GetOperationByPredicateCommand) ClassicalB(de.prob.animator.domainobjects.ClassicalB)

Aggregations

ClassicalB (de.prob.animator.domainobjects.ClassicalB)9 CompoundPrologTerm (de.prob.prolog.term.CompoundPrologTerm)6 EventB (de.prob.animator.domainobjects.EventB)4 IEvalElement (de.prob.animator.domainobjects.IEvalElement)2 ListPrologTerm (de.prob.prolog.term.ListPrologTerm)2 PrologTerm (de.prob.prolog.term.PrologTerm)2 Test (org.junit.Test)2 ASTProlog (de.be4.classicalb.core.parser.analysis.prolog.ASTProlog)1 GetOperationByPredicateCommand (de.prob.animator.command.GetOperationByPredicateCommand)1 AbstractEvalResult (de.prob.animator.domainobjects.AbstractEvalResult)1 EvalResult (de.prob.animator.domainobjects.EvalResult)1 ISimplifiedROMap (de.prob.parser.ISimplifiedROMap)1 StructuredPrologOutput (de.prob.prolog.output.StructuredPrologOutput)1