Skip to content

Commit

Permalink
removed unnecessary check
Browse files Browse the repository at this point in the history
  • Loading branch information
phiedw committed Jun 8, 2023
1 parent 96caf7f commit bfd5d1e
Showing 1 changed file with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private UcteMatchingResult lookForMatchWithinCollection(String fromNodeId, Strin
if (matchedConnectables.size() == 1) {
return matchedConnectables.get(0);
} else if (matchedConnectables.size() == 2) {
return checkIfTieLineOrSeveralMatch(matchedConnectables);
return UcteMatchingResult.severalPossibleMatch();
} else if (matchedConnectables.size() > 2) {
return UcteMatchingResult.severalPossibleMatch();
} else {
Expand All @@ -139,24 +139,6 @@ private UcteMatchingResult lookForMatchWithinCollection(String fromNodeId, Strin
}
}

private UcteMatchingResult checkIfTieLineOrSeveralMatch(List<UcteMatchingResult> matchedConnectables) {
Identifiable<?> identifiable1 = matchedConnectables.get(0).getIidmIdentifiable();
Identifiable<?> identifiable2 = matchedConnectables.get(1).getIidmIdentifiable();

if (identifiable1 instanceof DanglingLine && identifiable2 instanceof TieLine &&
tieLineContainsDanglingLine((TieLine) identifiable2, (DanglingLine) identifiable1)) {
return matchedConnectables.get(1);
} else if (identifiable2 instanceof DanglingLine && identifiable1 instanceof TieLine &&
tieLineContainsDanglingLine((TieLine) identifiable1, (DanglingLine) identifiable2)) {
return matchedConnectables.get(0);
}
return UcteMatchingResult.severalPossibleMatch();
}

private boolean tieLineContainsDanglingLine(TieLine tieLine, DanglingLine danglingLine) {
return tieLine.getDanglingLine1().equals(danglingLine) || tieLine.getDanglingLine2().equals(danglingLine);
}

private void addBranches(Network network) {
network.getBranchStream().forEach(branch -> {
String from = getNodeName(branch.getTerminal1().getBusBreakerView().getConnectableBus().getId());
Expand Down

0 comments on commit bfd5d1e

Please sign in to comment.