Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
  • Loading branch information
EtienneLt committed Sep 20, 2024
1 parent 6c0f824 commit aaf820c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ private static Overload getOverload(LimitsContainer<LoadingLimits> limitsContain
if (Double.isNaN(i) || Double.isNaN(permanentLimit)) {
return null;
}
List<LoadingLimits.TemporaryLimit> temporaryLimits = limitsContainer.getLimits().getTemporaryLimits().stream().toList();
Collection<LoadingLimits.TemporaryLimit> temporaryLimits = limitsContainer.getLimits().getTemporaryLimits();
String previousLimitName = PERMANENT_LIMIT_NAME;
double previousLimit = permanentLimit;
int previousAcceptableDuration = 0; // never mind initialisation it will be override with first loop
for (int c = 0; c < temporaryLimits.size(); c++) { // iterate in ascending order
LoadingLimits.TemporaryLimit tl = temporaryLimits.get(c);
boolean firstIteration = true;
for (LoadingLimits.TemporaryLimit tl : temporaryLimits) { // iterate in ascending order
if (i >= previousLimit && i < tl.getValue()) {
if (c == 0) {
return new OverloadImpl(temporaryLimits.get(0), previousLimitName,
if (firstIteration) {
return new OverloadImpl(tl, previousLimitName,
limitsContainer.isDistinct() ?
((AbstractDistinctLimitsContainer<?, ?>) limitsContainer).getOriginalPermanentLimit() : previousLimit,
limitsContainer.isDistinct() ?
Expand All @@ -109,6 +109,7 @@ private static Overload getOverload(LimitsContainer<LoadingLimits> limitsContain
previousLimitName = tl.getName();
previousLimit = tl.getValue();
previousAcceptableDuration = tl.getAcceptableDuration();
firstIteration = false;
}
return null;
}
Expand Down

0 comments on commit aaf820c

Please sign in to comment.