gitgabrio commented on code in PR #6519: URL: https://github.com/apache/incubator-kie-drools/pull/6519#discussion_r2533387903
########## kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/dialectHandlers/BFEELDialectHandler.java: ########## @@ -0,0 +1,292 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.kie.dmn.feel.lang.ast.dialectHandlers; + +import org.kie.dmn.feel.lang.EvaluationContext; +import org.kie.dmn.feel.lang.FEELDialect; +import org.kie.dmn.feel.lang.types.impl.ComparablePeriod; +import org.kie.dmn.feel.util.BooleanEvalHelper; + +import java.math.BigDecimal; Review Comment: Hi @ChinchuAjith Some unneeded imports, here ########## kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/infixexecutors/GteExecutor.java: ########## @@ -37,9 +36,9 @@ public static GteExecutor instance() { @Override public Object evaluate(Object left, Object right, EvaluationContext ctx) { - return or(BooleanEvalHelper.compare(left, right, ctx.getFEELDialect(), (l, r) -> l.compareTo(r) > 0), - BooleanEvalHelper.isEqual(left, right, ctx.getFEELDialect()), - ctx); // do not use Java || to avoid potential NPE due to FEEL 3vl. + Review Comment: Hi @ChinchuAjith PLease remove empty line here ########## kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/infixexecutors/AndExecutor.java: ########## @@ -37,23 +37,21 @@ public static AndExecutor instance() { @Override public Object evaluate(Object left, Object right, EvaluationContext ctx) { - return and(left, right, ctx); + DialectHandler handler = DialectHandlerFactory.getHandler(ctx); + return handler.executeAnd(left, right, ctx); } @Override public Object evaluate(InfixOpNode infixNode, EvaluationContext ctx) { - Boolean leftAND = BooleanEvalHelper.getBooleanOrDialectDefault(infixNode.getLeft().evaluate(ctx), - ctx.getFEELDialect()); - if (leftAND != null) { - if (leftAND.booleanValue()) { - return BooleanEvalHelper.getBooleanOrDialectDefault(infixNode.getRight().evaluate(ctx), - ctx.getFEELDialect()); - } else { - return Boolean.FALSE; //left hand operand is false, we do not need to evaluate right side - } - } else { - return BooleanEvalHelper.getFalseOrDialectDefault(infixNode.getRight().evaluate(ctx), ctx.getFEELDialect()); + Object leftRaw = infixNode.getLeft().evaluate(ctx); Review Comment: This also should be managed by DialectHandler ########## kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/infixexecutors/OrExecutor.java: ########## Review Comment: This also should be managed by DialectHandler ########## kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/lang/ast/infixexecutors/InfixExecutorUtilsTest.java: ########## @@ -21,26 +21,37 @@ import java.math.BigDecimal; import java.math.MathContext; import java.time.Duration; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.Period; +import java.time.temporal.TemporalField; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.function.BinaryOperator; +import java.util.function.Consumer; import java.util.function.Supplier; Review Comment: Please check unneeded imports here -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
