Skip to content

Commit

Permalink
Merge pull request #48 from seime/fix_double_parsing_2
Browse files Browse the repository at this point in the history
Another fix for handling double values in rule conditions.
  • Loading branch information
seaside1 authored Sep 20, 2022
2 parents 229d505 + edfd6f7 commit d6d2b78
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,20 @@ private Boolean evaluateComparatorParameters(Double gt, Double gte, Double lt, D
return stateValue.equals(eq);
} else if (neq != null) {
return !stateValue.equals(neq);
} else if (gt != null) {
return getValueAsDouble(stateValue) > gt;
} else if (gte != null) {
return getValueAsDouble(stateValue) >= gte;
} else if (lt != null) {
return getValueAsDouble(stateValue) < lt;
} else if (lte != null) {
return getValueAsDouble(stateValue) <= lte;
} else {
// valueAsDouble may be null if unparseable ("NULL" or "UNDEF")
Double valueAsDouble = getValueAsDouble(stateValue);
if (valueAsDouble == null) {
return null;
} else if (gt != null) {
return valueAsDouble > gt;
} else if (gte != null) {
return valueAsDouble >= gte;
} else if (lt != null) {
return valueAsDouble < lt;
} else if (lte != null) {
return valueAsDouble <= lte;
}
}
return null;
}
Expand Down

0 comments on commit d6d2b78

Please sign in to comment.