【注释信号机的进路条件筛选、空指针异常解决】
This commit is contained in:
parent
c2af1f6fea
commit
068df9d1db
@ -214,7 +214,7 @@ public enum BgSceneStatusRule {
|
|||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Signal signal = (Signal) mapElement;
|
Signal signal = (Signal) mapElement;
|
||||||
Route route = signal.getRouteList().stream()
|
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);
|
.findFirst().orElse(null);
|
||||||
if (route == null) {
|
if (route == null) {
|
||||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||||
|
@ -595,7 +595,13 @@ public enum MapDeviceRule {
|
|||||||
return route.getStart().isCallOn() && route.isGuide();
|
return route.getStart().isCallOn() && route.isGuide();
|
||||||
}), NUMBER);
|
}), 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;
|
private String description;
|
||||||
@ -794,7 +800,7 @@ public enum MapDeviceRule {
|
|||||||
*/
|
*/
|
||||||
private static List<Route> queryNormalRouteList(Simulation simulation, Function<Route, Boolean> filterFun) {
|
private static List<Route> queryNormalRouteList(Simulation simulation, Function<Route, Boolean> filterFun) {
|
||||||
return simulation.getRepository().getRouteList().stream().filter(route -> {
|
return simulation.getRepository().getRouteList().stream().filter(route -> {
|
||||||
if (route.getInterlockStation().isDepot()) { // 停车场进路排除
|
if (route.getInterlockStation() == null || route.getInterlockStation().isDepot()) { // 停车场进路排除
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (route.getStart() == null || route.getDestination() == null) {
|
if (route.getStart() == null || route.getDestination() == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user