org.camunda.bpm.dmn.engine.impl.DmnDecisionTableResultImpl Maven / Gradle / Ivy
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.camunda.bpm.dmn.engine.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.camunda.bpm.dmn.engine.DmnDecisionRuleResult;
import org.camunda.bpm.dmn.engine.DmnDecisionTableResult;
public class DmnDecisionTableResultImpl implements DmnDecisionTableResult {
private static final long serialVersionUID = 1L;
public static final DmnEngineLogger LOG = DmnLogger.ENGINE_LOGGER;
protected final List ruleResults;
public DmnDecisionTableResultImpl(List ruleResults) {
this.ruleResults = ruleResults;
}
public DmnDecisionRuleResult getFirstResult() {
if (size() > 0) {
return get(0);
} else {
return null;
}
}
public DmnDecisionRuleResult getSingleResult() {
if (size() == 1) {
return get(0);
} else if (isEmpty()) {
return null;
} else {
throw LOG.decisionResultHasMoreThanOneOutput(this);
}
}
@SuppressWarnings("unchecked")
public List collectEntries(String outputName) {
List outputValues = new ArrayList();
for (DmnDecisionRuleResult ruleResult : ruleResults) {
if (ruleResult.containsKey(outputName)) {
Object value = ruleResult.get(outputName);
outputValues.add((T) value);
}
}
return outputValues;
}
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy