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>
This commit is contained in:
Noel Grandin 2020-09-25 12:00:32 +02:00 committed by Noel Grandin
parent b6a26170b6
commit 92552cfdf5

View File

@ -356,23 +356,21 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
boolean result = true; boolean result = true;
for (int i = 0; i < m_constraintCount && result; i++) { for (int i = 0; i < m_constraintCount && result; i++) {
if (m_extConstraints[i].Left.getError() == 0) { if (m_extConstraints[i].Left.getError() == 0) {
Double value, targetValue; double value = m_extConstraints[i].getLeftValue();
double targetValue = m_extConstraints[i].Data;
value = m_extConstraints[i].getLeftValue();
targetValue = m_extConstraints[i].Data;
switch (m_extConstraints[i].Operator.getValue()) { switch (m_extConstraints[i].Operator.getValue()) {
case SolverConstraintOperator.EQUAL_value: case SolverConstraintOperator.EQUAL_value:
result = (targetValue != null && value.equals(targetValue)); result = value == targetValue;
break; break;
case SolverConstraintOperator.GREATER_EQUAL_value: case SolverConstraintOperator.GREATER_EQUAL_value:
result = (targetValue != null && value >= targetValue); result = value >= targetValue;
break; break;
case SolverConstraintOperator.LESS_EQUAL_value: case SolverConstraintOperator.LESS_EQUAL_value:
result = (targetValue != null && value <= targetValue); result = value <= targetValue;
break; break;
case SolverConstraintOperator.INTEGER_value: case SolverConstraintOperator.INTEGER_value:
result = (Math.rint(value) == value); result = Math.rint(value) == value;
break; break;
case SolverConstraintOperator.BINARY_value: case SolverConstraintOperator.BINARY_value:
result = (value == 0.0 || value == 1.0); result = (value == 0.0 || value == 1.0);