增加调头指令
This commit is contained in:
parent
aa40f830fc
commit
8bd00bdbd9
@ -51,7 +51,7 @@ public class CommandBO {
|
|||||||
this.stepList = stepList;
|
this.stepList = stepList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Step getNextUnfinishedStep() {
|
public Step findNextUnfinishedStep() {
|
||||||
for (Step step : this.getStepList()) {
|
for (Step step : this.getStepList()) {
|
||||||
if (!step.isFinish()) {
|
if (!step.isFinish()) {
|
||||||
return step;
|
return step;
|
||||||
@ -497,38 +497,32 @@ public class CommandBO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// // 列车目标区段无法到达,根据路径单元判定
|
|
||||||
// if (headSection.isSwitchTrack() && headSection.getParent().isTurnBackTrack()) {
|
|
||||||
// headSection = headSection.getParent();
|
|
||||||
// }
|
|
||||||
// RouteUnit routeUnit = null;
|
|
||||||
// if (targetSection.isStandTrack() || targetSection.isTurnBackTrack() || targetSection.isTransferTrack()) {
|
|
||||||
// if (headSection.isStandTrack() || headSection.isTurnBackTrack() || headSection.isTransferTrack()) {
|
|
||||||
// routeUnit = repository.getRouteUnit(headSection, targetSection);
|
|
||||||
// } else {
|
|
||||||
// List<RouteUnit> routeUnitList = repository.queryRouteUnitByEndSection(targetSection);
|
|
||||||
// for (RouteUnit temp : routeUnitList) {
|
|
||||||
// if (temp.containsSection(headSection)) {
|
|
||||||
// routeUnit = temp;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (Objects.isNull(routeUnit)) {
|
|
||||||
// throw new SimulationException(SimulationExceptionType.System_Fault,
|
|
||||||
// String.format("列车[%s]目标轨为[%s(%s)],未找到路径单元",
|
|
||||||
// train.getGroupNumber(), targetSection.getName(), targetSection.getCode()));
|
|
||||||
// }
|
|
||||||
// if (!Objects.equals(right, routeUnit.isRight())) {
|
|
||||||
// // 和计划方向不同
|
|
||||||
// return buildDriverChangeHeadOperateStep(train.getGroupNumber());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
//驾驶
|
//驾驶
|
||||||
return buildDriveStep(new SectionPosition(targetSection, targetSection.getStopPointByDirection(train.isRight())));
|
return buildDriveStep(new SectionPosition(targetSection, targetSection.getStopPointByDirection(train.isRight())));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 换端 */
|
||||||
|
Turn_Direction(Arrays.asList()) {
|
||||||
|
@Override
|
||||||
|
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
||||||
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(SimulationMember.Type.DRIVER, targetMember.getType());
|
||||||
|
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
||||||
|
return List.of(buildDriverChangeHeadOperateStep(train.getGroupNumber()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
||||||
|
Step step = command.findNextUnfinishedStep();
|
||||||
|
if (step == null)
|
||||||
|
command.getTargetMember().setCommand(null);
|
||||||
|
else
|
||||||
|
step.finish();
|
||||||
|
return step;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user