【修改车站获取指示灯列表BUG】
【增加按钮枚举类型】 【指示灯、按钮初始化类型筛选】 Signed-off-by: weizhihong <weizhihong@joylink.club>
This commit is contained in:
parent
4cbb439634
commit
17edb388d8
@ -1,7 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.build;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.DirectionLabelEnum;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SignalModel;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
@ -1517,14 +1516,14 @@ public class MapDeviceBuilder {
|
||||
*/
|
||||
private static void buildAssistIndicator(Map<String, MapElement> elementMap
|
||||
, List<String> errMsgList, List<MapIndicatorLightVO> indicatorList) {
|
||||
// 区间占用\辅助状态\总辅助\发车辅助\接车辅助\接发车箭头\复原\事故\闭塞
|
||||
List<String> indicatorTypeList = Arrays.asList(
|
||||
"SectionOccupied", "AssistStatus", "TotalAssist", "DepartAssist", "PickAssist", "PickOrDepartArrow",
|
||||
"Recovery", "Accident", "Occlusion"
|
||||
);
|
||||
indicatorList
|
||||
.stream()
|
||||
.filter(mapIndicatorLightVO ->
|
||||
Arrays.stream(DirectionLabelEnum.values())
|
||||
.filter(e -> e.equals(mapIndicatorLightVO.getLabelEnum()))
|
||||
.findAny()
|
||||
.isPresent()
|
||||
)
|
||||
.filter(mapIndicatorLightVO -> indicatorTypeList.contains(mapIndicatorLightVO.getType()))
|
||||
.forEach(mapSignalButtonVO -> {
|
||||
if (elementMap.containsKey(mapSignalButtonVO.getCode())) {
|
||||
errMsgList.add(String.format("指示灯[%s]必须唯一", mapSignalButtonVO.getCode()));
|
||||
@ -1547,14 +1546,16 @@ public class MapDeviceBuilder {
|
||||
*/
|
||||
private static void buildAssistButton(Map<String, MapElement> elementMap
|
||||
, List<String> errMsgList, List<MapSignalButtonVO> signalButtonList) {
|
||||
// 总、接、发、改方
|
||||
List<MapSignalButtonVO.Type> buttonTypeList = Arrays.asList(
|
||||
MapSignalButtonVO.Type.ASSIST,
|
||||
MapSignalButtonVO.Type.PICK_ASSIST,
|
||||
MapSignalButtonVO.Type.DEPART_ASSIST,
|
||||
MapSignalButtonVO.Type.CHANGE_DIRECTION
|
||||
);
|
||||
signalButtonList
|
||||
.stream()
|
||||
.filter(mapSignalButtonVO ->
|
||||
Arrays.stream(DirectionLabelEnum.values())
|
||||
.filter(e -> e.equals(mapSignalButtonVO.getLabelEnum()))
|
||||
.findAny()
|
||||
.isPresent()
|
||||
)
|
||||
.filter(mapSignalButtonVO -> buttonTypeList.contains(mapSignalButtonVO.getType()))
|
||||
.forEach(mapSignalButtonVO -> {
|
||||
if (elementMap.containsKey(mapSignalButtonVO.getCode())) {
|
||||
errMsgList.add(String.format("按钮[%s]必须唯一", mapSignalButtonVO.getCode()));
|
||||
|
@ -23,11 +23,11 @@ import java.util.stream.Collectors;
|
||||
public class Station extends MayOutOfOrderDevice {
|
||||
public Station(String code, String name) {
|
||||
super(code, name, DeviceType.STATION);
|
||||
this.transferList = new ArrayList<>();
|
||||
this.turnBackList = new ArrayList<>();
|
||||
this.rdStandList = new ArrayList<>();
|
||||
this.ldStandList = new ArrayList<>();
|
||||
this.controlMode = ControlMode.Center;
|
||||
transferList = new ArrayList<>();
|
||||
turnBackList = new ArrayList<>();
|
||||
rdStandList = new ArrayList<>();
|
||||
ldStandList = new ArrayList<>();
|
||||
controlMode = ControlMode.Center;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,52 +183,52 @@ public class Station extends MayOutOfOrderDevice {
|
||||
/**
|
||||
* 按钮列表
|
||||
*/
|
||||
private List<Button> buttonsList;
|
||||
private List<Button> buttonsList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 指示灯列表
|
||||
*/
|
||||
private List<Indicator> indicatorList;
|
||||
private List<Indicator> indicatorList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (this.vrIbp != null) {
|
||||
if (vrIbp != null) {
|
||||
vrIbp.reset();
|
||||
}
|
||||
|
||||
this.totalGuideLock = false;
|
||||
if (this.hasControlMode) {
|
||||
this.controlMode = ControlMode.Center;
|
||||
totalGuideLock = false;
|
||||
if (hasControlMode) {
|
||||
controlMode = ControlMode.Center;
|
||||
}
|
||||
if (Objects.nonNull(this.tbStrategyId)) {
|
||||
this.tbStrategyId = this.getDefaultTbStrategyId();
|
||||
if (Objects.nonNull(tbStrategyId)) {
|
||||
tbStrategyId = getDefaultTbStrategyId();
|
||||
}
|
||||
this.applicant = null;
|
||||
this.apply2TheControlMode = null;
|
||||
this.validDuration = null;
|
||||
this.interlockMachineStarting = false;
|
||||
this.restartTime = null;
|
||||
this.controller = null;
|
||||
this.emergencyController = false;
|
||||
this.controlApplicant = null;
|
||||
this.preResetValidDuration = new AtomicInteger(0);
|
||||
applicant = null;
|
||||
apply2TheControlMode = null;
|
||||
validDuration = null;
|
||||
interlockMachineStarting = false;
|
||||
restartTime = null;
|
||||
controller = null;
|
||||
emergencyController = false;
|
||||
controlApplicant = null;
|
||||
preResetValidDuration = new AtomicInteger(0);
|
||||
}
|
||||
|
||||
public List<Stand> getStandOf(boolean right) {
|
||||
if (right) {
|
||||
return this.rdStandList;
|
||||
return rdStandList;
|
||||
} else {
|
||||
return this.ldStandList;
|
||||
return ldStandList;
|
||||
}
|
||||
}
|
||||
|
||||
public void addTransferTrack(Section section) {
|
||||
this.transferList.add(section);
|
||||
transferList.add(section);
|
||||
}
|
||||
|
||||
public void addTurnBackSection(Section section) {
|
||||
this.turnBackList.add(section);
|
||||
turnBackList.add(section);
|
||||
}
|
||||
|
||||
public List<Stand> getAllStandList() {
|
||||
@ -239,35 +239,35 @@ public class Station extends MayOutOfOrderDevice {
|
||||
}
|
||||
|
||||
public void addRdStand(Stand stand) {
|
||||
this.rdStandList.add(stand);
|
||||
rdStandList.add(stand);
|
||||
}
|
||||
|
||||
public void addLdStand(Stand stand) {
|
||||
this.ldStandList.add(stand);
|
||||
ldStandList.add(stand);
|
||||
}
|
||||
|
||||
public StationTurnBackStrategyOption getCurrentTurnBackStrategy() {
|
||||
return this.getTurnBackStrategyById(this.tbStrategyId);
|
||||
return getTurnBackStrategyById(tbStrategyId);
|
||||
}
|
||||
|
||||
public StationTurnBackStrategyOption getTurnBackStrategyById(Integer id) {
|
||||
if (Objects.isNull(this.tbStrategyMap)) {
|
||||
if (Objects.isNull(tbStrategyMap)) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault,
|
||||
String.format("车站[%s(%s)]没有折返策略", this.getName(), this.getCode()));
|
||||
String.format("车站[%s(%s)]没有折返策略", getName(), getCode()));
|
||||
}
|
||||
StationTurnBackStrategyOption strategyOption = this.tbStrategyMap.get(id);
|
||||
StationTurnBackStrategyOption strategyOption = tbStrategyMap.get(id);
|
||||
if (Objects.isNull(strategyOption)) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault,
|
||||
String.format("车站[%s(%s)]没有id为[%s]的折返策略", this.getName(), this.getCode(), id));
|
||||
String.format("车站[%s(%s)]没有id为[%s]的折返策略", getName(), getCode(), id));
|
||||
}
|
||||
return strategyOption;
|
||||
}
|
||||
|
||||
public boolean isDefaultTurnBackStrategyId() {
|
||||
if (Objects.isNull(this.getTbStrategyId())) {
|
||||
if (Objects.isNull(getTbStrategyId())) {
|
||||
return true;
|
||||
} else {
|
||||
StationTurnBackStrategyOption option = this.getCurrentTurnBackStrategy();
|
||||
StationTurnBackStrategyOption option = getCurrentTurnBackStrategy();
|
||||
if (option.getType().equals(TurnBackStrategyType.NONE)) {
|
||||
return true;
|
||||
}
|
||||
@ -282,7 +282,7 @@ public class Station extends MayOutOfOrderDevice {
|
||||
*/
|
||||
public boolean isNormal() {
|
||||
boolean normal = false;
|
||||
List<Stand> allStandList = this.getAllStandList();
|
||||
List<Stand> allStandList = getAllStandList();
|
||||
if (!CollectionUtils.isEmpty(allStandList)) {
|
||||
for (Stand stand : allStandList) {
|
||||
if (!stand.isSmall()) {
|
||||
@ -295,27 +295,27 @@ public class Station extends MayOutOfOrderDevice {
|
||||
}
|
||||
|
||||
public void surrenderControl() {
|
||||
this.controlMode = ControlMode.None;
|
||||
controlMode = ControlMode.None;
|
||||
}
|
||||
|
||||
public boolean isSurrenderControl() {
|
||||
return this.controlMode == ControlMode.None;
|
||||
return controlMode == ControlMode.None;
|
||||
}
|
||||
|
||||
public void occControl() {
|
||||
this.controlMode = ControlMode.Center;
|
||||
controlMode = ControlMode.Center;
|
||||
}
|
||||
|
||||
public void localControl() {
|
||||
this.controlMode = ControlMode.Local;
|
||||
controlMode = ControlMode.Local;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取控制权转换申请者的id
|
||||
*/
|
||||
public String getApplicantId() {
|
||||
if (this.getApplicant() != null) {
|
||||
return this.getApplicant().getId();
|
||||
if (getApplicant() != null) {
|
||||
return getApplicant().getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -324,38 +324,38 @@ public class Station extends MayOutOfOrderDevice {
|
||||
* 申请控制权转换
|
||||
*/
|
||||
public void apply4ControlTransfer(SimulationMember applicant, ControlMode controlMode) {
|
||||
this.setApplicant(applicant);
|
||||
this.setApply2TheControlMode(controlMode);
|
||||
this.setValidDuration(SimulationConstants.CONTROL_TRANSFER_VALID_DURATION);
|
||||
setApplicant(applicant);
|
||||
setApply2TheControlMode(controlMode);
|
||||
setValidDuration(SimulationConstants.CONTROL_TRANSFER_VALID_DURATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消控制权转换申请
|
||||
*/
|
||||
public void cancelControlTransferApplication() {
|
||||
this.setApplicant(null);
|
||||
this.setApply2TheControlMode(null);
|
||||
this.setValidDuration(null);
|
||||
setApplicant(null);
|
||||
setApply2TheControlMode(null);
|
||||
setValidDuration(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否控制权转换申请中
|
||||
*/
|
||||
public boolean isControlTransferApplying() {
|
||||
return this.getApplicant() != null
|
||||
&& this.getApply2TheControlMode() != null
|
||||
&& this.getValidDuration() != null;
|
||||
return getApplicant() != null
|
||||
&& getApply2TheControlMode() != null
|
||||
&& getValidDuration() != null;
|
||||
}
|
||||
|
||||
public Integer getValidDurationInSeconds() {
|
||||
if (this.validDuration == null) {
|
||||
if (validDuration == null) {
|
||||
return null;
|
||||
}
|
||||
return this.validDuration / 1000;
|
||||
return validDuration / 1000;
|
||||
}
|
||||
|
||||
public boolean isNoDepotAndNoNormalStand() {
|
||||
List<Stand> allStandList = this.getAllStandList();
|
||||
List<Stand> allStandList = getAllStandList();
|
||||
boolean hasNormal = false;
|
||||
for (Stand stand : allStandList) {
|
||||
if (!stand.isSmall()) {
|
||||
@ -363,11 +363,11 @@ public class Station extends MayOutOfOrderDevice {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !this.isDepot() && !hasNormal;
|
||||
return !isDepot() && !hasNormal;
|
||||
}
|
||||
|
||||
public boolean isNormalStandTrack(String sectionCode) {
|
||||
for (Stand stand : this.getAllStandList()) {
|
||||
for (Stand stand : getAllStandList()) {
|
||||
if (!stand.isSmall() && Objects.equals(stand.getSection().getCode(), sectionCode)) {
|
||||
return true;
|
||||
}
|
||||
@ -377,7 +377,7 @@ public class Station extends MayOutOfOrderDevice {
|
||||
|
||||
public List<Section> getParkSectionListBy(boolean right) {
|
||||
List<Section> list = new ArrayList<>();
|
||||
List<Stand> standList = this.getStandOf(right);
|
||||
List<Stand> standList = getStandOf(right);
|
||||
for (Stand stand : standList) {
|
||||
if (!list.contains(stand.getSection())) {
|
||||
list.add(stand.getSection());
|
||||
@ -390,13 +390,13 @@ public class Station extends MayOutOfOrderDevice {
|
||||
* 该区段所属的正常站台是否右向
|
||||
*/
|
||||
public boolean isStandOfSectionRight(@NonNull Section section) {
|
||||
List<Stand> stands = this.getAllNormalStands();
|
||||
List<Stand> stands = getAllNormalStands();
|
||||
for (Stand stand : stands) {
|
||||
if (section.equals(stand.getSection())) {
|
||||
return stand.isRight();
|
||||
}
|
||||
}
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument, String.format("区段[%s]不是车站[%s]的站台轨", section.getCode(), this.getCode()));
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument, String.format("区段[%s]不是车站[%s]的站台轨", section.getCode(), getCode()));
|
||||
}
|
||||
|
||||
public String getControllerId() {
|
||||
@ -414,18 +414,18 @@ public class Station extends MayOutOfOrderDevice {
|
||||
}
|
||||
|
||||
public int getPreResetValidDurationInSeconds() {
|
||||
return this.preResetValidDuration.get() / 1000;
|
||||
return preResetValidDuration.get() / 1000;
|
||||
}
|
||||
|
||||
public boolean isPreReset() {
|
||||
return this.preResetValidDuration != null && this.preResetValidDuration.get() > 0;
|
||||
return preResetValidDuration != null && preResetValidDuration.get() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询优先的折返轨
|
||||
*/
|
||||
public Section queryFirstTurnBackSection() {
|
||||
if (CollectionUtils.isEmpty(this.tbStrategyMap) || this.tbStrategyId == null) {
|
||||
if (CollectionUtils.isEmpty(tbStrategyMap) || tbStrategyId == null) {
|
||||
return null;
|
||||
}
|
||||
StationTurnBackStrategyOption strategy = getCurrentTurnBackStrategy();
|
||||
@ -442,11 +442,11 @@ public class Station extends MayOutOfOrderDevice {
|
||||
}
|
||||
|
||||
public void addDevice(StatusDevice device) {
|
||||
this.deviceMap.put(device.getCode(), device);
|
||||
deviceMap.put(device.getCode(), device);
|
||||
}
|
||||
|
||||
public boolean isAtsRouteTriggerFault() {
|
||||
return Fault.ATS_ROUTE_TRIGGER_FAULT.equals(this.getFault());
|
||||
return Fault.ATS_ROUTE_TRIGGER_FAULT.equals(getFault());
|
||||
}
|
||||
|
||||
public enum ControlMode {
|
||||
@ -478,14 +478,14 @@ public class Station extends MayOutOfOrderDevice {
|
||||
* 是否中控
|
||||
*/
|
||||
public boolean isCenterControl() {
|
||||
return Objects.equals(ControlMode.Center, this.controlMode);
|
||||
return Objects.equals(ControlMode.Center, controlMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否站控
|
||||
*/
|
||||
public boolean isLocalControl() {
|
||||
return Objects.equals(ControlMode.Local, this.controlMode);
|
||||
return Objects.equals(ControlMode.Local, controlMode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -530,8 +530,9 @@ public class Station extends MayOutOfOrderDevice {
|
||||
return getAllStandList().stream().filter(stand -> !stand.isSmall()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String debugStr() {
|
||||
return String.format("车站[%s]", this.getName());
|
||||
return String.format("车站[%s]", getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,12 @@ public class MapIndicatorLightVO {
|
||||
*/
|
||||
private DirectionLabelEnum labelEnum;
|
||||
|
||||
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
private boolean right;
|
||||
|
||||
|
||||
// public enum Type{
|
||||
// AtsControl,
|
||||
// CenterCommunication,
|
||||
|
@ -44,6 +44,27 @@ public class MapSignalButtonVO {
|
||||
FLEXIBLE,
|
||||
RAMP_TERMINAL,
|
||||
TRAIN_TERMINAL,
|
||||
SHUNT_TERMINAL
|
||||
SHUNT_TERMINAL,
|
||||
|
||||
/**
|
||||
* 总辅助按钮
|
||||
*/
|
||||
ASSIST,
|
||||
/**
|
||||
* 接辅助按钮
|
||||
*/
|
||||
PICK_ASSIST,
|
||||
/**
|
||||
* 发辅助按钮
|
||||
*/
|
||||
DEPART_ASSIST,
|
||||
/**
|
||||
* 事故按钮
|
||||
*/
|
||||
ACCIDENT,
|
||||
/**
|
||||
* 改方按钮
|
||||
*/
|
||||
CHANGE_DIRECTION
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user