Search in sources :

Example 16 with TrainsCycle

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());
    }
}
Also used : TrainsCycle(net.parostroj.timetable.model.TrainsCycle)

Example 17 with TrainsCycle

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

Example 18 with TrainsCycle

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;
}
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

TrainsCycle (net.parostroj.timetable.model.TrainsCycle)18 TrainsCycleItem (net.parostroj.timetable.model.TrainsCycleItem)6 Train (net.parostroj.timetable.model.Train)5 ArrayList (java.util.ArrayList)4 LinkedList (java.util.LinkedList)3 TrainDiagram (net.parostroj.timetable.model.TrainDiagram)3 TrainsCycleType (net.parostroj.timetable.model.TrainsCycleType)3 Route (net.parostroj.timetable.model.Route)2 TimeInterval (net.parostroj.timetable.model.TimeInterval)2 IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 ZipEntry (java.util.zip.ZipEntry)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1 ModelPredicates (net.parostroj.timetable.filters.ModelPredicates)1 Wrapper (net.parostroj.timetable.gui.wrappers.Wrapper)1