use of net.parostroj.timetable.model.events.SpecialTrainTimeIntervalList in project grafikon by jub77.
the class PreviousNextTrainValidator method checkTrainIntervals.
private void checkTrainIntervals(Event event, Train currentTrain) {
if (event.getType() == Type.SPECIAL && event.getData() instanceof SpecialTrainTimeIntervalList) {
SpecialTrainTimeIntervalList list = (SpecialTrainTimeIntervalList) event.getData();
if (list.getType() == SpecialTrainTimeIntervalList.Type.TRACK) {
int changed = list.getChanged();
if (currentTrain.getPreviousJoinedTrain() != null && changed == 0) {
TimeInterval source = currentTrain.getFirstInterval();
TimeInterval dest = currentTrain.getPreviousJoinedTrain().getLastInterval();
checkAndUpdateTrack(source, dest);
} else if (currentTrain.getNextJoinedTrain() != null && changed == currentTrain.getTimeIntervalList().size() - 1) {
TimeInterval source = currentTrain.getLastInterval();
TimeInterval dest = currentTrain.getNextJoinedTrain().getFirstInterval();
checkAndUpdateTrack(source, dest);
}
}
if (currentTrain.getNextJoinedTrain() != null) {
checkAndUpdateNextTrainStart(currentTrain);
checkAndUpdateTimeAfter(currentTrain);
}
if (currentTrain.getPreviousJoinedTrain() != null) {
checkAndUpdateTimeAfter(currentTrain.getPreviousJoinedTrain());
}
}
}
Aggregations