Search in sources :

Example 11 with TrainsCycleItem

use of net.parostroj.timetable.model.TrainsCycleItem 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;
}
Also used : TrainsCycle(net.parostroj.timetable.model.TrainsCycle) TrainsCycleItem(net.parostroj.timetable.model.TrainsCycleItem) LinkedList(java.util.LinkedList)

Example 12 with TrainsCycleItem

use of net.parostroj.timetable.model.TrainsCycleItem 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;
}
Also used : TrainsCycle(net.parostroj.timetable.model.TrainsCycle) TimeInterval(net.parostroj.timetable.model.TimeInterval) TrainsCycleItem(net.parostroj.timetable.model.TrainsCycleItem) LinkedList(java.util.LinkedList)

Aggregations

TrainsCycleItem (net.parostroj.timetable.model.TrainsCycleItem)12 TrainsCycle (net.parostroj.timetable.model.TrainsCycle)6 Train (net.parostroj.timetable.model.Train)5 LinkedList (java.util.LinkedList)4 ArrayList (java.util.ArrayList)2 ConflictType (net.parostroj.timetable.actions.TrainsCycleChecker.ConflictType)2 TimeConverter (net.parostroj.timetable.model.TimeConverter)2 TimeInterval (net.parostroj.timetable.model.TimeInterval)2 List (java.util.List)1 Map (java.util.Map)1 TrainsCycleChecker (net.parostroj.timetable.actions.TrainsCycleChecker)1 Conflict (net.parostroj.timetable.actions.TrainsCycleChecker.Conflict)1 ModelPredicates (net.parostroj.timetable.filters.ModelPredicates)1 FNConnection (net.parostroj.timetable.model.FNConnection)1 Interval (net.parostroj.timetable.model.Interval)1 LocalizedString (net.parostroj.timetable.model.LocalizedString)1 TimeIntervalList (net.parostroj.timetable.model.TimeIntervalList)1 TrainDiagram (net.parostroj.timetable.model.TrainDiagram)1 TrainsCycleType (net.parostroj.timetable.model.TrainsCycleType)1 TranslatedString (net.parostroj.timetable.model.TranslatedString)1