Skip to content

Commit

Permalink
Keep same order for run methods
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Feb 11, 2022
1 parent b4743c3 commit b68ff69
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ private Runner(SecurityAnalysisProvider provider) {

public CompletableFuture<SecurityAnalysisReport> runAsync(Network network,
String workingStateId,
LimitViolationDetector detector,
LimitViolationFilter filter,
ComputationManager computationManager,
SecurityAnalysisParameters parameters,
ContingenciesProvider contingenciesProvider,
SecurityAnalysisParameters parameters,
ComputationManager computationManager,
LimitViolationFilter filter,
LimitViolationDetector detector,
List<SecurityAnalysisInterceptor> interceptors,
List<StateMonitor> monitors) {
Objects.requireNonNull(network, "Network should not be null");
Expand All @@ -69,7 +69,7 @@ public CompletableFuture<SecurityAnalysisReport> runAsync(Network network,
}

public CompletableFuture<SecurityAnalysisReport> runAsync(Network network, ContingenciesProvider contingenciesProvider, SecurityAnalysisParameters parameters, ComputationManager computationManager, LimitViolationFilter filter) {
return runAsync(network, network.getVariantManager().getWorkingVariantId(), new DefaultLimitViolationDetector(), filter, computationManager, parameters, contingenciesProvider, Collections.emptyList(), Collections.emptyList());
return runAsync(network, network.getVariantManager().getWorkingVariantId(), contingenciesProvider, parameters, computationManager, filter, new DefaultLimitViolationDetector(), Collections.emptyList(), Collections.emptyList());
}

public CompletableFuture<SecurityAnalysisReport> runAsync(Network network, ContingenciesProvider contingenciesProvider, SecurityAnalysisParameters parameters, ComputationManager computationManager) {
Expand All @@ -86,28 +86,29 @@ public CompletableFuture<SecurityAnalysisReport> runAsync(Network network, List<

public SecurityAnalysisReport run(Network network,
String workingStateId,
LimitViolationDetector detector,
LimitViolationFilter filter,
ComputationManager computationManager,
SecurityAnalysisParameters parameters,
ContingenciesProvider contingenciesProvider,
SecurityAnalysisParameters parameters,
ComputationManager computationManager,
LimitViolationFilter filter,
LimitViolationDetector detector,
List<SecurityAnalysisInterceptor> interceptors) {
return runAsync(network, workingStateId, detector, filter, computationManager, parameters, contingenciesProvider, interceptors, Collections.emptyList()).join();
return runAsync(network, workingStateId, contingenciesProvider, parameters, computationManager, filter, detector, interceptors, Collections.emptyList()).join();
}

public SecurityAnalysisReport run(Network network,
String workingStateId,
LimitViolationDetector detector,
LimitViolationFilter filter,
ComputationManager computationManager,
SecurityAnalysisParameters parameters,
ContingenciesProvider contingenciesProvider,
List<SecurityAnalysisInterceptor> interceptors, List<StateMonitor> monitors) {
return runAsync(network, workingStateId, detector, filter, computationManager, parameters, contingenciesProvider, interceptors, monitors).join();
SecurityAnalysisParameters parameters,
ComputationManager computationManager,
LimitViolationFilter filter,
LimitViolationDetector detector,
List<SecurityAnalysisInterceptor> interceptors,
List<StateMonitor> monitors) {
return runAsync(network, workingStateId, contingenciesProvider, parameters, computationManager, filter, detector, interceptors, monitors).join();
}

public SecurityAnalysisReport run(Network network, ContingenciesProvider contingenciesProvider, SecurityAnalysisParameters parameters, ComputationManager computationManager, LimitViolationFilter filter) {
return run(network, network.getVariantManager().getWorkingVariantId(), new DefaultLimitViolationDetector(), filter, computationManager, parameters, contingenciesProvider, Collections.emptyList());
return run(network, network.getVariantManager().getWorkingVariantId(), contingenciesProvider, parameters, computationManager, filter, new DefaultLimitViolationDetector(), Collections.emptyList());
}

public SecurityAnalysisReport run(Network network, ContingenciesProvider contingenciesProvider, SecurityAnalysisParameters parameters, ComputationManager computationManager) {
Expand Down Expand Up @@ -158,13 +159,13 @@ public static Runner find() {

public static CompletableFuture<SecurityAnalysisReport> runAsync(Network network,
String workingStateId,
LimitViolationDetector detector,
LimitViolationFilter filter,
ComputationManager computationManager,
SecurityAnalysisParameters parameters,
ContingenciesProvider contingenciesProvider,
SecurityAnalysisParameters parameters,
ComputationManager computationManager,
LimitViolationFilter filter,
LimitViolationDetector detector,
List<SecurityAnalysisInterceptor> interceptors) {
return find().runAsync(network, workingStateId, detector, filter, computationManager, parameters, contingenciesProvider, interceptors, Collections.emptyList());
return find().runAsync(network, workingStateId, contingenciesProvider, parameters, computationManager, filter, detector, interceptors, Collections.emptyList());
}

public static CompletableFuture<SecurityAnalysisReport> runAsync(Network network, ContingenciesProvider contingenciesProvider,
Expand All @@ -189,24 +190,25 @@ public static CompletableFuture<SecurityAnalysisReport> runAsync(Network network

public static SecurityAnalysisReport run(Network network,
String workingStateId,
LimitViolationDetector detector,
LimitViolationFilter filter,
ComputationManager computationManager,
SecurityAnalysisParameters parameters,
ContingenciesProvider contingenciesProvider,
SecurityAnalysisParameters parameters,
ComputationManager computationManager,
LimitViolationFilter filter,
LimitViolationDetector detector,
List<SecurityAnalysisInterceptor> interceptors) {
return find().run(network, workingStateId, detector, filter, computationManager, parameters, contingenciesProvider, interceptors);
return find().run(network, workingStateId, contingenciesProvider, parameters, computationManager, filter, detector, interceptors);
}

public static SecurityAnalysisReport run(Network network,
String workingStateId,
LimitViolationDetector detector,
LimitViolationFilter filter,
ComputationManager computationManager,
SecurityAnalysisParameters parameters,
ContingenciesProvider contingenciesProvider,
List<SecurityAnalysisInterceptor> interceptors, List<StateMonitor> monitors) {
return find().run(network, workingStateId, detector, filter, computationManager, parameters, contingenciesProvider, interceptors, monitors);
SecurityAnalysisParameters parameters,
ComputationManager computationManager,
LimitViolationFilter filter,
LimitViolationDetector detector,
List<SecurityAnalysisInterceptor> interceptors,
List<StateMonitor> monitors) {
return find().run(network, workingStateId, contingenciesProvider, parameters, computationManager, filter, detector, interceptors, monitors);
}

public static SecurityAnalysisReport run(Network network, ContingenciesProvider contingenciesProvider, SecurityAnalysisParameters parameters, ComputationManager computationManager, LimitViolationFilter filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ public CompletableFuture<SecurityAnalysisReport> execute(ComputationManager comp
SecurityAnalysisInput input = buildInput(data);
return runner.runAsync(input.getNetworkVariant().getNetwork(),
input.getNetworkVariant().getVariantId(),
input.getLimitViolationDetector(),
input.getFilter(),
computationManager,
input.getParameters(),
input.getContingenciesProvider(),
input.getContingenciesProvider(), input.getParameters(), computationManager, input.getFilter(), input.getLimitViolationDetector(),
new ArrayList<>(input.getInterceptors()), data.getMonitors());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testDefaultProvider() {

@Test
public void testAsyncDefaultProvider() throws InterruptedException, ExecutionException {
CompletableFuture<SecurityAnalysisReport> report = SecurityAnalysis.runAsync(network, "v", detector, filter, computationManager, parameters, contingenciesProvider, interceptors);
CompletableFuture<SecurityAnalysisReport> report = SecurityAnalysis.runAsync(network, "v", contingenciesProvider, parameters, computationManager, filter, detector, interceptors);
assertNotNull(report.get());
}

Expand All @@ -92,13 +92,13 @@ public void testAsyncDefaultProviderWithMiminumArguments() throws InterruptedExc

@Test
public void testSyncDefaultProvider() {
SecurityAnalysisReport report = SecurityAnalysis.run(network, "v", detector, filter, computationManager, parameters, contingenciesProvider, interceptors);
SecurityAnalysisReport report = SecurityAnalysis.run(network, "v", contingenciesProvider, parameters, computationManager, filter, detector, interceptors);
assertNotNull(report);
}

@Test
public void testSyncDefaultProviderMonitor() {
SecurityAnalysisReport report = SecurityAnalysis.run(network, "v", detector, filter, computationManager, parameters, contingenciesProvider, interceptors, monitors);
SecurityAnalysisReport report = SecurityAnalysis.run(network, "v", contingenciesProvider, parameters, computationManager, filter, detector, interceptors, monitors);
assertNotNull(report);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ public void run() {

SecurityAnalysisReport report = SecurityAnalysis.run(network,
VariantManagerConstants.INITIAL_VARIANT_ID,
detector,
filter,
computationManager,
SecurityAnalysisParameters.load(platformConfig),
contingenciesProvider,
contingenciesProvider, SecurityAnalysisParameters.load(platformConfig), computationManager, filter, detector,
interceptors);

SecurityAnalysisResult result = report.getResult();
Expand Down Expand Up @@ -151,11 +147,7 @@ public void runWithoutContingency() {

SecurityAnalysisReport report = SecurityAnalysis.run(network,
VariantManagerConstants.INITIAL_VARIANT_ID,
new DefaultLimitViolationDetector(),
new LimitViolationFilter(),
computationManager,
SecurityAnalysisParameters.load(platformConfig),
contingenciesProvider,
contingenciesProvider, SecurityAnalysisParameters.load(platformConfig), computationManager, new LimitViolationFilter(), new DefaultLimitViolationDetector(),
interceptors);
SecurityAnalysisResult result = report.getResult();

Expand Down

0 comments on commit b68ff69

Please sign in to comment.