[Libreoffice-commits] core.git: nlpsolver/src

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 25 15:57:38 UTC 2020


 nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java |   14 ++++------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 92552cfdf5693b03312aa97c6e014d0c2b7c565b
Author:     Noel Grandin <noel at peralex.com>
AuthorDate: Fri Sep 25 12:00:32 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 25 17:56:55 2020 +0200

    value and targetValue cannot be null at this point
    
    Change-Id: I175da8a170fcddca083ed47b41c7241433e54db0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103383
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
index f5b3f0018cef..b33d77a438d9 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
@@ -356,23 +356,21 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
         boolean result = true;
         for (int i = 0; i < m_constraintCount && result; i++) {
             if (m_extConstraints[i].Left.getError() == 0) {
-                Double value, targetValue;
-
-                value = m_extConstraints[i].getLeftValue();
-                targetValue = m_extConstraints[i].Data;
+                double value = m_extConstraints[i].getLeftValue();
+                double targetValue = m_extConstraints[i].Data;
 
                 switch (m_extConstraints[i].Operator.getValue()) {
                     case SolverConstraintOperator.EQUAL_value:
-                        result = (targetValue != null && value.equals(targetValue));
+                        result = value == targetValue;
                         break;
                     case SolverConstraintOperator.GREATER_EQUAL_value:
-                        result = (targetValue != null && value >= targetValue);
+                        result = value >= targetValue;
                         break;
                     case SolverConstraintOperator.LESS_EQUAL_value:
-                        result = (targetValue != null && value <= targetValue);
+                        result = value <= targetValue;
                         break;
                     case SolverConstraintOperator.INTEGER_value:
-                        result = (Math.rint(value) == value);
+                        result = Math.rint(value) == value;
                         break;
                     case SolverConstraintOperator.BINARY_value:
                         result = (value == 0.0 || value == 1.0);


More information about the Libreoffice-commits mailing list