Skip to content

Commit

Permalink
re-write if-else control && fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
yichen88 committed Oct 30, 2017
1 parent e400d68 commit 1ffb2aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,11 @@ public static Map<String, Boolean> runTDSimulation(Network network, Set<String>
tdSimulationResults.put(EMPTY_CONTINGENCY_ID, true);
}
// check if there are contingencies to run impact analysis
boolean runAnalysis = false;
if (contingencyIds == null && contingencyDb.getContingencies(network).size() == 0) {
runAnalysis = true;
}
if (contingencyIds != null && !contingencyIds.isEmpty()) {
runAnalysis = true;
boolean runAnalysis;
if (contingencyIds == null) {
runAnalysis = contingencyDb.getContingencies(network).size() != 0 ? true : false;
} else {
runAnalysis = !contingencyIds.isEmpty() ? true : false;
}
if (runAnalysis) {
// run impact analysis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ public void run(CommandLine line, ToolRunningContext context) throws Exception {
private void printStateContingencyViolations(TableFormatter formatter, Integer stateId, String contingencyId, List<LimitViolation> violations,
LimitViolationFilter violationsFilter) {
if (violations != null) {
List<LimitViolation> filtedViolations = violations;
List<LimitViolation> filteredViolations = violations;
if (violationsFilter != null) {
filtedViolations = violationsFilter.apply(violations);
filteredViolations = violationsFilter.apply(violations);
}
filtedViolations
filteredViolations
.stream()
.sorted(Comparator.comparing(o -> o.getSubjectId()))
.forEach(violation -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ public void run(CommandLine line, ToolRunningContext context) throws Exception {
private void printStateStepViolations(TableFormatter formatter, Integer stateId, OnlineStep step, List<LimitViolation> violations,
LimitViolationFilter violationsFilter) {
if (violations != null) {
List<LimitViolation> filtedViolations = violations;
List<LimitViolation> filteredViolations = violations;
if (violationsFilter != null) {
filtedViolations = violationsFilter.apply(violations);
filteredViolations = violationsFilter.apply(violations);
}
filtedViolations
filteredViolations
.stream()
.sorted((o1, o2) -> o1.getSubjectId().compareTo(o2.getSubjectId()))
.forEach(violation -> {
Expand Down

0 comments on commit 1ffb2aa

Please sign in to comment.