RailArc reverseRailArc = new RailArc();
railArc.setId(id);
id++;
reverseRailArc.setId(id);
id++;
RailNode origin = nameToRailNodeMap.get(lineTokens[0]);
if (origin == null) {
throw new IllegalArgumentException("Read line (" + line
+ ") has a non existing origin (" + lineTokens[0] + ").");
}
railArc.setOrigin(origin);
origin.getOriginatingRailArcList().add(railArc);
reverseRailArc.setDestination(origin);
RailNode destination = nameToRailNodeMap.get(lineTokens[1]);
if (destination == null) {
throw new IllegalArgumentException("Read line (" + line
+ ") has a non existing destination (" + lineTokens[1] + ").");
}
railArc.setDestination(destination);
reverseRailArc.setOrigin(destination);
destination.getOriginatingRailArcList().add(reverseRailArc);
int distance = readDistance(lineTokens[2]);
railArc.setDistance(distance);
reverseRailArc.setDistance(distance);
int maximumTrainLength = Integer.parseInt(lineTokens[3]);
railArc.setMaximumTrainLength(maximumTrainLength);