use of net.parostroj.timetable.actions.TrainsCycleChecker.Conflict in project grafikon by jub77.
the class TCDelegate method checkConflicts.
private void checkConflicts(TrainsCycle cycle, StringBuilder result) {
List<Conflict> conflicts = checker.checkConflicts(cycle);
TimeConverter c = cycle.getDiagram().getTimeConverter();
for (Conflict item : conflicts) {
TrainsCycleItem fromItem = item.getFrom();
TrainsCycleItem toItem = item.getTo();
for (ConflictType conflictType : item.getType()) {
switch(conflictType) {
case NODE:
addNewLineIfNotEmpty(result);
result.append(String.format("%s %s", ResourceLoader.getString("ec.problem.nodes"), formatItems(fromItem, toItem, c)));
if (!cycle.isPartOfSequence() && fromItem == cycle.getLastItem() && toItem == cycle.getFirstItem()) {
addNewLineIfNotEmpty(result);
result.append(ResourceLoader.getString("ec.problem.startend"));
}
break;
case TIME:
addNewLineIfNotEmpty(result);
result.append(String.format("%s %s", ResourceLoader.getString("ec.problem.time"), formatItems(fromItem, toItem, c)));
break;
default:
break;
}
}
}
}
Aggregations