From a263d0f27aaef8eb0f288462dff71720be825b96 Mon Sep 17 00:00:00 2001 From: lisrte Date: Fri, 24 Nov 2023 14:20:39 +0100 Subject: [PATCH] Fix code smells Signed-off-by: lisrte --- .../events/AbstractDynamicLibEventDisconnection.java | 3 ++- .../dynawaltz/models/events/EventActivePowerVariation.java | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java index c8493ef60..8f62d3b83 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java @@ -14,6 +14,7 @@ import static com.powsybl.dynawaltz.parameters.ParameterType.BOOL; import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static java.lang.Boolean.TRUE; /** * @author Laurent Issertial {@literal } @@ -35,7 +36,7 @@ protected AbstractDynamicLibEventDisconnection(Identifiable equipment, double @Override public String getLib() { - return equipmentHasDynamicModel.getValue() ? DYNAMIC_MODEL_LIB : DEFAULT_MODEL_LIB; + return TRUE == equipmentHasDynamicModel.getValue() ? DYNAMIC_MODEL_LIB : DEFAULT_MODEL_LIB; } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java index 53eaece1f..5c3594b25 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java @@ -21,6 +21,7 @@ import static com.powsybl.dynawaltz.parameters.ParameterType.BOOL; import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static java.lang.Boolean.TRUE; /** * @author Laurent Issertial {@literal } @@ -51,7 +52,7 @@ public static boolean isConnectable(IdentifiableType type) { @Override public String getLib() { - return equipmentHasDynamicModel.getValue() ? DYNAMIC_MODEL_LIB : DEFAULT_MODEL_LIB; + return TRUE == equipmentHasDynamicModel.getValue() ? DYNAMIC_MODEL_LIB : DEFAULT_MODEL_LIB; } @Override @@ -60,7 +61,7 @@ public String getName() { } private List getVarConnectionsWith(ControllableEquipment connected) { - return List.of(equipmentHasDynamicModel.getValue() ? new VarConnection("step_step_value", connected.getDeltaPVarName()) + return List.of(TRUE == equipmentHasDynamicModel.getValue() ? new VarConnection("step_step_value", connected.getDeltaPVarName()) : new VarConnection("event_state1", connected.getDeltaPVarName())); } @@ -74,7 +75,7 @@ public void createMacroConnections(MacroConnectionsAdder adder) { @Override protected void createEventSpecificParameters(ParametersSet paramSet) { - if (equipmentHasDynamicModel.getValue()) { + if (TRUE == equipmentHasDynamicModel.getValue()) { paramSet.addParameter("step_Value0", DOUBLE, Double.toString(0)); paramSet.addParameter("step_tStep", DOUBLE, Double.toString(getStartTime())); paramSet.addParameter("step_Height", DOUBLE, Double.toString(deltaP));