Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2021-04-28 09:29:00 +08:00
commit 6d40a8c5d9
8 changed files with 42 additions and 0 deletions

View File

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

View File

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

View File

@ -61,6 +61,13 @@ public class SrPSD extends SrDevice {
this.finishTime = null; this.finishTime = null;
} }
@Override
public void initState() {
this.state = CLOSE_LOCK;
this.command.set(NONE);
this.finishTime = null;
}
@Override @Override
public void applyState(int state) { public void applyState(int state) {
if (CLOSE_LOCK == state || CLOSED == state || TURNING == state || OPEN_FINISH == 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.command.set(NONE);
this.finishTime = null; this.finishTime = null;
} }
@Override
public void initState() {
this.state = OFF;
this.command.set(NONE);
this.finishTime = null;
}
@Override @Override
public void applyState(int state) { public void applyState(int state) {
if (OFF == state || H == state || L == state || U == state || UH == 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; this.finishTime = null;
} }
@Override
public void initState() {
this.state = NORMAL;
this.command.set(NONE);
this.finishTime = null;
}
@Override @Override
public void applyState(int state) { public void applyState(int state) {
if (NORMAL == state || REVERSE == state || LOST == state) { if (NORMAL == state || REVERSE == state || LOST == state) {

View File

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

View File

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

View File

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