Search in sources :

Example 1 with Type

use of org.jbpm.simulation.PathContext.Type in project droolsjbpm-integration by kiegroup.

the class GatewayElementHandler method handleInclusiveGateway.

protected void handleInclusiveGateway(List<SequenceFlow> outgoing) {
    // firstly cover simple xor based - number of paths is equal to number
    // of outgoing
    handleExclusiveGateway(outgoing);
    Type currentType = manager.getContextFromStack().getType();
    manager.getContextFromStack().setType(Type.ROOT);
    // next cover all combinations of paths
    if (outgoing.size() > 2) {
        List<SequenceFlow> copy = new ArrayList<SequenceFlow>(outgoing);
        List<SequenceFlow> andCombination = null;
        for (SequenceFlow flow : outgoing) {
            // first remove one that we currently processing as that is not
            // a combination
            copy.remove(flow);
            PathContext contextAtThisNode = manager.cloneGivenWithoutPush(manager.getContextFromStack());
            for (SequenceFlow copyFlow : copy) {
                manager.cloneGiven(contextAtThisNode);
                andCombination = new ArrayList<SequenceFlow>();
                andCombination.add(flow);
                andCombination.add(copyFlow);
                handleParallelGateway(andCombination);
            }
        }
    }
    manager.getContextFromStack().setType(Type.ROOT);
    // lastly cover and based - is single path that goes through all at the
    // same time
    handleParallelGateway(outgoing);
    manager.getContextFromStack().setType(currentType);
}
Also used : Type(org.jbpm.simulation.PathContext.Type) PathContext(org.jbpm.simulation.PathContext) SequenceFlow(org.eclipse.bpmn2.SequenceFlow) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 SequenceFlow (org.eclipse.bpmn2.SequenceFlow)1 PathContext (org.jbpm.simulation.PathContext)1 Type (org.jbpm.simulation.PathContext.Type)1