From 26f96fed021af34753a0e8eb1e26e872037e16fd Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 4 Aug 2022 16:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=89=A7=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=AE=9E=E4=BD=93=E4=BF=AE=E6=94=B9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/data/storage/StorageSimulation.java | 3 +++ .../cbtc/data/storage/StorageSimulationDataRepository.java | 4 +++- .../storage/ctc/StorageSimulationCtcDataRepository.java | 7 +++++++ .../simulation/cbtc/data/storage/device/StorageSignal.java | 5 ++--- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulation.java index f35aacc9b..4f31272c5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulation.java @@ -63,6 +63,9 @@ public class StorageSimulation { this.planLoaded = simulation.isPlanLoaded(); this.repository = new StorageSimulationDataRepository(simulation.getRepository(), script); this.ctcDataRepository = new StorageSimulationCtcDataRepository(simulation.getCtcRepository()); + if (!this.ctcDataRepository.isNotEmpty()) { + this.ctcDataRepository = null; + } } public void recover2Simulation(Simulation simulation) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulationDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulationDataRepository.java index 61239e915..da884733e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulationDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/StorageSimulationDataRepository.java @@ -289,7 +289,9 @@ public class StorageSimulationDataRepository { this.usedTrainList = tempUsedTrainList; } // 有状态的进路列表 - this.settingRouteList = new ArrayList<>(repository.getSettingRouteMap().keySet()); + if (!repository.getSettingRouteMap().isEmpty()) { + this.settingRouteList = new ArrayList<>(repository.getSettingRouteMap().keySet()); + } } public void recover2Simulation(Simulation simulation, SimulationDataRepository repository) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/ctc/StorageSimulationCtcDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/ctc/StorageSimulationCtcDataRepository.java index 9dc0f6d39..e49bb87e4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/ctc/StorageSimulationCtcDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/ctc/StorageSimulationCtcDataRepository.java @@ -159,4 +159,11 @@ public class StorageSimulationCtcDataRepository { this.dispatchCommandList.forEach(command -> repository.addDispatchCommand(command.recover2Simulation(simulation))); } } + + public boolean isNotEmpty() { + return this.storageCtcZoneData != null || this.storageCtcEffectData != null || this.runPlanLogList != null + || this.routeSequenceMap != null || this.ticketId != null || this.railTicketList != null + || this.greenLicensesList != null || this.redLicenseList != null || this.dispatchCommandId != null + || this.dispatchCommandList != null; + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java index 175ffa2c6..2854854ff 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java @@ -4,7 +4,6 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; @@ -105,7 +104,7 @@ public class StorageSignal extends StorageDelayUnlockDevice { change = true; this.setBlockade(signal.isBlockade()); } - if (signal.getLevel() != 1) { + if (signal.getLevel() != 1 && signal.getLevel() != 0) { change = true; this.setLevel(signal.getLevel()); } @@ -117,7 +116,7 @@ public class StorageSignal extends StorageDelayUnlockDevice { change = true; this.setFpl(signal.isFpl()); } - if (!signal.isLogicLight()) { + if (signal.isLogicLight()) { change = true; this.setLogicLight(signal.isLogicLight()); }