Another refactoring step...

This commit is contained in:
Stephan Richter
2021-03-18 17:27:09 +01:00
parent 9b9c65542c
commit 540d1be489
7 changed files with 126 additions and 104 deletions

View File

@@ -30,6 +30,9 @@ public class PreserveRoute extends Action {
LOG.debug("Not preserving route, as train needs to stop for {} ms at {}!",waitTime,endBlock);
return false; // train is expected to wait in next block.
}
return isSet(route.getNextPreparedRoute()) || train.reserveRouteAfter(route);
if (isSet(route.getNextPreparedRoute())) return true;
Context nextContext = new Context(train).block(route.endBlock()).direction(route.endDirection);
context.onInvalidate(nextContext::invalidate);
return route.prepareNext(nextContext);
}
}