轨道交通仿真——仿真设备添加状态初始化

This commit is contained in:
walker-sheng 2021-04-27 18:42:37 +08:00
parent 63fdbbfcaf
commit bd3b7b8087
8 changed files with 42 additions and 0 deletions

View File

@ -34,6 +34,12 @@ public class SrAXC extends SrDevice {
return this.state == ON;
}
@Override
public void initState() {
this.state = OFF;
this.fault = null;
}
@Override
public void applyState(int state) {

View File

@ -24,6 +24,8 @@ public abstract class SrDevice implements Debug {
this.deviceType = deviceType;
}
public abstract void initState();
public abstract void applyState(int state);
@Override

View File

@ -61,6 +61,13 @@ public class SrPSD extends SrDevice {
this.finishTime = null;
}
@Override
public void initState() {
this.state = CLOSE_LOCK;
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void applyState(int state) {
if (CLOSE_LOCK == state || CLOSED == state || TURNING == state || OPEN_FINISH == state) {

View File

@ -97,6 +97,14 @@ public class SrSignal extends SrDevice {
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void initState() {
this.state = OFF;
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void applyState(int state) {
if (OFF == state || H == state || L == state || U == state || UH == state) {

View File

@ -115,6 +115,13 @@ public class SrSwitch extends SrDevice {
this.finishTime = null;
}
@Override
public void initState() {
this.state = NORMAL;
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void applyState(int state) {
if (NORMAL == state || REVERSE == state || LOST == state) {

View File

@ -92,6 +92,11 @@ public class SrTrack extends SrDevice implements Debug {
return null;
}
@Override
public void initState() {
}
@Override
public void applyState(int state) {

View File

@ -78,6 +78,11 @@ public class SrTrain extends SrDevice {
this.speed = v;
}
@Override
public void initState() {
}
@Override
public void applyState(int state) {

View File

@ -49,8 +49,10 @@ public class SrdRepository extends SimulationRepository {
@Override
public void initState() {
for (SrAXC axc : this.axcMap.values()) {
}
}
public List<SrAXC> getAxcList() {
return new ArrayList<>(this.axcMap.values());