Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
57a4ce1c5c
@ -74,6 +74,14 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
|||||||
*/
|
*/
|
||||||
private SwitchIndication pos;
|
private SwitchIndication pos;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人工设置
|
||||||
|
*/
|
||||||
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
|
private Boolean auto;
|
||||||
|
|
||||||
public StorageSwitch(Switch aSwitch) {
|
public StorageSwitch(Switch aSwitch) {
|
||||||
super(aSwitch);
|
super(aSwitch);
|
||||||
}
|
}
|
||||||
@ -129,6 +137,10 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
|||||||
change = true;
|
change = true;
|
||||||
this.setPos(s.getPos());
|
this.setPos(s.getPos());
|
||||||
}
|
}
|
||||||
|
if (!s.isAuto()) {
|
||||||
|
change = true;
|
||||||
|
this.setAuto(Boolean.FALSE);
|
||||||
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,5 +168,8 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
|||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
s.setPos(pos);
|
s.setPos(pos);
|
||||||
}
|
}
|
||||||
|
if (auto != null) {
|
||||||
|
s.setAuto(auto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,17 @@ public enum BgSceneStatusRule {
|
|||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
SWITCH_NP_NB_BG_SCENE("宁波道岔定位背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Switch iSwitch = (Switch) mapElement;
|
||||||
|
iSwitch.setAuto(false);
|
||||||
|
iSwitch.setDispatcherReserve(true);
|
||||||
|
setSingleSwitchPositionDirectly(iSwitch, false);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 道岔解封背景:将道岔设置为封锁
|
* 道岔解封背景:将道岔设置为封锁
|
||||||
*/
|
*/
|
||||||
@ -276,6 +287,14 @@ public enum BgSceneStatusRule {
|
|||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SIGNAL_UN_BLOCK_BG_SCENE("信号机解封锁背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Signal signal = (Signal) mapElement;
|
||||||
|
signal.setBlockade(true);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 区段区故解背景
|
* 区段区故解背景
|
||||||
*/
|
*/
|
||||||
@ -385,6 +404,15 @@ public enum BgSceneStatusRule {
|
|||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SECTION_CLOSE_BG_SCENE("轨道开放背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Section section = (Section) mapElement;
|
||||||
|
section.setCloseInit(false);
|
||||||
|
section.setClosed(true);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 车站上电解锁
|
* 车站上电解锁
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,8 @@ package club.joylink.rtss.vo.training2.rule;
|
|||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
|
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -107,6 +109,20 @@ public enum MapDeviceRule {
|
|||||||
return MapDeviceRule.generateRandomElement(standList, NUMBER);
|
return MapDeviceRule.generateRandomElement(standList, NUMBER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
STAND_FIRST_STATION_LIST("获取第一个站站台列表") {
|
||||||
|
@Override
|
||||||
|
public List<Stand> filterMapDeviceList(Simulation simulation) {
|
||||||
|
Station station = simulation.getRepository().getStationList().stream()
|
||||||
|
.filter(s -> s.isCentralized() && s.isInterlock() && s.isHasControlMode() && !s.isDepot())
|
||||||
|
.min(Comparator.comparingInt(Station::getSn)).orElse(null);
|
||||||
|
if (station == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Data_Not_Exist);
|
||||||
|
}
|
||||||
|
List<Stand> standList = simulation.getRepository().getStandList().stream()
|
||||||
|
.filter(stand -> Objects.equals(station, stand.getStation())).collect(Collectors.toList());
|
||||||
|
return MapDeviceRule.generateRandomElement(standList, NUMBER);
|
||||||
|
}
|
||||||
|
},
|
||||||
ROUTE_LIST("进路列表") {
|
ROUTE_LIST("进路列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Route> filterMapDeviceList(Simulation simulation) {
|
public List<Route> filterMapDeviceList(Simulation simulation) {
|
||||||
@ -161,6 +177,31 @@ public enum MapDeviceRule {
|
|||||||
return generateRandomElement(routeList, NUMBER);
|
return generateRandomElement(routeList, NUMBER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
ROUTE_FIRST_STATION_LIST("获取第一个站进路列表") {
|
||||||
|
@Override
|
||||||
|
public List<Route> filterMapDeviceList(Simulation simulation) {
|
||||||
|
Station station = simulation.getRepository().getStationList().stream()
|
||||||
|
.filter(s -> s.isCentralized() && s.isInterlock() && s.isHasControlMode() && !s.isDepot())
|
||||||
|
.min(Comparator.comparingInt(Station::getSn)).orElse(null);
|
||||||
|
if (station == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Data_Not_Exist);
|
||||||
|
}
|
||||||
|
List<Route> routeList = simulation.getRepository().getRouteList().stream().filter(r -> {
|
||||||
|
if (!Objects.equals(station, r.getInterlockStation())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 信号机跟进路所属同一站
|
||||||
|
if (!Objects.equals(r.getInterlockStation(), r.getStart().getDeviceStation())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (r.getSwitchList().stream().anyMatch(switchElement -> !switchElement.isNormal())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return generateRandomElement(routeList, NUMBER);
|
||||||
|
}
|
||||||
|
},
|
||||||
SWITCH_LIST("道岔列表") {
|
SWITCH_LIST("道岔列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
||||||
@ -215,6 +256,21 @@ public enum MapDeviceRule {
|
|||||||
return generateRandomElement(switchList, 1);
|
return generateRandomElement(switchList, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SWITCH_FIRST_STATION_LIST("获取第一个站道岔列表") {
|
||||||
|
@Override
|
||||||
|
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
||||||
|
Station station = simulation.getRepository().getStationList().stream()
|
||||||
|
.filter(s -> s.isCentralized() && s.isInterlock() && s.isHasControlMode() && !s.isDepot())
|
||||||
|
.min(Comparator.comparingInt(Station::getSn)).orElse(null);
|
||||||
|
if (station == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Data_Not_Exist);
|
||||||
|
}
|
||||||
|
List<Switch> switchList = simulation.getRepository().getSwitchList().stream()
|
||||||
|
.filter(aSwitch -> Objects.equals(aSwitch.getDeviceStation(), station))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return generateRandomElement(switchList, NUMBER);
|
||||||
|
}
|
||||||
|
},
|
||||||
SIGNAL_LIST("信号机列表") {
|
SIGNAL_LIST("信号机列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
||||||
@ -271,6 +327,21 @@ public enum MapDeviceRule {
|
|||||||
return generateRandomElement(signalList, NUMBER);
|
return generateRandomElement(signalList, NUMBER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SIGNAL_FIRST_STATION_LIST("获取第一个站信号机列表") {
|
||||||
|
@Override
|
||||||
|
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
||||||
|
Station station = simulation.getRepository().getStationList().stream()
|
||||||
|
.filter(s -> s.isCentralized() && s.isInterlock() && s.isHasControlMode() && !s.isDepot())
|
||||||
|
.min(Comparator.comparingInt(Station::getSn)).orElse(null);
|
||||||
|
if (station == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Data_Not_Exist);
|
||||||
|
}
|
||||||
|
List<Signal> signalList = simulation.getRepository().getSignalList().stream()
|
||||||
|
.filter(signal -> Objects.equals(signal.getDeviceStation(), station) && !signal.getRouteList().isEmpty())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return generateRandomElement(signalList, NUMBER);
|
||||||
|
}
|
||||||
|
},
|
||||||
SECTION_LIST("区段列表") {
|
SECTION_LIST("区段列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Section> filterMapDeviceList(Simulation simulation) {
|
public List<Section> filterMapDeviceList(Simulation simulation) {
|
||||||
@ -318,6 +389,26 @@ public enum MapDeviceRule {
|
|||||||
return MapDeviceRule.generateRandomElement(sectionList, NUMBER);
|
return MapDeviceRule.generateRandomElement(sectionList, NUMBER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SECTION_PHYSICAL_FIRST_STATION_LIST("获取第一个站物理区段列表") {
|
||||||
|
@Override
|
||||||
|
public List<Section> filterMapDeviceList(Simulation simulation) {
|
||||||
|
Station station = simulation.getRepository().getStationList().stream()
|
||||||
|
.filter(s -> s.isCentralized() && s.isInterlock() && s.isHasControlMode() && !s.isDepot())
|
||||||
|
.min(Comparator.comparingInt(Station::getSn)).orElse(null);
|
||||||
|
if (station == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Data_Not_Exist);
|
||||||
|
}
|
||||||
|
List<Section> sectionList = simulation.getRepository().getSectionList().stream()
|
||||||
|
.filter(s -> {
|
||||||
|
if (s.getParent() != null && s.getParent().isCross()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(s.getDeviceStation(), station) && s.isPhysical() && (s.getParent() == null);
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return generateRandomElement(sectionList, NUMBER);
|
||||||
|
}
|
||||||
|
},
|
||||||
CONTROL_STATION_LIST("控制模式的车站列表") {
|
CONTROL_STATION_LIST("控制模式的车站列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Station> filterMapDeviceList(Simulation simulation) {
|
public List<Station> filterMapDeviceList(Simulation simulation) {
|
||||||
|
@ -30,6 +30,12 @@ public enum PropertyValueRule {
|
|||||||
return ((MapNamedElement) mapElement).getCode();
|
return ((MapNamedElement) mapElement).getCode();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
CODE_LIST("地图设备编码列表") {
|
||||||
|
@Override
|
||||||
|
public Object resolve(Simulation simulation, Object mapElement) {
|
||||||
|
return Arrays.asList(((MapNamedElement) mapElement).getCode());
|
||||||
|
}
|
||||||
|
},
|
||||||
STATION_NAME("地图设备所属车站名称") {
|
STATION_NAME("地图设备所属车站名称") {
|
||||||
@Override
|
@Override
|
||||||
public String resolve(Simulation simulation, Object mapElement) {
|
public String resolve(Simulation simulation, Object mapElement) {
|
||||||
@ -165,7 +171,7 @@ public enum PropertyValueRule {
|
|||||||
}
|
}
|
||||||
return aSwitch.getA().getParent().getCode();
|
return aSwitch.getA().getParent().getCode();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String description;
|
private final String description;
|
||||||
|
Loading…
Reference in New Issue
Block a user