Search in sources :

Example 1 with SwitchCommand

use of com.walmartlabs.concord.runtime.v2.runner.vm.SwitchCommand in project concord by walmartlabs.

the class SwitchCompiler method compile.

@Override
public Command compile(CompilerContext context, SwitchStep step) {
    List<Map.Entry<String, Command>> caseCommands = new ArrayList<>();
    for (Map.Entry<String, List<Step>> kv : step.getCaseSteps()) {
        caseCommands.add(new AbstractMap.SimpleEntry<>(kv.getKey(), compile(context, kv.getValue())));
    }
    Command defaultCommand = compile(context, step.getDefaultSteps());
    return new SwitchCommand(step, caseCommands, defaultCommand);
}
Also used : AbstractMap(java.util.AbstractMap) SwitchCommand(com.walmartlabs.concord.runtime.v2.runner.vm.SwitchCommand) SwitchCommand(com.walmartlabs.concord.runtime.v2.runner.vm.SwitchCommand) BlockCommand(com.walmartlabs.concord.runtime.v2.runner.vm.BlockCommand) Command(com.walmartlabs.concord.svm.Command) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) AbstractMap(java.util.AbstractMap) Map(java.util.Map)

Aggregations

BlockCommand (com.walmartlabs.concord.runtime.v2.runner.vm.BlockCommand)1 SwitchCommand (com.walmartlabs.concord.runtime.v2.runner.vm.SwitchCommand)1 Command (com.walmartlabs.concord.svm.Command)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1