From 3c9aeb82f679b270dfd67230ac26408319d1e9e4 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Thu, 10 Oct 2024 17:57:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E8=BF=90=E8=A1=8C=E5=9B=BE?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/ATS/data/SortDiagramStation.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java index a2280d05f..b3553d70f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java @@ -46,7 +46,14 @@ public class SortDiagramStation { private Station findNotDepotStation(boolean isRight, int index) { - Station station = stationList.get(index); + Station station = null; + if (index >= stationList.size()) { + station = stationList.get(stationList.size() - 1); + } else if (index <= 0) { + station = stationList.get(0); + } else { + station = stationList.get(index); + } while (station.isDepot()) { index += isRight ? -1 : 1; station = stationList.get(index);