【注释信号机的进路条件筛选、空指针异常解决】

This commit is contained in:
weizhihong 2022-12-22 13:06:47 +08:00
parent c2af1f6fea
commit 068df9d1db
2 changed files with 9 additions and 3 deletions

View File

@ -214,7 +214,7 @@ public enum BgSceneStatusRule {
public String doHandle(Simulation simulation, MapElement mapElement) {
Signal signal = (Signal) mapElement;
Route route = signal.getRouteList().stream()
.filter(r -> r.getSwitchList().stream().allMatch(switchElement -> switchElement.isNormal()))
// .filter(r -> r.getSwitchList().stream().allMatch(switchElement -> switchElement.isNormal()))
.findFirst().orElse(null);
if (route == null) {
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);

View File

@ -595,7 +595,13 @@ public enum MapDeviceRule {
return route.getStart().isCallOn() && route.isGuide();
}), NUMBER);
}
},
ROUTE_DEPARTURE_LIST("发车进路列表") {
@Override
public List<Route> filterMapDeviceList(Simulation simulation) {
return generateRandomElement(queryNormalRouteList(simulation, route -> Objects.equals(Route.Type.DEPARTURE, route.getType())), NUMBER);
}
},
;
private String description;
@ -794,7 +800,7 @@ public enum MapDeviceRule {
*/
private static List<Route> queryNormalRouteList(Simulation simulation, Function<Route, Boolean> filterFun) {
return simulation.getRepository().getRouteList().stream().filter(route -> {
if (route.getInterlockStation().isDepot()) { // 停车场进路排除
if (route.getInterlockStation() == null || route.getInterlockStation().isDepot()) { // 停车场进路排除
return false;
}
if (route.getStart() == null || route.getDestination() == null) {