use of net.parostroj.timetable.model.NodeTrack in project grafikon by jub77.
the class NodeTimetableByTracksWriter method writeNodeTimetable.
/**
* writes node timetable.
*
* @param node node
* @param str appendable
*/
public void writeNodeTimetable(Node node, Appendable str) throws IOException {
TimeConverter c = node.getDiagram().getTimeConverter();
str.append("Node: ");
str.append(node.getName()).append('\n');
List<NodeTrack> tracks = node.getTracks();
for (NodeTrack track : tracks) {
str.append("Track: " + track.getNumber()).append('\n');
for (TimeInterval interval : track.getTimeIntervalList()) {
try (Formatter f = new Formatter(str)) {
f.format("%1$-20s", interval.getTrain().getDefaultCompleteName());
str.append(c.convertIntToText(interval.getStart(), true));
str.append(" ").append(c.convertIntToText(interval.getEnd(), true)).append("\n");
f.flush();
}
}
}
}
use of net.parostroj.timetable.model.NodeTrack in project grafikon by jub77.
the class LSNodeTrack method createNodeTrack.
public NodeTrack createNodeTrack(Function<String, ObjectWithId> mapping) throws LSException {
NodeTrack nodeTrack = new NodeTrack(this.getId());
this.addValuesTrack(mapping, nodeTrack);
nodeTrack.setPlatform(platform);
return nodeTrack;
}
use of net.parostroj.timetable.model.NodeTrack in project grafikon by jub77.
the class LSTrain method createTrain.
public Train createTrain(TrainDiagram diagram) {
Train train = diagram.getPartFactory().createTrain(id);
train.setNumber(number);
train.getAttributes().add(attributes.createAttributes());
train.setDescription(desc);
train.setTopSpeed(topSpeed);
train.setType(diagram.getTrainTypes().getById(type));
// build time interval list
TrainIntervalsBuilder builder = new TrainIntervalsBuilder(train, start);
for (Object routePart : getRoute()) {
if (routePart instanceof LSTrainRoutePartNode) {
LSTrainRoutePartNode nodePart = (LSTrainRoutePartNode) routePart;
Node node = diagram.getNet().getNodeById(nodePart.getNodeId());
NodeTrack nodeTrack = node.getTrackById(nodePart.getTrackId());
builder.addNode(nodePart.getIntervalId(), node, nodeTrack, nodePart.getStop(), nodePart.getAttributes().createAttributes());
} else {
LSTrainRoutePartLine linePart = (LSTrainRoutePartLine) routePart;
Line line = diagram.getNet().getLineById(linePart.getLineId());
LineTrack lineTrack = line.getTrackById(linePart.getTrackId());
builder.addLine(linePart.getIntervalId(), line, lineTrack, linePart.getSpeed(), 0, linePart.getAttributes().createAttributes());
}
}
builder.finish();
// set technological time
train.setTimeBefore(this.timeBefore);
train.setTimeAfter(this.timeAfter);
return train;
}
use of net.parostroj.timetable.model.NodeTrack in project grafikon by jub77.
the class LibraryBuilder method importNode.
public LibraryItem importNode(Node node) {
Node nodeCopy = copyFactory.copy(node, node.getId());
addHandler.stripObjectIdAttributes(nodeCopy);
for (NodeTrack track : nodeCopy.getTracks()) {
addHandler.stripObjectIdAttributes(track);
}
// create item and add it to library
return addImpl(nodeCopy, LibraryItemType.NODE);
}
use of net.parostroj.timetable.model.NodeTrack in project grafikon by jub77.
the class LSNodeTrack method createNodeTrack.
public NodeTrack createNodeTrack() {
NodeTrack nodeTrack = new NodeTrack(this.getId());
this.addValuesTrack(nodeTrack);
nodeTrack.setPlatform(platform);
return nodeTrack;
}
Aggregations