From dca02becfcd4f24599fe8e4552fe3865763bd68f Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 8 Jul 2022 17:29:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=82=A1=E9=81=93=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/simulation/cbtc/CTC/CTCLogicLoop.java | 10 ++++------ .../rtss/simulation/cbtc/CTC/data/TrackView.java | 15 ++++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java index 0fa34aec7..4ea886940 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java @@ -103,9 +103,10 @@ public class CTCLogicLoop { private void trackViewUpdate(Simulation simulation) { CtcRepository ctcRepository = simulation.getCtcRepository(); for (TrackView trackView : ctcRepository.getTrackViewMap().values()) { - Set deleteTripNumbers = new HashSet<>(); for (Map lineMap : trackView.getTrackLineMap().values()) { - for (TrackView.Line line : lineMap.values()) { + Iterator lineIterator = lineMap.values().iterator(); + while (lineIterator.hasNext()) { + TrackView.Line line = lineIterator.next(); int remain = line.getRemain2Delete(); if (remain == -1) { TrackView.Process process = line.getProcess(); @@ -115,16 +116,13 @@ public class CTCLogicLoop { } else { remain -= LOGIC_RATE; if (remain <= 0) { - deleteTripNumbers.add(line.getTripNumber()); + lineIterator.remove(); } else { line.setRemain2Delete(remain); } } } } - for (String tn : deleteTripNumbers) { - trackView.getTrackLineMap().remove(tn); - } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java index 307aea545..94231427a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java @@ -1,15 +1,16 @@ package club.joylink.rtss.simulation.cbtc.CTC.data; -import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.simulation.cbtc.data.map.Station; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.Setter; -import org.springframework.util.StringUtils; -import java.util.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; /** @@ -244,18 +245,14 @@ public class TrackView { public boolean isArrive() { if (receivingRoute != null) { - if (StringUtils.hasText(receivingRoute.getItem().getActualTime())) { - return true; - } + return receivingRoute.getItem().isFinish(); } return false; } public boolean isDeparture() { if (departureRoute != null) { - if (StringUtils.hasText(departureRoute.getItem().getActualTime())) { - return true; - } + return departureRoute.getItem().isFinish(); } return false; }