Skip to content

Commit

Permalink
Simplify logic when converting unary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
opatrascoiu committed May 17, 2024
1 parent a1b294b commit ec4e957
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,12 @@ public UnaryTests<T> toAny() {
}

public PositiveUnaryTest<T> toPositiveUnaryTest(Expression<T> expression) {
if (expression instanceof SimplePositiveUnaryTest) {
// since DMN 1.1
return (PositiveUnaryTest<T>) expression;
} else if (expression instanceof NullTest) {
if (expression instanceof PositiveUnaryTest) {
// since DMN 1.1
return (PositiveUnaryTest<T>) expression;
} else if (expression instanceof NullLiteral) {
// since DMN 1.1
return toNullPositiveUnaryTest();
} else if (expression instanceof NamedExpression || expression instanceof PathExpression) {
// since DMN 1.1
return toOperatorRange(null, expression);
} else if (expression instanceof SimpleLiteral) {
// since DMN 1.1
return toOperatorRange(null, expression);
Expand All @@ -219,9 +213,6 @@ public PositiveUnaryTest<T> toPositiveUnaryTest(Expression<T> expression) {
}
}
return toListTest((ListLiteral<T>) toListLiteral(puts));
} else if (expression instanceof ExpressionTest) {
// since DMN 1.2
return (PositiveUnaryTest<T>) expression;
} else {
// Since DMN 1.2
if (containsQuestionMark(expression)) {
Expand Down

0 comments on commit ec4e957

Please sign in to comment.