// Path: core/src/main/java/com/github/ehe/simpleorchestrator/Task.java
// public interface Task<P extends Context> {
//     /**
//      * @param context <code>context</code> interface that this Task is working on
//      * @throws OrchestratorException if there is an issue
//      */
//     void execute(P context) throws OrchestratorException;
// }
// 
// Path: core/src/main/java/com/github/ehe/simpleorchestrator/context/Context.java
// public interface Context {
// 
// }
// 
// Path: core/src/main/java/com/github/ehe/simpleorchestrator/exception/OrchestratorException.java
// public class OrchestratorException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private int errorCode = 0;
// 
//     public OrchestratorException(String msg, Throwable cause) {
//         super(msg, cause);
//     }
// 
//     public OrchestratorException(String msg, int errorCode) {
//         super(msg);
//         this.errorCode = errorCode;
//     }
// 
//     public OrchestratorException(String msg, int errorCode, Throwable cause) {
//         super(msg, cause);
//         this.errorCode = errorCode;
//     }
// 
//     public int getErrorCode() {
//         return errorCode;
//     }
// }


import com.github.ehe.simpleorchestrator.Task;
import com.github.ehe.simpleorchestrator.context.Context;
import com.github.ehe.simpleorchestrator.exception.OrchestratorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.EnumMap;
/*
 *
 *  * Copyright (c) 2017. Eric He (eriche39@gmail.com)
 *  *
 *  * This software is licensed under
 *  *
 *  * MIT license
 *  *
 *
 */

package com.github.ehe.simpleorchestrator.impl;



/**
 * This <code>Selector</code> class is used to execute only one selected task(or channel)
 * <p>
 * it provides parallel flow of a process
 * <p>
 * concrete class usually implement getChannel base on data in context
 * <p>
 *
 * @param <P> context that compatible with all tasks that it may select
 */

public abstract class Selector<K extends Enum<K>, P extends Context> implements Task<P> {
    protected static final Logger logger = LoggerFactory.getLogger(Selector.class);
    private EnumMap<K, Task<P>> taskMap;

// Path: core/src/main/java/com/github/ehe/simpleorchestrator/Task.java
// public interface Task<P extends Context> {
//     /**
//      * @param context <code>context</code> interface that this Task is working on
//      * @throws OrchestratorException if there is an issue
//      */
//     void execute(P context) throws OrchestratorException;
// }
// 
// Path: core/src/main/java/com/github/ehe/simpleorchestrator/context/Context.java
// public interface Context {
// 
// }
// 
// Path: core/src/main/java/com/github/ehe/simpleorchestrator/exception/OrchestratorException.java
// public class OrchestratorException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private int errorCode = 0;
// 
//     public OrchestratorException(String msg, Throwable cause) {
//         super(msg, cause);
//     }
// 
//     public OrchestratorException(String msg, int errorCode) {
//         super(msg);
//         this.errorCode = errorCode;
//     }
// 
//     public OrchestratorException(String msg, int errorCode, Throwable cause) {
//         super(msg, cause);
//         this.errorCode = errorCode;
//     }
// 
//     public int getErrorCode() {
//         return errorCode;
//     }
// }


// Path: core/src/main/java/com/github/ehe/simpleorchestrator/impl/Selector.java
import com.github.ehe.simpleorchestrator.Task;
import com.github.ehe.simpleorchestrator.context.Context;
import com.github.ehe.simpleorchestrator.exception.OrchestratorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.EnumMap;

/*
 *
 *  * Copyright (c) 2017. Eric He (eriche39@gmail.com)
 *  *
 *  * This software is licensed under
 *  *
 *  * MIT license
 *  *
 *
 */

package com.github.ehe.simpleorchestrator.impl;



/**
 * This <code>Selector</code> class is used to execute only one selected task(or channel)
 * <p>
 * it provides parallel flow of a process
 * <p>
 * concrete class usually implement getChannel base on data in context
 * <p>
 *
 * @param <P> context that compatible with all tasks that it may select
 */

public abstract class Selector<K extends Enum<K>, P extends Context> implements Task<P> {
    protected static final Logger logger = LoggerFactory.getLogger(Selector.class);
    private EnumMap<K, Task<P>> taskMap;

    public Selector(EnumMap<K, Task<P>> taskMap) {