| | |
| | | RunBlockRerouteState rerouteState = loadRunBlockRerouteState(taskNo, blockStationId); |
| | | rerouteState.setTaskNo(taskNo); |
| | | rerouteState.setBlockStationId(blockStationId); |
| | | if (!hasSelectableCandidateCommand(candidateCommands)) { |
| | | return new PlanResult( |
| | | null, |
| | | rerouteState.getPlanCount() == null ? 0 : rerouteState.getPlanCount(), |
| | | copyRoutePathList(rerouteState.getIssuedRoutePathList()) |
| | | ); |
| | | } |
| | | rerouteState.setPlanCount((rerouteState.getPlanCount() == null ? 0 : rerouteState.getPlanCount()) + 1); |
| | | int currentPlanCount = rerouteState.getPlanCount() == null ? 0 : rerouteState.getPlanCount(); |
| | | boolean resetForPlanCountLimit = rerouteState.getPlanCount() > PLANNER_RESET_PLAN_COUNT_THRESHOLD; |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | private boolean hasSelectableCandidateCommand(List<StationCommand> candidateCommands) { |
| | | if (candidateCommands == null || candidateCommands.isEmpty()) { |
| | | return false; |
| | | } |
| | | for (StationCommand candidateCommand : candidateCommands) { |
| | | if (candidateCommand == null || candidateCommand.getNavigatePath() == null || candidateCommand.getNavigatePath().isEmpty()) { |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(buildPathSignature(candidateCommand.getNavigatePath()))) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private int safeInt(Integer value) { |
| | | return value == null ? 0 : value; |
| | | } |