This commit is contained in:
parent
81074bbb2a
commit
3c9aeb82f6
@ -46,7 +46,14 @@ public class SortDiagramStation {
|
|||||||
|
|
||||||
|
|
||||||
private Station findNotDepotStation(boolean isRight, int index) {
|
private Station findNotDepotStation(boolean isRight, int index) {
|
||||||
Station station = stationList.get(index);
|
Station station = null;
|
||||||
|
if (index >= stationList.size()) {
|
||||||
|
station = stationList.get(stationList.size() - 1);
|
||||||
|
} else if (index <= 0) {
|
||||||
|
station = stationList.get(0);
|
||||||
|
} else {
|
||||||
|
station = stationList.get(index);
|
||||||
|
}
|
||||||
while (station.isDepot()) {
|
while (station.isDepot()) {
|
||||||
index += isRight ? -1 : 1;
|
index += isRight ? -1 : 1;
|
||||||
station = stationList.get(index);
|
station = stationList.get(index);
|
||||||
|
Loading…
Reference in New Issue
Block a user