Commit e8af1b77 authored by Marion Goedel's avatar Marion Goedel
Browse files

[BugFix] in NumberOverlapsProcessor. Before, the occurrences of overlaps were...

[BugFix] in NumberOverlapsProcessor. Before, the occurrences of overlaps were counted and divided by two (since in at least two pedestrians were part of each overlap). Now the number of overlaps is counted for each pedestrian and the result is divided by two. Also, the number displayed in the infoBox (if uncommented) was corrected.
parent 9b60dc34
Pipeline #65040 failed with stages
in 47 seconds
......@@ -47,17 +47,13 @@ public class NumberOverlapsProcessor extends DataProcessor<NoDataKey, Long> {
public void postLoop(final SimulationState state) {
this.pedOverlapProc.postLoop(state);
long numberOverlaps = 0;
long numberOverlaps = this.pedOverlapProc.getValues().stream().mapToInt(val -> val.intValue()).sum() / 2;
if (this.pedOverlapProc.getValues().size() > 0) {
numberOverlaps = this.pedOverlapProc.getValues().stream().filter(i -> i == 1).count()/2;
}
/* // Uncomment this code if you want to get the info box with the number of overlaps
if (numberOverlaps > 0 ) {
NumberOverlapsProcessor.infoBox(numberOverlaps/2 + " Overlaps have occured during the simulation!", "Number Overlaps");
System.out.println("* CAREFUL *: " + numberOverlaps/2 + " Overlaps have occured during the simulation!");
NumberOverlapsProcessor.infoBox(numberOverlaps + " Overlaps have occured during the simulation!", "Number Overlaps");
System.out.println("* CAREFUL *: " + numberOverlaps + " Overlaps have occured during the simulation!");
}else{
NumberOverlapsProcessor.infoBox("No Overlaps have occured during the simulation :)", "Number Overlaps");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment