mml-commons.8.44.0.Final.source-code.KiePMMLSimplePredicateEvaluateMethodTemplate.tmpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kie-pmml-commons Show documentation
Show all versions of kie-pmml-commons Show documentation
Common code for PMML module
package org.kie.pmml.commons.model.predicates;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
public class KiePMMLSimplePredicateEvaluateMethodTemplate {
private boolean evaluateEQUAL(Map stringObjectMap) {
Object value = null;
if (stringObjectMap.containsKey("avalue")) {
return value.equals(stringObjectMap.get("avalue"));
} else {
return false;
}
}
private boolean evaluateNOT_EQUAL(Map stringObjectMap) {
Object value = null;
if (stringObjectMap.containsKey("avalue")) {
return !value.equals(stringObjectMap.get("avalue"));
} else {
return false;
}
}
private boolean evaluateLESS_THAN(Map stringObjectMap) {
Object inputValue = null;
Object value = null;
if (stringObjectMap.containsKey("avalue")) {
inputValue = stringObjectMap.get("avalue");
} else {
return false;
}
if (inputValue instanceof Number && value instanceof Number) {
return ((Number) inputValue).doubleValue() < ((Number) value).doubleValue();
} else {
return false;
}
}
private boolean evaluateLESS_OR_EQUAL(Map stringObjectMap) {
Object inputValue = null;
Object value = null;
if (stringObjectMap.containsKey("avalue")) {
inputValue = stringObjectMap.get("avalue");
} else {
return false;
}
if (inputValue instanceof Number && value instanceof Number) {
return ((Number) inputValue).doubleValue() <= ((Number) value).doubleValue();
} else {
return false;
}
}
private boolean evaluateGREATER_THAN(Map stringObjectMap) {
Object inputValue = null;
Object value = null;
if (stringObjectMap.containsKey("avalue")) {
inputValue = stringObjectMap.get("avalue");
} else {
return false;
}
if (inputValue instanceof Number && value instanceof Number) {
return ((Number) inputValue).doubleValue() > ((Number) value).doubleValue();
} else {
return false;
}
}
private boolean evaluateGREATER_OR_EQUAL(Map stringObjectMap) {
Object inputValue = null;
Object value = null;
if (stringObjectMap.containsKey("avalue")) {
inputValue = stringObjectMap.get("avalue");
} else {
return false;
}
if (inputValue instanceof Number && value instanceof Number) {
return ((Number) inputValue).doubleValue() >= ((Number) value).doubleValue();
} else {
return false;
}
}
private boolean evaluateIS_MISSING(Map stringObjectMap) {
return !stringObjectMap.containsKey("avalue");
}
private boolean evaluateIS_NOT_MISSING(Map stringObjectMap) {
return stringObjectMap.containsKey("avalue");
}
private boolean evaluateFALSE(Map stringObjectMap) {
return false;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy