Search in sources :

Example 1 with Condition

use of org.whole.lang.workflows.model.Condition in project whole by wholeplatform.

the class WorkflowsInterpreterVisitor method visit.

// TODO ? remove from interpreter or add to model ?
// public void visit(Repeat entity) {
// for (int i=0; i<entity.getTimes().wIntValue(); i++)
// entity.getFlowObject().accept(this);
// }
public void visit(WhileLoop entity) {
    Condition condition = entity.getCondition();
    while (BehaviorUtils.evaluatePredicate(condition, 0, getBindings())) {
        handleCancelRequest();
        entity.getFlowObject().accept(this);
    }
}
Also used : Condition(org.whole.lang.workflows.model.Condition)

Example 2 with Condition

use of org.whole.lang.workflows.model.Condition in project whole by wholeplatform.

the class WorkflowsInterpreterVisitor method visit.

// TODO ? remove from interpreter or add to model ?
// public void visit(DoWhileControl entity) {
// do {
// entity.getFlowObject().accept(visitor1);
// } while (booleanValue(entity.getCondition()));
// }
public void visit(ConditionalCase entity) {
    Condition condition = entity.getCondition();
    boolean isSatisfied = BehaviorUtils.evaluatePredicate(condition, 0, getBindings());
    if (isSatisfied)
        entity.getFlowObject().accept(this);
    setResultValue(isSatisfied);
}
Also used : Condition(org.whole.lang.workflows.model.Condition)

Example 3 with Condition

use of org.whole.lang.workflows.model.Condition in project whole by wholeplatform.

the class WorkflowsIDEInterpreterVisitor method visit.

@Override
public void visit(Breakpoint entity) {
    setResult(null);
    IBindingManager debugEnv = getBindings();
    if (entity.getDisabled().wBooleanValue() || (debugEnv.wIsSet("debug#reportModeEnabled") && !debugEnv.wBooleanValue("debug#reportModeEnabled")) || (debugEnv.wIsSet("debug#debugModeEnabled") && !debugEnv.wBooleanValue("debug#debugModeEnabled")) || (debugEnv.wIsSet("debug#breakpointsEnabled") && !debugEnv.wBooleanValue("debug#breakpointsEnabled")))
        return;
    Condition condition = entity.getCondition();
    if (!EntityUtils.isResolver(condition)) {
        if (!BehaviorUtils.evaluatePredicate(condition, 0, debugEnv))
            return;
    }
    Set<String> includeNames = new TreeSet<String>();
    Variables variables = entity.getShowVariables();
    if (Matcher.matchImpl(WorkflowsEntityDescriptorEnum.Variables, variables)) {
        for (Variable variable : variables) includeNames.add(variable.getValue());
    }
    E4Utils.suspendOperation(SuspensionKind.BREAK, null, entity, debugEnv, includeNames);
}
Also used : Condition(org.whole.lang.workflows.model.Condition) Variables(org.whole.lang.workflows.model.Variables) Variable(org.whole.lang.workflows.model.Variable) TreeSet(java.util.TreeSet) IBindingManager(org.whole.lang.bindings.IBindingManager)

Aggregations

Condition (org.whole.lang.workflows.model.Condition)3 TreeSet (java.util.TreeSet)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1 Variable (org.whole.lang.workflows.model.Variable)1 Variables (org.whole.lang.workflows.model.Variables)1