From 59b3acde08ea03e1cd23e648469c1e99a42daacb Mon Sep 17 00:00:00 2001 From: maissa SOUISSI Date: Sat, 8 Jun 2024 19:43:28 +0200 Subject: [PATCH] unused methods, to remove class when upgrade version powsybl Signed-off-by: maissa SOUISSI --- .../nad/build/iidm/VoltageLevelFilter.java | 55 +------------------ 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/src/main/java/com/powsybl/nad/build/iidm/VoltageLevelFilter.java b/src/main/java/com/powsybl/nad/build/iidm/VoltageLevelFilter.java index 4403d8e..f099d43 100644 --- a/src/main/java/com/powsybl/nad/build/iidm/VoltageLevelFilter.java +++ b/src/main/java/com/powsybl/nad/build/iidm/VoltageLevelFilter.java @@ -19,11 +19,8 @@ /** * @author Maissa Souissi {} */ - public class VoltageLevelFilter implements Predicate { - /* - # FIXME: to be removed at next powsybl-ws-dependencies upgrade - */ + protected static final Logger LOGGER = LoggerFactory.getLogger(VoltageLevelFilter.class); public static final Predicate NO_FILTER = voltageLevel -> true; @@ -49,49 +46,11 @@ public boolean test(VoltageLevel voltageLevel) { return voltageLevels.contains(voltageLevel); } - public static VoltageLevelFilter createVoltageLevelsFilter(Network network, List voltageLevelIds) { - return createVoltageLevelsDepthFilter(network, voltageLevelIds, 0); - } - - public static VoltageLevelFilter createVoltageLevelDepthFilter(Network network, String voltageLevelId, int depth) { - return createVoltageLevelsDepthFilter(network, List.of(voltageLevelId), depth); - } public static VoltageLevelFilter createVoltageLevelsDepthFilter(Network network, List voltageLevelIds, int depth) { return createVoltageLevelFilterWithPredicate(network, voltageLevelIds, depth, NO_FILTER); } - public static VoltageLevelFilter createNominalVoltageLowerBoundFilter(Network network, List voltageLevelIds, double nominalVoltageLowerBound, int depth) { - return createNominalVoltageFilter(network, voltageLevelIds, nominalVoltageLowerBound, Double.MAX_VALUE, depth); - } - - public static VoltageLevelFilter createNominalVoltageLowerBoundFilter(Network network, double nominalVoltageLowerBound) { - return createNominalVoltageFilter(network, nominalVoltageLowerBound, Double.MAX_VALUE); - } - - public static VoltageLevelFilter createNominalVoltageUpperBoundFilter(Network network, List voltageLevelIds, double nominalVoltageUpperBound, int depth) { - return createNominalVoltageFilter(network, voltageLevelIds, 0, nominalVoltageUpperBound, depth); - } - - public static VoltageLevelFilter createNominalVoltageUpperBoundFilter(Network network, double nominalVoltageUpperBound) { - return createNominalVoltageFilter(network, 0, nominalVoltageUpperBound); - } - - public static VoltageLevelFilter createNominalVoltageFilter(Network network, List voltageLevelIds, - double nominalVoltageLowerBound, double nominalVoltageUpperBound, - int depth) { - return createVoltageLevelFilterWithPredicate(network, voltageLevelIds, depth, getPredicateFromNominalVoltageBounds(nominalVoltageLowerBound, nominalVoltageUpperBound)); - } - - public static VoltageLevelFilter createNominalVoltageFilter(Network network, double nominalVoltageLowerBound, double nominalVoltageUpperBound) { - return createNominalVoltageFilterWithPredicate(network, getPredicateFromNominalVoltageBounds(nominalVoltageLowerBound, nominalVoltageUpperBound)); - } - - private static Predicate getPredicateFromNominalVoltageBounds(double nominalVoltageLowerBound, double nominalVoltageUpperBound) { - checkVoltageBoundValues(nominalVoltageLowerBound, nominalVoltageUpperBound); - return voltageLevel -> voltageLevel.getNominalV() >= nominalVoltageLowerBound && voltageLevel.getNominalV() <= nominalVoltageUpperBound; - } - public static VoltageLevelFilter createVoltageLevelFilterWithPredicate(Network network, List voltageLevelIds, int depth, Predicate voltageLevelPredicate) { Objects.requireNonNull(network); Objects.requireNonNull(voltageLevelIds); @@ -112,9 +71,6 @@ public static VoltageLevelFilter createVoltageLevelFilterWithPredicate(Network n return new VoltageLevelFilter(voltageLevels); } - public static VoltageLevelFilter createNominalVoltageFilterWithPredicate(Network network, Predicate voltageLevelPredicate) { - return new VoltageLevelFilter(network.getVoltageLevelStream().filter(voltageLevelPredicate).collect(Collectors.toSet())); - } public static Collection getNextDepthVoltageLevels(Network network, List voltageLevels) { List voltageLevelIds = voltageLevels.stream().map(VoltageLevel::getId).collect(Collectors.toList()); @@ -138,15 +94,6 @@ private static void traverseVoltageLevels(Set voltageLevelsDepth, traverseVoltageLevels(nextDepthVoltageLevels, depth - 1, visitedVoltageLevels, predicate); } - private static void checkVoltageBoundValues(double nominalVoltageLowerBound, double nominalVoltageUpperBound) { - if (nominalVoltageLowerBound < 0 || nominalVoltageUpperBound < 0) { - throw new PowsyblException("Voltage bounds must be positive"); - } - if (nominalVoltageLowerBound > nominalVoltageUpperBound) { - throw new PowsyblException("Low bound must be less than or equal to high bound"); - } - } - private static class VlVisitor extends DefaultTopologyVisitor { private final Set nextDepthVoltageLevels; private final Set visitedVoltageLevels;