@Test public void testHvdc() { Network network = HvdcTestNetwork.createLcc(); assertEquals(1, network.getHvdcLineCount()); NetworkReducerObserverImpl observer = new NetworkReducerObserverImpl(); NetworkReducer reducer = NetworkReducer.builder() .withNetworkPredicate(IdentifierNetworkPredicate.of("VL1", "VL2")) .withObservers(observer) .build(); reducer.reduce(network); assertEquals(1, network.getHvdcLineCount()); assertEquals(0, observer.getHvdcLineReplacedCount()); assertEquals(0, observer.getHvdcLineRemovedCount()); reducer = NetworkReducer.builder() .withNetworkPredicate(new IdentifierNetworkPredicate(Collections.emptyList())) .withObservers(Collections.singleton(observer)) .build(); reducer.reduce(network); assertEquals(0, network.getHvdcLineCount()); assertEquals(0, observer.getHvdcLineReplacedCount()); assertEquals(1, observer.getHvdcLineRemovedCount()); }
@Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, NetworkReducerObserver... observers);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, List<NetworkReducerObserver> observers); }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, NetworkReducerObserver... observers);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, List<NetworkReducerObserver> observers);  }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, NetworkReducerObserver... observers);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, List<NetworkReducerObserver> observers);   }