Skip to content

Commit

Permalink
Deleting the repetitive methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vickybung1 committed Jan 23, 2023
1 parent 4ed0ac7 commit a5a6ccb
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/main/scala/edu/ie3/simona/scheduler/SchedulerHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -445,31 +445,22 @@ trait SchedulerHelper extends SimonaActorLogging {
context.unwatch(trig.agent)
)

/* notify listeners */
/*The usage of min is necessary because the scheduler overshoots the target tick by 1 at the end of the simulation*/
notifyListener(
Done(
Math.min(stateData.time.nowInTicks, endTick),
totalSimDuration,
stateData.runtime.noOfFailedPF,
errorInSim
)
)

/* notify start sender */
if (errorInSim) {
stateData.runtime.initSender ! SimulationFailureMessage

/* notify listeners */
notifyListener(
Done(
Math.min(stateData.time.nowInTicks, endTick),
totalSimDuration,
stateData.runtime.noOfFailedPF,
errorInSim
)
)
} else {
stateData.runtime.initSender ! SimulationSuccessfulMessage

/* notify listeners */
notifyListener(
Done(
Math.min(stateData.time.nowInTicks, endTick),
totalSimDuration,
stateData.runtime.noOfFailedPF,
errorInSim
)
)
}

/* disable schedule */
Expand Down

0 comments on commit a5a6ccb

Please sign in to comment.