diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java index cc0a83485..bb7a2afcb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java @@ -4,6 +4,9 @@ package club.joylink.rtss.simulation.cbtc.CI.data; import club.joylink.rtss.constants.DirectionLabelEnum; import club.joylink.rtss.entity.DraftMapStationDirection; import club.joylink.rtss.simulation.cbtc.data.map.*; +import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -19,6 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger; @Setter @Getter @Slf4j +@ExpConditionMaterialSrcAnno(name = "StationDirection", deviceType = MapElement.DeviceType.STATION_DIRECTION) public class StationDirection extends MayOutOfOrderDevice implements Cloneable { /** * 发辅助默认倒计时 25s @@ -78,6 +82,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { /** * 处于接、发状态 */ + @ExpConditionMaterialAnno(name = "runStatus", type = ReceiveAndDeliverModel.class, desc = "接、发状态", category = ExpTypeCategory.ENUM) private ReceiveAndDeliverModel runStatus; /** @@ -116,6 +121,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { /** * 改方按钮状态 */ + @ExpConditionMaterialAnno(name = "changeDirectionStatus", type = boolean.class, desc = "改方状态") private boolean changeDirectionStatus; /** @@ -131,16 +137,19 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { /** * 接辅助 */ + @ExpConditionMaterialAnno(name = "receiveAssistStatus", type = boolean.class, desc = "接辅助状态") private boolean receiveAssistStatus; /** * 发辅助 */ + @ExpConditionMaterialAnno(name = "deliverAssistStatus", type = boolean.class, desc = "发辅助状态") private boolean deliverAssistStatus; /** * 辅助准备完毕状态 */ + @ExpConditionMaterialAnno(name = "assistReadyStatus", type = boolean.class, desc = "辅助办理完成") private boolean assistReadyStatus; /** @@ -153,6 +162,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { /** * 闭塞 */ + @ExpConditionMaterialAnno(name = "blockStatus", type = boolean.class, desc = "闭塞状态") private boolean blockStatus; /** @@ -193,8 +203,6 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { */ private Map routeSettingStatusMap; /***************************************** 关联进路信息 **********************************************/ - - /** * 是否是数据配置生成 */ @@ -205,7 +213,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { */ private Boolean right; /***************************************** 车务终端管理出入口方向相关属性begin **********************************************/ - private IODirection ioDirection; + private IODirection ioDirection; /** * 允许超限列车 * 选择“是/否”。 @@ -229,6 +237,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { * 车运行分工选择。 */ private boolean goodsTrain; + /***************************************** 车务终端管理出入口方向相关属性begin **********************************************/ // TODO: 待数据统一之后,这个构造函数代码可删除 20220714 public StationDirection(String code, String name, DirectionLabelEnum labelEnum) { @@ -239,7 +248,8 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { this.defaultRunStatus = this.getDefaultReceiveAndDeliver(); this.currentRouteList = getNowRouteList(); } - public StationDirection(String code, String name, DirectionLabelEnum labelEnum,IODirection ioDirection) { + + public StationDirection(String code, String name, DirectionLabelEnum labelEnum, IODirection ioDirection) { this(code, name); this.labelEnum = labelEnum; this.runModel = getDefaultDirectionRunModel(); @@ -250,6 +260,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { } + public StationDirection(DraftMapStationDirection draftMapStationDirection) { this(draftMapStationDirection.getCode(), draftMapStationDirection.getName()); this.labelEnum = draftMapStationDirection.getLabelEnum(); @@ -259,7 +270,7 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { this.currentRouteList = getNowRouteList(); this.isDataConfig = true; this.ioDirection = draftMapStationDirection.getIoDirection(); - + } public StationDirection(String code, String name) { @@ -270,14 +281,16 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { this.deliverRouteList = new ArrayList<>(); this.routeSettingStatusMap = new HashMap<>(); } - public StationDirection clone(){ + + public StationDirection clone() { try { - return (StationDirection)super.clone(); + return (StationDirection) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return null; } + @Override public void reset() { this.routeSettingStatusMap.clear(); @@ -663,24 +676,37 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { } } + @Getter public enum ReceiveAndDeliverModel { // 接 - R, + R("接"), // 发 - D, + D("发"), // 全 - A, + A("双向占用"), // 无 - NO + NO("无状态"); + + private final String label; + + ReceiveAndDeliverModel(String label) { + this.label = label; + } } + @Getter public enum IndicatorStatusEnum { // 占用 - O, + O("占用"), // 空闲 - F, + F("空闲"), // 预备 - R + R("准备状态"); + private final String label; + + IndicatorStatusEnum(String label) { + this.label = label; + } } public enum ButtonTypeEnum { @@ -702,24 +728,27 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable { NO } + @Getter public enum DirectionRunModel { // 自动 - A, + A("自动闭塞"), // 半自动 - S, - // 非自动 - N + S("半自动闭塞"); + private final String label; + + DirectionRunModel(String label) { + this.label = label; + } } /** * 出入口方向 */ - public enum IODirection{ + public enum IODirection { DOWN_IN_STATION, UP_IN_STATION, DOWN_OUT_STATION, UP_OUT_STATION, BOTH_WAY_STATION; - } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/DriveMode.java b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/DriveMode.java index f8990aa92..4cb6b0317 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/DriveMode.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/DriveMode.java @@ -4,14 +4,28 @@ package club.joylink.rtss.simulation.cbtc.constant; * 驾驶模式 */ public enum DriveMode { - /** 列车自动驾驶模式:司机监控下的列车自动驾驶 */ - AM, - /** ATP防护下的人工驾驶模式:司机在列车自动防护设备监控下驾驶列车 */ - CM, - /** 限制人工驾驶模式:地面设备故障或未设置地面信息设备的线路,列车按规定限速运行,超速时实时制动,直至停车 */ - RM, - /** 无限制人工驾驶模式:列车在运行中没有车载ATP的保护,司机根据行车调度员的指示,按地面信号机的显示或手信号(口令)指示行车 */ - NRM; + /** + * 列车自动驾驶模式:司机监控下的列车自动驾驶 + */ + AM("列车自动驾驶模式"), + /** + * ATP防护下的人工驾驶模式:司机在列车自动防护设备监控下驾驶列车 + */ + CM("ATP防护下的人工驾驶模式"), + /** + * 限制人工驾驶模式:地面设备故障或未设置地面信息设备的线路,列车按规定限速运行,超速时实时制动,直至停车 + */ + RM("限制人工驾驶模式"), + /** + * 无限制人工驾驶模式:列车在运行中没有车载ATP的保护,司机根据行车调度员的指示,按地面信号机的显示或手信号(口令)指示行车 + */ + NRM("无限制人工驾驶模式"); + + private final String label; + + DriveMode(String label) { + this.label = label; + } public boolean isNotLowerThan(DriveMode driveMode) { return this.ordinal() <= driveMode.ordinal(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/RunLevel.java b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/RunLevel.java index d67cd4799..4ae690b51 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/RunLevel.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/RunLevel.java @@ -7,15 +7,22 @@ public enum RunLevel { /** * cbtc级别 */ - CBTC, + CBTC("cbtc级别"), /** * 点式通信 */ - ITC, + ITC("点式通信"), /** * 联锁级 */ - IL; + IL("联锁级"); + + private final String label; + + + RunLevel(String label) { + this.label = label; + } public boolean isNotLowerThan(RunLevel runLevel) { return this.ordinal() <= runLevel.ordinal(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SignalAspect.java b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SignalAspect.java index 68abfeb6b..6d3ee9980 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SignalAspect.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SignalAspect.java @@ -4,34 +4,69 @@ package club.joylink.rtss.simulation.cbtc.constant; * 信号显示 */ public enum SignalAspect { - /** 无显示,灭灯 */ - No, - /** 红 */ - R, - /** 绿 */ - G, - /** 黄 */ - Y, - /** 月白 */ - W, - /** 蓝 */ - B, - /** 红黄 */ - RY, - /** 红白 */ - RW, - /** 绿绿 */ - GG, - /** 绿黄 */ - GY, - /** 黄黄 */ - YY, - /** 红闪(flashing) */ - RF, - /** 黄闪(flashing) */ - YF, - /** 绿闪(flashing) */ - GF, - /** 白闪(flashing) */ - WF, + /** + * 无显示,灭灯 + */ + No("灭灯"), + /** + * 红 + */ + R("红"), + /** + * 绿 + */ + G("绿"), + /** + * 黄 + */ + Y("黄"), + /** + * 月白 + */ + W("月白"), + /** + * 蓝 + */ + B("蓝"), + /** + * 红黄 + */ + RY("红黄"), + /** + * 红白 + */ + RW("红白"), + /** + * 绿绿 + */ + GG("绿绿"), + /** + * 绿黄 + */ + GY("绿黄"), + /** + * 黄黄 + */ + YY("黄黄"), + /** + * 红闪(flashing) + */ + RF("红闪"), + /** + * 黄闪(flashing) + */ + YF("黄闪"), + /** + * 绿闪(flashing) + */ + GF("绿闪"), + /** + * 白闪(flashing) + */ + WF("白闪"); + private final String label; + + SignalAspect(String label) { + this.label = label; + } } \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SwitchIndication.java b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SwitchIndication.java index cde11e9ec..6f48c6d73 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SwitchIndication.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/constant/SwitchIndication.java @@ -4,16 +4,30 @@ package club.joylink.rtss.simulation.cbtc.constant; * 道岔位置表示 */ public enum SwitchIndication { - /** 定位 */ - N, - /** 反位 */ - R, - /** 无(失表) */ - NO, - /** 挤叉 */ - EX, + /** + * 定位 + */ + N("定位"), + /** + * 反位 + */ + R("反位"), + /** + * 无(失表) + */ + NO("反位"), + /** + * 挤叉 + */ + EX("挤叉"), ; + private final String label; + + SwitchIndication(String label) { + this.label = label; + } + public static SwitchIndication of(boolean normal) { if (normal) { return N; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java index 7b812728c..a6eeb59dc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java @@ -161,31 +161,31 @@ public class Route extends MapNamedElement { /** * ats自动控制 */ - @ExpConditionMaterialAnno(name = "atsControl", type = "boolean", desc = "ats自动控制") + @ExpConditionMaterialAnno(name = "atsControl", type = boolean.class, desc = "ats自动控制") private boolean atsControl; /** * 连续通过进路模式(联锁自动进路)开启 */ - @ExpConditionMaterialAnno(name = "fleetMode", type = "boolean", desc = "连续通过进路模式(联锁自动进路)开启") + @ExpConditionMaterialAnno(name = "fleetMode", type = boolean.class, desc = "连续通过进路模式(联锁自动进路)开启") private boolean fleetMode; /** * 自动追踪/联锁自动触发模式开启 */ - @ExpConditionMaterialAnno(name = "ciControl", type = "boolean", desc = "自动追踪/联锁自动触发模式开启") + @ExpConditionMaterialAnno(name = "ciControl", type = boolean.class, desc = "自动追踪/联锁自动触发模式开启") private boolean ciControl; /** * 进路是否可以排列 */ - @ExpConditionMaterialAnno(name = "settable", type = "boolean", desc = "进路是否可以排列") + @ExpConditionMaterialAnno(name = "settable", type = boolean.class, desc = "进路是否可以排列") private boolean settable; /** * 进路是否排列中 */ - @ExpConditionMaterialAnno(name = "setting", type = "boolean", desc = "进路是否排列中") + @ExpConditionMaterialAnno(name = "setting", type = boolean.class, desc = "进路是否排列中") private boolean setting; /** * 该进路办理成功后要开放的信号 @@ -201,13 +201,13 @@ public class Route extends MapNamedElement { /** * 是否引导进路排列中 */ - @ExpConditionMaterialAnno(name = "guideSetting", type = "boolean", desc = "是否引导进路排列中") + @ExpConditionMaterialAnno(name = "guideSetting", type = boolean.class, desc = "是否引导进路排列中") private boolean guideSetting; /** * 进路是否锁闭 */ - @ExpConditionMaterialAnno(name = "lock", type = "boolean", desc = "进路是否锁闭") + @ExpConditionMaterialAnno(name = "lock", type = boolean.class, desc = "进路是否锁闭") private boolean lock; /** @@ -218,7 +218,7 @@ public class Route extends MapNamedElement { /** * 是否正常解锁中 */ - @ExpConditionMaterialAnno(name = "normalUnlock", type = "boolean", desc = "是否正常解锁中") + @ExpConditionMaterialAnno(name = "normalUnlock", type = boolean.class, desc = "是否正常解锁中") private boolean normalUnlock; /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java index e40622099..86913e7f2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java @@ -186,13 +186,13 @@ public class Section extends DelayUnlockDevice { /** * 是否封锁(封锁后,包含区段的进路不能排列) */ - @ExpConditionMaterialAnno(name = "blockade", type = "boolean", desc = "是否封锁") + @ExpConditionMaterialAnno(name = "blockade", type = boolean.class, desc = "是否封锁") private boolean blockade; /** * 是否进路锁闭 */ - @ExpConditionMaterialAnno(name = "routeLock", type = "boolean", desc = "是否进路锁闭") + @ExpConditionMaterialAnno(name = "routeLock", type = boolean.class, desc = "是否进路锁闭") private boolean routeLock; /** @@ -208,19 +208,19 @@ public class Section extends DelayUnlockDevice { /** * 进路延续保护锁闭 */ - @ExpConditionMaterialAnno(name = "overlapLock", type = "boolean", desc = "是否进路延续保护锁闭") + @ExpConditionMaterialAnno(name = "overlapLock", type = boolean.class, desc = "是否进路延续保护锁闭") private boolean overlapLock; /** * 通信车占用 */ - @ExpConditionMaterialAnno(name = "ctOccupied", type = "boolean", desc = "是否通信车占用") + @ExpConditionMaterialAnno(name = "ctOccupied", type = boolean.class, desc = "是否通信车占用") private boolean ctOccupied; /** * 计轴占用-非通信车占用 */ - @ExpConditionMaterialAnno(name = "nctOccupied", type = "boolean", desc = "是否非通信车占用") + @ExpConditionMaterialAnno(name = "nctOccupied", type = boolean.class, desc = "是否非通信车占用") private boolean nctOccupied; /** @@ -231,19 +231,19 @@ public class Section extends DelayUnlockDevice { /** * 是否切除 */ - @ExpConditionMaterialAnno(name = "cutOff", type = "boolean", desc = "是否切除") + @ExpConditionMaterialAnno(name = "cutOff", type = boolean.class, desc = "是否切除") private boolean cutOff; /** * 计轴是否被报失效(ARB故障) */ - @ExpConditionMaterialAnno(name = "invalid", type = "boolean", desc = "是否ARB") + @ExpConditionMaterialAnno(name = "invalid", type = boolean.class, desc = "是否ARB") private boolean invalid; /** * 故障锁闭 */ - @ExpConditionMaterialAnno(name = "faultLock", type = "boolean", desc = "是否故障锁闭") + @ExpConditionMaterialAnno(name = "faultLock", type = boolean.class, desc = "是否故障锁闭") private boolean faultLock; /** @@ -279,6 +279,7 @@ public class Section extends DelayUnlockDevice { /** * 分路不良状态 */ + @ExpConditionMaterialAnno(name = "badShunt", type = boolean.class, desc = "分路不良状态") private boolean badShunt; /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java index e8bfff7f0..05650bfc5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java @@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory; import lombok.Getter; import lombok.Setter; import org.springframework.util.CollectionUtils; @@ -181,18 +182,19 @@ public class Signal extends DelayUnlockDevice { /** * 是否封锁 */ - @ExpConditionMaterialAnno(name = "blockade", type = "boolean", desc = "是否封锁") + @ExpConditionMaterialAnno(name = "blockade", type = boolean.class, desc = "是否封锁") private boolean blockade; /** * 是否钮封 */ - @ExpConditionMaterialAnno(name = "buttonBlockade", type = "boolean", desc = "是否钮封") + @ExpConditionMaterialAnno(name = "buttonBlockade", type = boolean.class, desc = "是否钮封") private boolean buttonBlockade; /** * 重复封锁(*后期去掉*) */ private boolean reblockade; + /** * 侧防锁闭(侧防锁闭后,不能排列此信号机为始端的任何进路) */ @@ -206,8 +208,9 @@ public class Signal extends DelayUnlockDevice { /** * 当前信号显示 */ - @ExpConditionMaterialAnno(name = "aspect", type = "SignalAspect", desc = "信号显示") + @ExpConditionMaterialAnno(name = "aspect", type = SignalAspect.class, desc = "信号显示状态", category = ExpTypeCategory.ENUM) private SignalAspect aspect; + /** * 是否禁止联锁自动开信号 */ @@ -216,7 +219,7 @@ public class Signal extends DelayUnlockDevice { /** * 引导信号开放剩余时间,单位ms */ - @ExpConditionMaterialAnno(name = "guideRemain", type = "int", desc = "引导信号开放剩余时间,单位ms") + @ExpConditionMaterialAnno(name = "guideRemain", type = int.class, desc = "引导信号开放剩余时间,单位ms") private int guideRemain; /** @@ -232,13 +235,13 @@ public class Signal extends DelayUnlockDevice { /** * 是否接近锁闭 */ - @ExpConditionMaterialAnno(name = "approachLock", type = "boolean", desc = "是否接近锁闭") + @ExpConditionMaterialAnno(name = "approachLock", type = boolean.class, desc = "是否接近锁闭") private boolean approachLock; /** * 延续保护锁闭 */ - @ExpConditionMaterialAnno(name = "overlapLock", type = "boolean", desc = "延续保护锁闭") + @ExpConditionMaterialAnno(name = "overlapLock", type = boolean.class, desc = "延续保护锁闭") private boolean overlapLock; /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java index fa8a9210f..bf24c2a42 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java @@ -80,14 +80,14 @@ public class Stand extends MayOutOfOrderDevice { /** * 列车停站倒计时,单位ms */ - @ExpConditionMaterialAnno(name = "remainTime", type = "int", desc = "列车停站倒计时,单位ms") + @ExpConditionMaterialAnno(name = "remainTime", type = int.class, desc = "列车停站倒计时,单位ms") private int remainTime; /*扣车相关*/ /** * 车站是否扣车 */ - @ExpConditionMaterialAnno(name = "stationHoldTrain", type = "boolean", desc = "车站是否扣车") + @ExpConditionMaterialAnno(name = "stationHoldTrain", type = boolean.class, desc = "车站是否扣车") private volatile boolean stationHoldTrain; /** @@ -114,7 +114,7 @@ public class Stand extends MayOutOfOrderDevice { /** * 是否全部跳停 */ - @ExpConditionMaterialAnno(name = "allSkip", type = "boolean", desc = "是否全部跳停") + @ExpConditionMaterialAnno(name = "allSkip", type = boolean.class, desc = "是否全部跳停") private volatile boolean allSkip; /** @@ -125,7 +125,7 @@ public class Stand extends MayOutOfOrderDevice { /** * 跳停一直有效? */ - @ExpConditionMaterialAnno(name = "skipAlwaysValid", type = "boolean", desc = "跳停持续有效") + @ExpConditionMaterialAnno(name = "skipAlwaysValid", type = boolean.class, desc = "跳停持续有效") private boolean skipAlwaysValid; /*运行等级(时间)相关*/ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java index b0904b7cf..53cf28012 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java @@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory; import lombok.Getter; import lombok.NonNull; import lombok.Setter; @@ -129,13 +130,13 @@ public class Station extends MayOutOfOrderDevice { /** * 是否引导总锁 */ - @ExpConditionMaterialAnno(name = "totalGuideLock", type = "boolean", desc = "是否引导总锁") + @ExpConditionMaterialAnno(name = "totalGuideLock", type = boolean.class, desc = "是否引导总锁") private boolean totalGuideLock; /** * 控制模式 */ - @ExpConditionMaterialAnno(name = "controlMode", type = "ControlMode", desc = "控制模式") + @ExpConditionMaterialAnno(name = "controlMode", type = ControlMode.class, desc = "控制模式", category = ExpTypeCategory.ENUM) private ControlMode controlMode; /** @@ -176,7 +177,7 @@ public class Station extends MayOutOfOrderDevice { /** * 是否紧急控制 */ - @ExpConditionMaterialAnno(name = "emergencyController", type = "boolean", desc = "是否紧急控制") + @ExpConditionMaterialAnno(name = "emergencyController", type = boolean.class, desc = "是否紧急控制") private boolean emergencyController; /** @@ -194,10 +195,10 @@ public class Station extends MayOutOfOrderDevice { */ private Map stationDirectionMap; - @ExpConditionMaterialAnno(name = "sGuideMasterLock", type = "boolean", desc = "S引导总锁") + @ExpConditionMaterialAnno(name = "sGuideMasterLock", type = boolean.class, desc = "S引导总锁") private boolean sGuideMasterLock; - @ExpConditionMaterialAnno(name = "xGuideMasterLock", type = "boolean", desc = "X引导总锁") + @ExpConditionMaterialAnno(name = "xGuideMasterLock", type = boolean.class, desc = "X引导总锁") private boolean xGuideMasterLock; /** @@ -483,24 +484,28 @@ public class Station extends MayOutOfOrderDevice { /** * 交出未被接收 */ - None, + None("交出未被接收"), /** * 中控/遥控 */ - Center, + Center("中控"), /** * 站控 */ - Local, + Local("站控"), /** * 紧急站控 */ - Emergency, - + Emergency("紧急站控"), /** * 联锁控 */ - Interlock + Interlock("联锁控"); + private final String label; + + ControlMode(String label) { + this.label = label; + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java index d5b5ab621..297bf1b3d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java @@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory; import lombok.Getter; import lombok.Setter; @@ -56,13 +57,13 @@ public class Switch extends DelayUnlockDevice { /** * 是否单锁 */ - @ExpConditionMaterialAnno(name = "singleLock", type = "boolean", desc = "是否单锁") + @ExpConditionMaterialAnno(name = "singleLock", type = boolean.class, desc = "是否单锁") private boolean singleLock; /** * 是否封锁 */ - @ExpConditionMaterialAnno(name = "blockade", type = "boolean", desc = "是否封锁") + @ExpConditionMaterialAnno(name = "blockade", type = boolean.class, desc = "是否封锁") private boolean blockade; /** @@ -76,7 +77,7 @@ public class Switch extends DelayUnlockDevice { /** * 是否进路锁闭 */ - @ExpConditionMaterialAnno(name = "routeLock", type = "boolean", desc = "是否进路锁闭") + @ExpConditionMaterialAnno(name = "routeLock", type = boolean.class, desc = "是否进路锁闭") private boolean routeLock; /** @@ -87,30 +88,30 @@ public class Switch extends DelayUnlockDevice { /** * 是否进路侧防锁闭 */ - @ExpConditionMaterialAnno(name = "fpLock", type = "boolean", desc = "是否进路侧防锁闭") + @ExpConditionMaterialAnno(name = "fpLock", type = boolean.class, desc = "是否进路侧防锁闭") private boolean fpLock; /** * 是否进路延续保护锁闭 */ - @ExpConditionMaterialAnno(name = "overlapLock", type = "boolean", desc = "是否进路延续保护锁闭") + @ExpConditionMaterialAnno(name = "overlapLock", type = boolean.class, desc = "是否进路延续保护锁闭") private boolean overlapLock; /** * 是否引导总锁 */ - @ExpConditionMaterialAnno(name = "guideMasterLock", type = "boolean", desc = "是否引导总锁") + @ExpConditionMaterialAnno(name = "guideMasterLock", type = boolean.class, desc = "是否引导总锁") private boolean guideMasterLock; /** * 道岔位置表示 */ - @ExpConditionMaterialAnno(name = "pos", type = "SwitchIndication", desc = "道岔位置") + @ExpConditionMaterialAnno(name = "pos", type = SwitchIndication.class, desc = "道岔位置", category = ExpTypeCategory.ENUM) private SwitchIndication pos; /** * 预复位 */ - @ExpConditionMaterialAnno(name = "preReset", type = "boolean", desc = "预复位") + @ExpConditionMaterialAnno(name = "preReset", type = boolean.class, desc = "预复位") private boolean preReset; /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java index 82adba694..f64193c90 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java @@ -13,6 +13,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno; import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -83,7 +84,7 @@ public class TrainInfo extends MapElement { /** * 所处区段 */ - @ExpConditionMaterialAnno(name = "section", type = "SECTION", desc = "所处位置") + @ExpConditionMaterialAnno(name = "section", type = Section.class, desc = "所处位置", category = ExpTypeCategory.DEVICE) private String section; /** @@ -99,7 +100,7 @@ public class TrainInfo extends MapElement { @Setter private Boolean right; - @ExpConditionMaterialAnno(name = "speed", type = "float", desc = "车速") + @ExpConditionMaterialAnno(name = "speed", type = float.class, desc = "车速") private float speed; private boolean doorOpen; @@ -107,13 +108,13 @@ public class TrainInfo extends MapElement { /** * 跟踪模式 */ - @ExpConditionMaterialAnno(name = "runLevel", type = "RunLevel", desc = "列车运行级别") + @ExpConditionMaterialAnno(name = "runLevel", type = RunLevel.class, desc = "列车运行级别", category = ExpTypeCategory.ENUM) private RunLevel runLevel; /** * 驾驶模式 */ - @ExpConditionMaterialAnno(name = "driveMode", type = "DriveMode", desc = "驾驶模式") + @ExpConditionMaterialAnno(name = "driveMode", type = DriveMode.class, desc = "驾驶模式", category = ExpTypeCategory.ENUM) private DriveMode driveMode; /** @@ -123,7 +124,7 @@ public class TrainInfo extends MapElement { private boolean jump; - @ExpConditionMaterialAnno(name = "hold", type = "boolean", desc = "是否扣车") + @ExpConditionMaterialAnno(name = "hold", type = boolean.class, desc = "是否扣车") private boolean hold; /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/anno/ExpConditionMaterialAnno.java b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/anno/ExpConditionMaterialAnno.java index 2bbc7d6f4..7187b8571 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/anno/ExpConditionMaterialAnno.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/anno/ExpConditionMaterialAnno.java @@ -1,5 +1,7 @@ package club.joylink.rtss.simulation.cbtc.training2.ecm.anno; +import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -22,10 +24,15 @@ public @interface ExpConditionMaterialAnno { /** * 素材类型,即即设备类定义中字段值得类型 */ - String type(); + Class type(); /** * 素材描述,即即设备类定义中字段的含义 */ String desc(); + + /** + * 素材类型数据类型 + */ + ExpTypeCategory category() default ExpTypeCategory.BASE; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/collector/ExpConditionMaterialCollector.java b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/collector/ExpConditionMaterialCollector.java index 2cfc79f64..382fb335e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/collector/ExpConditionMaterialCollector.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/collector/ExpConditionMaterialCollector.java @@ -44,7 +44,8 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom public List doCollect() { Set bds = this.doScan("club.joylink.rtss.simulation.cbtc.data.map", - "club.joylink.rtss.simulation.cbtc.data.vr", "club.joylink.rtss.simulation.cbtc.data.vo"); + "club.joylink.rtss.simulation.cbtc.data.vr", "club.joylink.rtss.simulation.cbtc.data.vo", + "club.joylink.rtss.simulation.cbtc.CI.data"); List list = new ArrayList<>(bds.size()); bds.forEach(n -> { list.add(this.create(n.getBeanClassName())); @@ -70,11 +71,7 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom for (Field fd : fds) { if (fd.isAnnotationPresent(ExpConditionMaterialAnno.class)) { ExpConditionMaterialAnno ma = fd.getAnnotation(ExpConditionMaterialAnno.class); - ExpConditionMaterialVo m = new ExpConditionMaterialVo(); - m.setName(ma.name()); - m.setType(ma.type()); - m.setDesc(ma.desc()); - // + ExpConditionMaterialVo m = new ExpConditionMaterialVo(ma); src.getMaterials().add(m); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpConditionMaterialVo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpConditionMaterialVo.java index 1bdfc9d90..0ff49f31a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpConditionMaterialVo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpConditionMaterialVo.java @@ -1,8 +1,14 @@ package club.joylink.rtss.simulation.cbtc.training2.ecm.vo; +import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno; import lombok.Data; +import lombok.NoArgsConstructor; + +import java.lang.reflect.Field; +import java.util.*; @Data +@NoArgsConstructor public class ExpConditionMaterialVo { /** * 素材名称,即设备类定义中字段的名称 @@ -16,4 +22,53 @@ public class ExpConditionMaterialVo { * 素材描述,即即设备类定义中字段的含义 */ private String desc; + + /** + * 素材类型,数据类型 + */ + private String category; + + /** + * 值列表 + */ + private List> valueList; + + public ExpConditionMaterialVo(ExpConditionMaterialAnno ma) { + this.name = ma.name(); + this.type = ma.type().getSimpleName(); + this.desc = ma.desc(); + if (ma.category() != null) { + this.category = ma.category().name(); + } + if (ExpTypeCategory.ENUM.equals(ma.category())) { + this.valueList = getEnumValue(ma.type()); + } + } + + /** + * 获取枚举说明与值 + */ + private List> getEnumValue(Class enumClass) { + List> resultList = new ArrayList<>(); + try { + Field labelField = enumClass.getDeclaredField("label"); + labelField.setAccessible(true); + Enum[] enums = (Enum[]) enumClass.getEnumConstants(); + Map valueMap = null; + Object label = null; + // 当没有描述时则不返回枚举 + for (Enum anEnum : enums) { + label = labelField.get(anEnum); + if (!Objects.equals("", label) && !Objects.equals(null, label)) { + valueMap = new HashMap<>(); + valueMap.put(labelField.getName(), labelField.get(anEnum)); + valueMap.put("value", anEnum.name()); + resultList.add(valueMap); + } + } + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + return resultList; + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpTypeCategory.java b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpTypeCategory.java new file mode 100644 index 000000000..eb31bc191 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/ecm/vo/ExpTypeCategory.java @@ -0,0 +1,9 @@ +package club.joylink.rtss.simulation.cbtc.training2.ecm.vo; + +public enum ExpTypeCategory { + BASE, // 基本类型 + + DEVICE, // 设备类型 + + ENUM // 枚举类型 +}