use of net.parostroj.timetable.model.TrainsCycle in project grafikon by jub77.
the class TrainDiagramBuilder method setTrainsCycle.
public void setTrainsCycle(LSTrainsCycle lsTrainsCycle) throws LSException {
TrainsCycle cycle = lsTrainsCycle.createTrainsCycle(diagram);
TrainsCycle foundCycle = null;
if ((foundCycle = diagram.getCycleById(cycle.getId())) != null) {
foundCycle.getType().getCycles().remove(foundCycle);
}
cycle.getType().getCycles().add(cycle);
// map of sequences
if (lsTrainsCycle.getNext() != null) {
circulationSequenceMap.put(lsTrainsCycle.getId(), lsTrainsCycle.getNext());
}
}
use of net.parostroj.timetable.model.TrainsCycle in project grafikon by jub77.
the class PositionsExtractor method getEndPositions.
/**
* Does not support starting time.
*/
public List<Position> getEndPositions(Collection<TrainsCycle> cycles, Integer startingTime) {
List<Position> result = new LinkedList<>();
for (TrainsCycle cycle : this.sortTrainsCycleList(cycles)) {
if (!cycle.isEmpty()) {
TrainsCycleItem end = cycle.getItems().get(cycle.getItems().size() - 1);
String endName = end.getToInterval().getOwnerAsNode().getName();
String endTrack = end.getToInterval().getTrack().getNumber();
String endTime = diagram.getTimeConverter().convertIntToXml(end.getEndTime());
result.add(new Position(cycle.getName(), cycle.getDisplayDescription(), endName, endTrack, endTime, end.getTrain().getName(), ae.extract(cycle.getAttributes())));
}
}
return result;
}
use of net.parostroj.timetable.model.TrainsCycle in project grafikon by jub77.
the class PositionsExtractor method getStartPositions.
public List<Position> getStartPositions(Collection<TrainsCycle> cycles, Integer startingTime) {
List<Position> result = new LinkedList<>();
for (Pair<TrainsCycleItem, TimeInterval> cycleItem : this.getItemStarts(cycles, startingTime)) {
TrainsCycleItem start = cycleItem.first;
TrainsCycle cycle = start.getCycle();
TimeInterval interval = cycleItem.second;
String startName = interval.getOwnerAsNode().getName();
String startTrack = interval.getTrack().getNumber();
String startTime = diagram.getTimeConverter().convertIntToXml(interval.getEnd());
result.add(new Position(cycle.getName(), cycle.getDisplayDescription(), startName, startTrack, startTime, start.getTrain().getName(), ae.extract(cycle.getAttributes())));
}
return result;
}
Aggregations