Skip to content

Commit

Permalink
Merge pull request #3064 from moia-oss/fixSharingMetricsTracker
Browse files Browse the repository at this point in the history
FIx: ensure proper reset in sharing metrics tracker
  • Loading branch information
steffenaxer authored Jan 22, 2024
2 parents 6c3b3cf + b1a10f1 commit bb27768
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author nkuehnel / MOIA
*/
public class SharingMetricsTracker implements DrtRequestSubmittedEventHandler, PassengerPickedUpEventHandler, PassengerDroppedOffEventHandler, MobsimBeforeCleanupListener {
public class SharingMetricsTracker implements DrtRequestSubmittedEventHandler, PassengerPickedUpEventHandler, PassengerDroppedOffEventHandler {

private final static Logger logger = LogManager.getLogger(SharingMetricsTracker.class);

Expand Down Expand Up @@ -122,7 +122,7 @@ public void handleEvent(PassengerPickedUpEvent event) {
}

@Override
public void notifyMobsimBeforeCleanup(MobsimBeforeCleanupEvent e) {
public void reset(int iteration) {
occupancyByVehicle.clear();
segments.clear();
poolingRate.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testDrtSharingFactorHandler() {
}

//clean up
sharingFactorTracker.notifyMobsimBeforeCleanup(null);
sharingFactorTracker.reset(0);

{
//two trips exactly after each other, no pooling
Expand Down Expand Up @@ -82,7 +82,7 @@ public void testDrtSharingFactorHandler() {
}

//clean up
sharingFactorTracker.notifyMobsimBeforeCleanup(null);
sharingFactorTracker.reset(0);

{
//two trips overlap half of the time
Expand Down Expand Up @@ -112,7 +112,7 @@ public void testDrtSharingFactorHandler() {


//clean up
sharingFactorTracker.notifyMobsimBeforeCleanup(null);
sharingFactorTracker.reset(0);

{
// second trip (sharing factor = 2) happens completely within first trip (sharing factor = 1.2)
Expand Down Expand Up @@ -142,7 +142,7 @@ public void testDrtSharingFactorHandler() {
}

//clean up
sharingFactorTracker.notifyMobsimBeforeCleanup(null);
sharingFactorTracker.reset(0);

{
// two persons share exact same trip but not part of a group
Expand Down Expand Up @@ -174,7 +174,7 @@ public void testDrtSharingFactorHandler() {


//clean up
sharingFactorTracker.notifyMobsimBeforeCleanup(null);
sharingFactorTracker.reset(0);

{
// two persons part of a group -> not pooled
Expand Down

0 comments on commit bb27768

Please sign in to comment.