}
private void constructTrips() {
for (List<JourneyHeaderElement> journies : _journeysById.values()) {
for (int i = 0; i < journies.size(); ++i) {
JourneyHeaderElement journey = journies.get(i);
if (journey.getOperatorId().equals("EU")) {
continue;
}
Trip trip = new Trip();
String id = journey.getOperatorId() + "-"
+ journey.getJourneyIdentifier();
if (journies.size() > 1) {
id += "-" + i;
}
trip.setId(new AgencyAndId(journey.getOperatorId(), id));
trip.setRoute(getRouteForJourney(journey));
trip.setServiceId(getServiceIdForJourney(journey));
AgencyAndId routeId = trip.getRoute().getId();
RouteMetadata metadata = getMetadataForRouteId(routeId);
String directionName = metadata.getDirectionNameForDirectionId(journey.getRouteDirection());
if (!isEmpty(directionName)) {
trip.setTripHeadsign(directionName);
}
Integer directionId = metadata.getDirectionIdForDirection(journey.getRouteDirection());
if (directionId != null) {
trip.setDirectionId(directionId.toString());
}
if (constructTimepoints(journey, trip)) {