@Override
public void endTag(final String name, final String content, final Stack<String> context) {
if (Constants.DESCRIPTION.equals(name) && Constants.TRANSIT_ROUTE.equals(context.peek())) {
this.currentTransitRoute.description = content;
} else if (Constants.TRANSPORT_MODE.equals(name)) {
this.currentTransitRoute.mode = content.intern();
} else if (Constants.TRANSIT_ROUTE.equals(name)) {
List<TransitRouteStop> stops = new ArrayList<TransitRouteStop>(this.currentTransitRoute.stops.size());
for (TempStop tStop : this.currentTransitRoute.stops) {
TransitRouteStopImpl routeStop = new TransitRouteStopImpl(tStop.stop, tStop.arrival, tStop.departure);
stops.add(routeStop);
routeStop.setAwaitDepartureTime(tStop.awaitDeparture);
}
NetworkRoute route = null;
if (this.currentRouteProfile.firstLinkId != null) {
if (this.currentRouteProfile.lastLinkId == null) {
this.currentRouteProfile.lastLinkId = this.currentRouteProfile.firstLinkId;
}
route = this.routeFactory.createRoute(NetworkRoute.class, this.currentRouteProfile.firstLinkId, this.currentRouteProfile.lastLinkId);
route.setLinkIds(this.currentRouteProfile.firstLinkId, this.currentRouteProfile.linkIds, this.currentRouteProfile.lastLinkId);
}
TransitRoute transitRoute = this.schedule.getFactory().createTransitRoute(this.currentTransitRoute.id, route, stops, this.currentTransitRoute.mode);
transitRoute.setDescription(this.currentTransitRoute.description);
for (Departure departure : this.currentTransitRoute.departures.values()) {
transitRoute.addDeparture(departure);
}
this.currentTransitLine.addRoute(transitRoute);
}
}