use of net.parostroj.timetable.actions.TrainsCycleChecker.ConflictType in project grafikon by jub77.
the class DriverCycleDelegate method getTrainCycleErrors.
@Override
public String getTrainCycleErrors(TrainsCycle cycle) {
TrainDiagram diagram = model.getDiagram();
TimeConverter c = diagram.getTimeConverter();
StringBuilder result = new StringBuilder();
List<TrainsCycleChecker.Conflict> conflicts = checker.checkConflicts(cycle);
for (TrainsCycleChecker.Conflict item : conflicts) {
TrainsCycleItem fromItem = item.getFrom();
TrainsCycleItem toItem = item.getTo();
for (ConflictType conflictType : this.colapseTimeConflictTypes(item.getType())) {
switch(conflictType) {
case NODE:
addNewLineIfNotEmpty(result);
result.append(String.format("%s %s", ResourceLoader.getString("ec.move.nodes"), formatItems(fromItem, toItem, c)));
break;
case TRANSITION_TIME:
addNewLineIfNotEmpty(result);
result.append(String.format("%s %s", ResourceLoader.getString("ec.move.nodes.time.problem"), formatItems(fromItem, toItem, c)));
break;
case TIME:
case SETUP_TIME:
addNewLineIfNotEmpty(result);
result.append(String.format("%s %s", ResourceLoader.getString("ec.problem.time"), formatItems(fromItem, toItem, c)));
break;
}
}
}
return result.toString();
}
use of net.parostroj.timetable.actions.TrainsCycleChecker.ConflictType 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