// Path: src/main/java/org/grouchotools/jsrules/RulesetExecutor.java
// public abstract class RulesetExecutor<T> extends Executor {
//     public abstract T execute(Map<String, Object> parameters) throws InvalidParameterException;
// 
//     public abstract String getName();
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/RulesetListExecutor.java
// public abstract class RulesetListExecutor<T> extends RulesetExecutor<T> {
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidParameterException.java
// public class InvalidParameterException extends JsRulesException {
// 
//     public InvalidParameterException() {
//     }
// 
//     public InvalidParameterException(String message) {
//         super(message);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidParameterException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
//     
// }


import org.grouchotools.jsrules.RulesetExecutor;
import org.grouchotools.jsrules.RulesetListExecutor;
import org.grouchotools.jsrules.exception.InvalidParameterException;
import java.util.List;
import java.util.Map;
/*
 * The MIT License
 *
 * Copyright 2015 Paul.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.grouchotools.jsrules.impl;



/**
 * This executor evaluates a series of rulesets in order.
 * <p/>
 * If all rulesets evaluate as true, it returns the given response. Otherwise, the
 * response is null.
 *
 * @param <T>
 * @author Paul
 */
public class FirstTrueRulesetListExecutorImpl<T> extends RulesetListExecutor<T> {
    private final List<RulesetExecutor<T>> rulesetList;
    private final String name;

    public FirstTrueRulesetListExecutorImpl(String name, List<RulesetExecutor<T>> rulesetList) {
        this.name = name;
        this.rulesetList = rulesetList;
    }

// Path: src/main/java/org/grouchotools/jsrules/RulesetExecutor.java
// public abstract class RulesetExecutor<T> extends Executor {
//     public abstract T execute(Map<String, Object> parameters) throws InvalidParameterException;
// 
//     public abstract String getName();
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/RulesetListExecutor.java
// public abstract class RulesetListExecutor<T> extends RulesetExecutor<T> {
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidParameterException.java
// public class InvalidParameterException extends JsRulesException {
// 
//     public InvalidParameterException() {
//     }
// 
//     public InvalidParameterException(String message) {
//         super(message);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidParameterException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
//     
// }


// Path: src/main/java/org/grouchotools/jsrules/impl/FirstTrueRulesetListExecutorImpl.java
import org.grouchotools.jsrules.RulesetExecutor;
import org.grouchotools.jsrules.RulesetListExecutor;
import org.grouchotools.jsrules.exception.InvalidParameterException;
import java.util.List;
import java.util.Map;

/*
 * The MIT License
 *
 * Copyright 2015 Paul.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.grouchotools.jsrules.impl;



/**
 * This executor evaluates a series of rulesets in order.
 * <p/>
 * If all rulesets evaluate as true, it returns the given response. Otherwise, the
 * response is null.
 *
 * @param <T>
 * @author Paul
 */
public class FirstTrueRulesetListExecutorImpl<T> extends RulesetListExecutor<T> {
    private final List<RulesetExecutor<T>> rulesetList;
    private final String name;

    public FirstTrueRulesetListExecutorImpl(String name, List<RulesetExecutor<T>> rulesetList) {
        this.name = name;
        this.rulesetList = rulesetList;
    }

    @Override