仿真存储数据结构修改、补全
This commit is contained in:
parent
39ab1f9c0b
commit
f7cb5fca15
@ -1,13 +1,13 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Catenary;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@ -15,7 +15,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageCatenary extends StorageDevice {
|
||||
public class StorageCatenary extends StorageMayOutOfOrderDevice {
|
||||
|
||||
/**
|
||||
* 是否带电
|
||||
@ -24,21 +24,32 @@ public class StorageCatenary extends StorageDevice {
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean on;
|
||||
|
||||
public StorageCatenary(String code) {
|
||||
super(code);
|
||||
public StorageCatenary(Catenary catenary) {
|
||||
super(catenary);
|
||||
}
|
||||
|
||||
public static StorageCatenary convert2Storage(Catenary catenary) {
|
||||
StorageCatenary storageCatenary = new StorageCatenary(catenary.getCode());
|
||||
if (!catenary.isOn()) {
|
||||
storageCatenary.setOn(catenary.isOn());
|
||||
StorageCatenary storageCatenary = new StorageCatenary(catenary);
|
||||
if (storageCatenary.convert(catenary)) {
|
||||
return storageCatenary;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
Catenary catenary = (Catenary) element;
|
||||
if (!catenary.isOn()) {
|
||||
change = true;
|
||||
this.setOn(catenary.isOn());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
Catenary catenary = (Catenary) element;
|
||||
catenary.setOn(on != null ? on : false);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageCycle extends StorageMayOutOfOrderDevice {
|
||||
public class StorageCycle extends StorageDevice {
|
||||
|
||||
|
||||
/** 是否已经设置 */
|
||||
@ -22,23 +22,29 @@ public class StorageCycle extends StorageMayOutOfOrderDevice {
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean setUp;
|
||||
|
||||
public StorageCycle(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code, fault);
|
||||
public StorageCycle(Cycle cycle) {
|
||||
super(cycle.getCode());
|
||||
}
|
||||
|
||||
public static StorageCycle convert2Storage(Cycle cycle) {
|
||||
boolean change = false;
|
||||
StorageCycle storageCycle = new StorageCycle(cycle.getCode(), null);
|
||||
if (cycle.isSetUp()) {
|
||||
change = true;
|
||||
storageCycle.setSetUp(cycle.isSetUp());
|
||||
}
|
||||
if (change) {
|
||||
StorageCycle storageCycle = new StorageCycle(cycle);
|
||||
if (storageCycle.convert(cycle)) {
|
||||
return storageCycle;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = false;
|
||||
Cycle cycle = (Cycle) element;
|
||||
if (cycle.isSetUp()) {
|
||||
change = true;
|
||||
this.setSetUp(cycle.isSetUp());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
Cycle cycle = (Cycle) element;
|
||||
|
@ -1,27 +1,46 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.DelayUnlockDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageDelayUnlockDevice extends StorageMayOutOfOrderDevice {
|
||||
private int remain;
|
||||
|
||||
public StorageDelayUnlockDevice(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code, fault);
|
||||
public StorageDelayUnlockDevice(DelayUnlockDevice device) {
|
||||
super(device);
|
||||
}
|
||||
|
||||
public void saveFrom(DelayUnlockDevice device) {
|
||||
this.remain = device.getRemain();
|
||||
// public void saveFrom(DelayUnlockDevice device) {
|
||||
// this.remain = device.getRemain();
|
||||
// }
|
||||
|
||||
// protected void recoverTo(DelayUnlockDevice device, SimulationDataRepository repository) {
|
||||
// device.recover(this.remain);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
DelayUnlockDevice device = (DelayUnlockDevice) element;
|
||||
if (device.getRemain() > 0) {
|
||||
change = true;
|
||||
this.remain = device.getRemain();
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
protected void recoverTo(DelayUnlockDevice device, SimulationDataRepository repository) {
|
||||
device.recover(this.remain);
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
DelayUnlockDevice device = (DelayUnlockDevice) element;
|
||||
device.recover(remain);
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,7 @@ public abstract class StorageDevice {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public abstract boolean convert(MapElement element);
|
||||
|
||||
public abstract void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository);
|
||||
}
|
||||
|
@ -29,18 +29,22 @@ public class StorageESP extends StorageDevice {
|
||||
}
|
||||
|
||||
public static StorageESP convert2Storage(ESP esp) {
|
||||
boolean change = false;
|
||||
StorageESP storageESP = new StorageESP(esp.getCode());
|
||||
if (storageESP.convert(esp)) {
|
||||
return storageESP;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = false;
|
||||
ESP esp = (ESP) element;
|
||||
if (esp.isEffective()) {
|
||||
change = true;
|
||||
storageESP.setEffective(esp.isEffective());
|
||||
}
|
||||
|
||||
if (change) {
|
||||
return storageESP;
|
||||
} else {
|
||||
return null;
|
||||
this.setEffective(esp.isEffective());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,4 +52,5 @@ public class StorageESP extends StorageDevice {
|
||||
ESP esp = (ESP) element;
|
||||
esp.setEffective(effective != null ? effective : false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,16 +11,27 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageMayOutOfOrderDevice extends StorageDevice {
|
||||
public class StorageMayOutOfOrderDevice extends StorageStatusDevice {
|
||||
private MayOutOfOrderDevice.DeviceFault fault;
|
||||
|
||||
public StorageMayOutOfOrderDevice(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code);
|
||||
this.fault = fault;
|
||||
public StorageMayOutOfOrderDevice(MayOutOfOrderDevice device) {
|
||||
super(device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
MayOutOfOrderDevice device = (MayOutOfOrderDevice) element;
|
||||
if (device.getFault() != null) {
|
||||
change = true;
|
||||
this.fault = device.getFault();
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
MayOutOfOrderDevice mayOutOfOrderDevice = (MayOutOfOrderDevice) element;
|
||||
mayOutOfOrderDevice.setFault(fault);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StoragePSD extends StorageDevice {
|
||||
public class StoragePSD extends StorageStatusDevice {
|
||||
|
||||
/**
|
||||
* 屏蔽门是否关闭
|
||||
@ -38,13 +38,6 @@ public class StoragePSD extends StorageDevice {
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean interlockRelease;
|
||||
|
||||
/**
|
||||
* 无状态
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
// public StoragePSD(PSD psd) {
|
||||
// super(psd.getCode());
|
||||
// if (!psd.isClose()) {
|
||||
@ -58,43 +51,43 @@ public class StoragePSD extends StorageDevice {
|
||||
// }
|
||||
// }
|
||||
|
||||
public StoragePSD(String code) {
|
||||
super(code);
|
||||
public StoragePSD(PSD psd) {
|
||||
super(psd);
|
||||
}
|
||||
|
||||
public static StoragePSD convert2Storage(PSD psd) {
|
||||
boolean change = false;
|
||||
StoragePSD storagePSD = new StoragePSD(psd.getCode());
|
||||
StoragePSD storagePSD = new StoragePSD(psd);
|
||||
if (storagePSD.convert(psd)) {
|
||||
return storagePSD;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
PSD psd = (PSD) element;
|
||||
if (!psd.isClose()) {
|
||||
change = true;
|
||||
storagePSD.setClose(psd.isClose());
|
||||
this.setClose(psd.isClose());
|
||||
}
|
||||
if (!psd.isLock()) {
|
||||
change = true;
|
||||
storagePSD.setLock(psd.isLock());
|
||||
this.setLock(psd.isLock());
|
||||
}
|
||||
if (psd.isInterlockRelease()) {
|
||||
change = true;
|
||||
storagePSD.setInterlockRelease(psd.isInterlockRelease());
|
||||
}
|
||||
if (psd.isNoStatus()) {
|
||||
change = true;
|
||||
storagePSD.setNoStatus(psd.isNoStatus());
|
||||
}
|
||||
|
||||
if (change) {
|
||||
return storagePSD;
|
||||
} else {
|
||||
return null;
|
||||
this.setInterlockRelease(psd.isInterlockRelease());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
PSD psd = (PSD) element;
|
||||
psd.setClose(close != null ? close : true);
|
||||
psd.setLock(lock != null ? lock : true);
|
||||
psd.setInterlockRelease(interlockRelease != null ? interlockRelease : false);
|
||||
psd.setNoStatus(noStatus != null ? noStatus : false);
|
||||
}
|
||||
}
|
||||
|
@ -104,52 +104,57 @@ public class StorageRoute extends StorageDevice {
|
||||
}
|
||||
|
||||
public static StorageRoute convert2Storage(Route route) {
|
||||
boolean change = false;
|
||||
StorageRoute storageRoute = new StorageRoute(route.getCode());
|
||||
if (!route.isAtsControl()) {
|
||||
change = true;
|
||||
storageRoute.setAtsControl(route.isAtsControl());
|
||||
}
|
||||
if (route.isFleetMode()) {
|
||||
change = true;
|
||||
storageRoute.setFleetMode(route.isFleetMode());
|
||||
}
|
||||
if (route.isCiControl()) {
|
||||
change = true;
|
||||
storageRoute.setCiControl(route.isCiControl());
|
||||
}
|
||||
if (route.isSetting()) {
|
||||
change = true;
|
||||
storageRoute.setSetting(route.isSetting());
|
||||
storageRoute.setSettingStartTime(route.getSettingStartTime());
|
||||
}
|
||||
if (route.isGuideSetting()) {
|
||||
change = true;
|
||||
storageRoute.setSettingGuide(route.isGuideSetting());
|
||||
}
|
||||
if (route.isLock()) {
|
||||
change = true;
|
||||
storageRoute.setLock(route.isLock());
|
||||
}
|
||||
if (route.getDelayUnlockDevice() != null) {
|
||||
change = true;
|
||||
storageRoute.setDelayUnlockDevice(route.getDelayUnlockDevice().getCode());
|
||||
}
|
||||
if (route.isNormalUnlock()) {
|
||||
change = true;
|
||||
storageRoute.setNormalUnlock(route.isNormalUnlock());
|
||||
}
|
||||
if (Objects.nonNull(route.getUnlockedSection())) {
|
||||
change = true;
|
||||
storageRoute.setUnlockedSection(route.getUnlockedSection().getCode());
|
||||
}
|
||||
|
||||
if (change) {
|
||||
if (storageRoute.convert(route)) {
|
||||
return storageRoute;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = false;
|
||||
Route route = (Route) element;
|
||||
if (!route.isAtsControl()) {
|
||||
change = true;
|
||||
this.setAtsControl(route.isAtsControl());
|
||||
}
|
||||
if (route.isFleetMode()) {
|
||||
change = true;
|
||||
this.setFleetMode(route.isFleetMode());
|
||||
}
|
||||
if (route.isCiControl()) {
|
||||
change = true;
|
||||
this.setCiControl(route.isCiControl());
|
||||
}
|
||||
if (route.isSetting()) {
|
||||
change = true;
|
||||
this.setSetting(route.isSetting());
|
||||
this.setSettingStartTime(route.getSettingStartTime());
|
||||
}
|
||||
if (route.isGuideSetting()) {
|
||||
change = true;
|
||||
this.setSettingGuide(route.isGuideSetting());
|
||||
}
|
||||
if (route.isLock()) {
|
||||
change = true;
|
||||
this.setLock(route.isLock());
|
||||
}
|
||||
if (route.getDelayUnlockDevice() != null) {
|
||||
change = true;
|
||||
this.setDelayUnlockDevice(route.getDelayUnlockDevice().getCode());
|
||||
}
|
||||
if (route.isNormalUnlock()) {
|
||||
change = true;
|
||||
this.setNormalUnlock(route.isNormalUnlock());
|
||||
}
|
||||
if (Objects.nonNull(route.getUnlockedSection())) {
|
||||
change = true;
|
||||
this.setUnlockedSection(route.getUnlockedSection().getCode());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
Route route = (Route) element;
|
||||
@ -168,4 +173,5 @@ public class StorageRoute extends StorageDevice {
|
||||
route.setUnlockedSection(repository.getByCode(this.unlockedSection, Section.class));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,36 +49,40 @@ public class StorageRouteOverlap extends StorageDevice {
|
||||
}
|
||||
|
||||
public static StorageRouteOverlap convert2Storage(RouteOverlap overlap) {
|
||||
boolean change = false;
|
||||
StorageRouteOverlap storageOverlap = new StorageRouteOverlap(overlap.getCode());
|
||||
if (overlap.isReleasing()) {
|
||||
change = true;
|
||||
storageOverlap.setReleasing(overlap.isReleasing());
|
||||
}
|
||||
if (overlap.isSetting()) {
|
||||
change = true;
|
||||
storageOverlap.setSetting(overlap.isSetting());
|
||||
}
|
||||
if (overlap.isLock()) {
|
||||
change = true;
|
||||
storageOverlap.setLock(overlap.isLock());
|
||||
}
|
||||
if (overlap.getRemainTime() > 0) {
|
||||
change = true;
|
||||
storageOverlap.setRemainTime(overlap.getRemainTime());
|
||||
}
|
||||
|
||||
if (Objects.nonNull(overlap.getSettingStartTime())) {
|
||||
change = true;
|
||||
storageOverlap.setSettingStartTime(overlap.getSettingStartTime());
|
||||
}
|
||||
|
||||
if (change) {
|
||||
if (storageOverlap.convert(overlap)) {
|
||||
return storageOverlap;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = false;
|
||||
RouteOverlap overlap = (RouteOverlap) element;
|
||||
if (overlap.isReleasing()) {
|
||||
change = true;
|
||||
this.setReleasing(overlap.isReleasing());
|
||||
}
|
||||
if (overlap.isSetting()) {
|
||||
change = true;
|
||||
this.setSetting(overlap.isSetting());
|
||||
}
|
||||
if (overlap.isLock()) {
|
||||
change = true;
|
||||
this.setLock(overlap.isLock());
|
||||
}
|
||||
if (overlap.getRemainTime() > 0) {
|
||||
change = true;
|
||||
this.setRemainTime(overlap.getRemainTime());
|
||||
}
|
||||
if (Objects.nonNull(overlap.getSettingStartTime())) {
|
||||
change = true;
|
||||
this.setSettingStartTime(overlap.getSettingStartTime());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
RouteOverlap overlap = (RouteOverlap) element;
|
||||
|
@ -15,6 +15,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -88,103 +89,79 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
||||
*/
|
||||
private Integer speedUpLimit;
|
||||
|
||||
private Integer speedLimitBeforeFault;
|
||||
|
||||
/**
|
||||
* 区故解第一根延时解锁剩余时间
|
||||
*/
|
||||
private Integer delayTime;
|
||||
|
||||
/**
|
||||
* 无状态
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
public StorageSection(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code, fault);
|
||||
public StorageSection(Section section) {
|
||||
super(section);
|
||||
}
|
||||
|
||||
// public StorageSection(Section section) {
|
||||
// super(section.getCode());
|
||||
// blockade = section.isBlockade();
|
||||
// routeCode = section.getRouteCode();
|
||||
// routeLock = section.isRouteLock();
|
||||
// overlapLock = section.isOverlapLock();
|
||||
// ctOccupied = section.isCtOccupied();
|
||||
// nctOccupied = section.isNctOccupied();
|
||||
// cutOff = section.isCutOff();
|
||||
// invalid = section.isInvalid();
|
||||
// faultLock = section.isFaultLock();
|
||||
// speedUpLimit = section.getSpeedUpLimit();
|
||||
// }
|
||||
|
||||
public static StorageSection convert2Storage(Section section) {
|
||||
boolean change = false;
|
||||
StorageSection storageSection = new StorageSection(section.getCode(), section.getFault());
|
||||
if (storageSection.isFault()) {
|
||||
change = true;
|
||||
StorageSection storageSection = new StorageSection(section);
|
||||
if (storageSection.convert(section)) {
|
||||
return storageSection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
Section section = (Section) element;
|
||||
if (section.isBlockade()) {
|
||||
change = true;
|
||||
storageSection.setBlockade(section.isBlockade());
|
||||
this.setBlockade(section.isBlockade());
|
||||
}
|
||||
if (section.isRouteLock()) {
|
||||
change = true;
|
||||
storageSection.setRouteLock(section.isRouteLock());
|
||||
this.setRouteLock(section.isRouteLock());
|
||||
}
|
||||
Route route = section.getRoute();
|
||||
if (route != null) {
|
||||
change = true;
|
||||
storageSection.setRoute(route.getCode());
|
||||
this.setRoute(route.getCode());
|
||||
}
|
||||
if (section.isLockRight()) {
|
||||
change = true;
|
||||
storageSection.setLockRight(section.isLockRight());
|
||||
this.setLockRight(section.isLockRight());
|
||||
}
|
||||
if (section.isOverlapLock()) {
|
||||
change = true;
|
||||
storageSection.setOverlapLock(section.isOverlapLock());
|
||||
this.setOverlapLock(section.isOverlapLock());
|
||||
}
|
||||
if (section.isCtOccupied()) {
|
||||
change = true;
|
||||
storageSection.setCtOccupied(section.isCtOccupied());
|
||||
this.setCtOccupied(section.isCtOccupied());
|
||||
}
|
||||
if (section.isNctOccupied()) {
|
||||
change = true;
|
||||
storageSection.setNctOccupied(section.isNctOccupied());
|
||||
this.setNctOccupied(section.isNctOccupied());
|
||||
}
|
||||
if (section.isCutOff()) {
|
||||
change = true;
|
||||
storageSection.setCutOff(section.isCutOff());
|
||||
this.setCutOff(section.isCutOff());
|
||||
}
|
||||
if (section.isInvalid()) {
|
||||
change = true;
|
||||
storageSection.setInvalid(section.isInvalid());
|
||||
this.setInvalid(section.isInvalid());
|
||||
}
|
||||
if (section.isFaultLock()) {
|
||||
change = true;
|
||||
storageSection.setFaultLock(section.isFaultLock());
|
||||
this.setFaultLock(section.isFaultLock());
|
||||
}
|
||||
if (!Objects.equals(section.getSpeedUpLimit(), -1)) {
|
||||
change = true;
|
||||
storageSection.setSpeedUpLimit(section.getSpeedUpLimit());
|
||||
this.setSpeedUpLimit(section.getSpeedUpLimit());
|
||||
}
|
||||
if (section.getRemain() > 0) {
|
||||
if (section.getSpeedLimitBeforeFault() != null) {
|
||||
change = true;
|
||||
storageSection.saveFrom(section);
|
||||
this.speedLimitBeforeFault = section.getSpeedLimitBeforeFault();
|
||||
}
|
||||
if (section.isNoStatus()) {
|
||||
change = true;
|
||||
storageSection.setNoStatus(section.isNoStatus());
|
||||
}
|
||||
if (section.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (change) {
|
||||
return storageSection;
|
||||
}
|
||||
return null;
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -202,9 +179,6 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
||||
section.setInvalid(invalid != null? invalid : false);
|
||||
section.setFaultLock(faultLock != null ? faultLock : false);
|
||||
section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1);
|
||||
if (this.getRemain() > 0) {
|
||||
this.recoverTo(section, repository);
|
||||
}
|
||||
section.setNoStatus(noStatus != null ? noStatus : false);
|
||||
section.setSpeedLimitBeforeFault(speedLimitBeforeFault);
|
||||
}
|
||||
}
|
||||
|
@ -81,73 +81,57 @@ public class StorageSignal extends StorageDelayUnlockDevice {
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean redOpen;
|
||||
|
||||
/**
|
||||
* 无状态
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
public StorageSignal(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code, fault);
|
||||
public StorageSignal(Signal signal) {
|
||||
super(signal);
|
||||
}
|
||||
|
||||
public static StorageSignal convert2Storage(Signal signal) {
|
||||
boolean change = false;
|
||||
StorageSignal storageSignal = new StorageSignal(signal.getCode(), signal.getFault());
|
||||
if (storageSignal.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
if (signal.getLockedRouteCode() != null) {
|
||||
change = true;
|
||||
storageSignal.setLockedRouteCode(signal.getLockedRouteCode());
|
||||
}
|
||||
if (signal.isBlockade()) {
|
||||
change = true;
|
||||
storageSignal.setBlockade(signal.isBlockade());
|
||||
}
|
||||
if (signal.getLevel() != 1) {
|
||||
change = true;
|
||||
storageSignal.setLevel(signal.getLevel());
|
||||
}
|
||||
if (signal.isReblockade()) {
|
||||
change = true;
|
||||
storageSignal.setReblockade(signal.isReblockade());
|
||||
}
|
||||
if (signal.isFpl()) {
|
||||
change = true;
|
||||
storageSignal.setFpl(signal.isFpl());
|
||||
}
|
||||
if (!signal.isLogicLight()) {
|
||||
change = true;
|
||||
storageSignal.setLogicLight(signal.isLogicLight());
|
||||
}
|
||||
if (!signal.getSignalModel().getDefaultAspect().equals(signal.getAspect())) {
|
||||
change = true;
|
||||
storageSignal.setAspect(signal.getAspect());
|
||||
}
|
||||
if (signal.isForbidden()) {
|
||||
change = true;
|
||||
storageSignal.setForbidden(signal.isForbidden());
|
||||
}
|
||||
if (signal.getRemain() > 0) {
|
||||
change = true;
|
||||
storageSignal.saveFrom(signal);
|
||||
}
|
||||
if (signal.isNoStatus()) {
|
||||
change = true;
|
||||
storageSignal.setNoStatus(signal.isNoStatus());
|
||||
}
|
||||
if (signal.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (change) {
|
||||
StorageSignal storageSignal = new StorageSignal(signal);
|
||||
if (storageSignal.convert(signal)) {
|
||||
return storageSignal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
Signal signal = (Signal) element;
|
||||
if (signal.getLockedRouteCode() != null) {
|
||||
change = true;
|
||||
this.setLockedRouteCode(signal.getLockedRouteCode());
|
||||
}
|
||||
if (signal.isBlockade()) {
|
||||
change = true;
|
||||
this.setBlockade(signal.isBlockade());
|
||||
}
|
||||
if (signal.getLevel() != 1) {
|
||||
change = true;
|
||||
this.setLevel(signal.getLevel());
|
||||
}
|
||||
if (signal.isReblockade()) {
|
||||
change = true;
|
||||
this.setReblockade(signal.isReblockade());
|
||||
}
|
||||
if (signal.isFpl()) {
|
||||
change = true;
|
||||
this.setFpl(signal.isFpl());
|
||||
}
|
||||
if (!signal.isLogicLight()) {
|
||||
change = true;
|
||||
this.setLogicLight(signal.isLogicLight());
|
||||
}
|
||||
if (!signal.getSignalModel().getDefaultAspect().equals(signal.getAspect())) {
|
||||
change = true;
|
||||
this.setAspect(signal.getAspect());
|
||||
}
|
||||
if (signal.isForbidden()) {
|
||||
change = true;
|
||||
this.setForbidden(signal.isForbidden());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
@ -163,9 +147,5 @@ public class StorageSignal extends StorageDelayUnlockDevice {
|
||||
signal.setAspect(aspect);
|
||||
}
|
||||
signal.setForbidden(this.forbidden == null ? false : this.forbidden);
|
||||
if (this.getRemain() > 0) {
|
||||
this.recoverTo(signal, repository);
|
||||
}
|
||||
signal.setNoStatus(noStatus != null ? noStatus : false);
|
||||
}
|
||||
}
|
||||
|
@ -105,15 +105,8 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean parkingAlwaysValid;
|
||||
|
||||
/**
|
||||
* 无状态
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
public StorageStand(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code, fault);
|
||||
public StorageStand(Stand stand) {
|
||||
super(stand);
|
||||
}
|
||||
|
||||
// public StorageStand(Stand stand) {
|
||||
@ -133,78 +126,73 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
// }
|
||||
|
||||
public static StorageStand convert2Storage(Stand stand) {
|
||||
boolean change = false;
|
||||
StorageStand storageStand = new StorageStand(stand.getCode(), stand.getFault());
|
||||
if (storageStand.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
StorageESP storageESP = StorageESP.convert(stand.getEsp());
|
||||
if (storageESP != null) {
|
||||
change = true;
|
||||
storageStand.setEsp(storageESP);
|
||||
}
|
||||
if (stand.isTrainParking()) {
|
||||
change = true;
|
||||
storageStand.setTrainParking(stand.isTrainParking());
|
||||
}
|
||||
if (stand.isEmergencyClosed()) {
|
||||
change = true;
|
||||
storageStand.setEmergencyClosed(stand.isEmergencyClosed());
|
||||
}
|
||||
if (stand.getRemainTime() > 0) {
|
||||
change = true;
|
||||
storageStand.setRemainTime(stand.getRemainTime());
|
||||
}
|
||||
if (stand.isStationHoldTrain()) {
|
||||
change = true;
|
||||
storageStand.setStationHoldTrain(stand.isStationHoldTrain());
|
||||
}
|
||||
if (stand.isCenterHoldTrain()) {
|
||||
change = true;
|
||||
storageStand.setCenterHoldTrain(stand.isCenterHoldTrain());
|
||||
}
|
||||
if (stand.isAutoHoldTrain()) {
|
||||
change = true;
|
||||
storageStand.setAutoHoldTrain(stand.isAutoHoldTrain());
|
||||
}
|
||||
if (stand.isAllSkip()) {
|
||||
change = true;
|
||||
storageStand.setAllSkip(stand.isAssignSkip());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(stand.getSkipSet())) {
|
||||
change = true;
|
||||
storageStand.setSkipSet(stand.getSkipSet());
|
||||
}
|
||||
if (!Objects.equals(stand.getRunLevelTime(), 0)) {
|
||||
change = true;
|
||||
storageStand.setRunLevelTime(stand.getRunLevelTime());
|
||||
}
|
||||
if (stand.isRunLevelTimeForever()) {
|
||||
change = true;
|
||||
storageStand.setRunLevelTimeForever(stand.isRunLevelTimeForever());
|
||||
}
|
||||
if (!Objects.equals(stand.getParkingTime(), -1)) {
|
||||
change = true;
|
||||
storageStand.setParkingTime(stand.getParkingTime());
|
||||
}
|
||||
if (stand.isParkingAlwaysValid()) {
|
||||
change = true;
|
||||
storageStand.setParkingAlwaysValid(stand.isParkingAlwaysValid());
|
||||
}
|
||||
if (stand.isNoStatus()) {
|
||||
change = true;
|
||||
storageStand.setNoStatus(stand.isNoStatus());
|
||||
}
|
||||
if (stand.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (change) {
|
||||
StorageStand storageStand = new StorageStand(stand);
|
||||
if (storageStand.convert(stand)) {
|
||||
return storageStand;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
Stand stand = (Stand) element;
|
||||
StorageESP storageESP = StorageESP.convert(stand.getEsp());
|
||||
if (storageESP != null) {
|
||||
change = true;
|
||||
this.setEsp(storageESP);
|
||||
}
|
||||
if (stand.isTrainParking()) {
|
||||
change = true;
|
||||
this.setTrainParking(stand.isTrainParking());
|
||||
}
|
||||
if (stand.isEmergencyClosed()) {
|
||||
change = true;
|
||||
this.setEmergencyClosed(stand.isEmergencyClosed());
|
||||
}
|
||||
if (stand.getRemainTime() > 0) {
|
||||
change = true;
|
||||
this.setRemainTime(stand.getRemainTime());
|
||||
}
|
||||
if (stand.isStationHoldTrain()) {
|
||||
change = true;
|
||||
this.setStationHoldTrain(stand.isStationHoldTrain());
|
||||
}
|
||||
if (stand.isCenterHoldTrain()) {
|
||||
change = true;
|
||||
this.setCenterHoldTrain(stand.isCenterHoldTrain());
|
||||
}
|
||||
if (stand.isAutoHoldTrain()) {
|
||||
change = true;
|
||||
this.setAutoHoldTrain(stand.isAutoHoldTrain());
|
||||
}
|
||||
if (stand.isAllSkip()) {
|
||||
change = true;
|
||||
this.setAllSkip(stand.isAssignSkip());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(stand.getSkipSet())) {
|
||||
change = true;
|
||||
this.setSkipSet(stand.getSkipSet());
|
||||
}
|
||||
if (!Objects.equals(stand.getRunLevelTime(), 0)) {
|
||||
change = true;
|
||||
this.setRunLevelTime(stand.getRunLevelTime());
|
||||
}
|
||||
if (stand.isRunLevelTimeForever()) {
|
||||
change = true;
|
||||
this.setRunLevelTimeForever(stand.isRunLevelTimeForever());
|
||||
}
|
||||
if (!Objects.equals(stand.getParkingTime(), -1)) {
|
||||
change = true;
|
||||
this.setParkingTime(stand.getParkingTime());
|
||||
}
|
||||
if (stand.isParkingAlwaysValid()) {
|
||||
change = true;
|
||||
this.setParkingAlwaysValid(stand.isParkingAlwaysValid());
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
@ -221,7 +209,6 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
stand.setRunLevelTimeForever(runLevelTimeForever != null ? runLevelTimeForever : false);
|
||||
stand.setParkingTime(parkingTime != null ? parkingTime : -1);
|
||||
stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false);
|
||||
stand.setNoStatus(noStatus != null ? noStatus : false);
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageStation extends StorageDevice {
|
||||
public class StorageStation extends StorageStatusDevice {
|
||||
|
||||
/**
|
||||
* 是否有控制模式
|
||||
@ -65,8 +65,8 @@ public class StorageStation extends StorageDevice {
|
||||
|
||||
private Integer preResetValidDuration;
|
||||
|
||||
public StorageStation(String code) {
|
||||
super(code);
|
||||
public StorageStation(Station station) {
|
||||
super(station);
|
||||
}
|
||||
|
||||
// public StorageStation(Station station) {
|
||||
@ -76,35 +76,42 @@ public class StorageStation extends StorageDevice {
|
||||
// }
|
||||
|
||||
public static StorageStation convert2Storage(Station station) {
|
||||
StorageStation storageStation = new StorageStation(station.getCode());
|
||||
storageStation.setControlMode(station.getControlMode());
|
||||
storageStation.setTbStrategyId(station.getTbStrategyId());
|
||||
StorageStation storageStation = new StorageStation(station);
|
||||
storageStation.convert(station);
|
||||
return storageStation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
super.convert(element);
|
||||
Station station = (Station) element;
|
||||
this.setControlMode(station.getControlMode());
|
||||
this.setTbStrategyId(station.getTbStrategyId());
|
||||
if (station.isTotalGuideLock()) {
|
||||
storageStation.setTotalGuideLock(station.isTotalGuideLock());
|
||||
this.setTotalGuideLock(station.isTotalGuideLock());
|
||||
}
|
||||
if (station.getApplicant() != null) {
|
||||
storageStation.setApplicant(station.getApplicant().getId());
|
||||
this.setApplicant(station.getApplicant().getId());
|
||||
}
|
||||
if (station.getApply2TheControlMode() != null) {
|
||||
storageStation.setApply2TheControlMode(station.getApply2TheControlMode());
|
||||
this.setApply2TheControlMode(station.getApply2TheControlMode());
|
||||
}
|
||||
if (station.getValidDuration() != null) {
|
||||
storageStation.setValidDuration(station.getValidDuration());
|
||||
this.setValidDuration(station.getValidDuration());
|
||||
}
|
||||
if (station.isInterlockMachineStarting()) {
|
||||
storageStation.setInterlockMachineStarting(station.isInterlockMachineStarting());
|
||||
this.setInterlockMachineStarting(station.isInterlockMachineStarting());
|
||||
}
|
||||
storageStation.setRestartTime(station.getRestartTime());
|
||||
storageStation.setController(station.getControllerId());
|
||||
this.setRestartTime(station.getRestartTime());
|
||||
this.setController(station.getControllerId());
|
||||
if (station.isEmergencyController()) {
|
||||
storageStation.setEmergencyController(station.isEmergencyController());
|
||||
this.setEmergencyController(station.isEmergencyController());
|
||||
}
|
||||
storageStation.setControlApplicant(station.getControlApplicantId());
|
||||
this.setControlApplicant(station.getControlApplicantId());
|
||||
if (station.getPreResetValidDuration() != null && station.getPreResetValidDuration().get() != 0) {
|
||||
storageStation.setPreResetValidDuration(station.getPreResetValidDuration().get());
|
||||
this.setPreResetValidDuration(station.getPreResetValidDuration().get());
|
||||
}
|
||||
|
||||
return storageStation;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,53 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.StatusDevice;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageStatusDevice extends StorageDevice{
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean atsNoStatus;
|
||||
|
||||
public StorageStatusDevice(StatusDevice device) {
|
||||
super(device.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
StatusDevice device = (StatusDevice) element;
|
||||
boolean change = false;
|
||||
if (device.isNoStatus()) {
|
||||
change = true;
|
||||
this.noStatus = true;
|
||||
}
|
||||
if (device.isAtsNoStatus()) {
|
||||
change = true;
|
||||
this.setAtsNoStatus(true);
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
StatusDevice device = (StatusDevice) element;
|
||||
device.setNoStatus(this.noStatus == null ? false : this.noStatus);
|
||||
device.setAtsNoStatus(this.atsNoStatus == null ? false : this.atsNoStatus);
|
||||
}
|
||||
|
||||
}
|
@ -76,75 +76,62 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
||||
*/
|
||||
private SwitchIndication pos;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
public StorageSwitch(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
||||
super(code, fault);
|
||||
public StorageSwitch(Switch aSwitch) {
|
||||
super(aSwitch);
|
||||
}
|
||||
|
||||
public static StorageSwitch convert2Storage(Switch s) {
|
||||
boolean change = false;
|
||||
StorageSwitch storageSwitch = new StorageSwitch(s.getCode(), s.getFault());
|
||||
if (storageSwitch.isFault()) {
|
||||
change = true;
|
||||
StorageSwitch storageSwitch = new StorageSwitch(s);
|
||||
if (storageSwitch.convert(s)) {
|
||||
return storageSwitch;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
Switch s = (Switch) element;
|
||||
if (s.isSingleLock()) {
|
||||
change = true;
|
||||
storageSwitch.setSingleLock(s.isSingleLock());
|
||||
this.setSingleLock(s.isSingleLock());
|
||||
}
|
||||
if (s.isBlockade()) {
|
||||
change = true;
|
||||
storageSwitch.setBlockade(s.isBlockade());
|
||||
this.setBlockade(s.isBlockade());
|
||||
}
|
||||
if (s.isRouteLock()) {
|
||||
change = true;
|
||||
storageSwitch.setRouteLock(s.isRouteLock());
|
||||
this.setRouteLock(s.isRouteLock());
|
||||
}
|
||||
// Route route = s.getRoutes();
|
||||
// if (route != null) {
|
||||
// change = true;
|
||||
// storageSwitch.setRoute(route.getCode());
|
||||
// this.setRoute(route.getCode());
|
||||
// }
|
||||
Set<Route> routes = s.getRoutes();
|
||||
if (!CollectionUtils.isEmpty(routes)) {
|
||||
change = true;
|
||||
Set<String> routeCodes = routes.stream().map(MapElement::getCode).collect(Collectors.toSet());
|
||||
storageSwitch.setRoutes(routeCodes);
|
||||
this.setRoutes(routeCodes);
|
||||
}
|
||||
if (s.isFpLock()) {
|
||||
change = true;
|
||||
storageSwitch.setFpLock(s.isFpLock());
|
||||
this.setFpLock(s.isFpLock());
|
||||
}
|
||||
if (s.isOverlapLock()) {
|
||||
change = true;
|
||||
storageSwitch.setOverlapLock(s.isOverlapLock());
|
||||
this.setOverlapLock(s.isOverlapLock());
|
||||
}
|
||||
if (s.isMasterGuideLock()) {
|
||||
change = true;
|
||||
storageSwitch.setMasterGuideLock(s.isMasterGuideLock());
|
||||
this.setMasterGuideLock(s.isMasterGuideLock());
|
||||
}
|
||||
if (!SwitchIndication.N.equals(s.getPos())) {
|
||||
change = true;
|
||||
storageSwitch.setPos(s.getPos());
|
||||
this.setPos(s.getPos());
|
||||
}
|
||||
if (s.getRemain() > 0) {
|
||||
change = true;
|
||||
storageSwitch.saveFrom(s);
|
||||
}
|
||||
if (s.isNoStatus()) {
|
||||
change = true;
|
||||
storageSwitch.setNoStatus(s.isNoStatus());
|
||||
}
|
||||
if (s.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (change) {
|
||||
return storageSwitch;
|
||||
}
|
||||
return null;
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -171,9 +158,5 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
||||
if (pos != null) {
|
||||
s.setPos(pos);
|
||||
}
|
||||
if (this.getRemain() > 0) {
|
||||
this.recoverTo(s, repository);
|
||||
}
|
||||
s.setNoStatus(noStatus != null ? noStatus : false);
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,12 @@ import lombok.Setter;
|
||||
public class StorageZC extends StorageMayOutOfOrderDevice {
|
||||
|
||||
private StorageZC (ZC zc) {
|
||||
super(zc.getCode(), zc.getFault());
|
||||
super(zc);
|
||||
}
|
||||
|
||||
public static StorageZC convert2Storage(ZC zc) {
|
||||
boolean change = false;
|
||||
StorageZC storageZC = new StorageZC(zc);
|
||||
if (zc.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (change) {
|
||||
if (storageZC.convert(zc)) {
|
||||
return storageZC;
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user