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;
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);