summaryrefslogtreecommitdiff
path: root/nlpsolver
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2020-09-25 12:00:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-09-25 17:56:55 +0200
commit92552cfdf5693b03312aa97c6e014d0c2b7c565b (patch)
tree34c6ca62678f13b99f5904d49880938a8c9371ea /nlpsolver
parentb6a26170b6145f7af057538f38fc656823726a0d (diff)
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@collabora.co.uk>
Diffstat (limited to 'nlpsolver')
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java14
1 files changed, 6 insertions, 8 deletions
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);