/** Map from GTFS to OTP model, {@code null} safe. */ public static FeedScopedId mapAgencyAndId(org.onebusaway.gtfs.model.AgencyAndId id) { return id == null ? null : new FeedScopedId(id.getAgencyId(), id.getId()); } }
public AgencyAndId getShiftedServiceId() { String shiftedId = originalServiceId.getId() + " " + ((dayOffset < 0) ? "-" : "+") + Math.abs(dayOffset); return new AgencyAndId(originalServiceId.getAgencyId(), shiftedId); }
AgencyAndId potentialStopId = new AgencyAndId(agency.getAgency() .getId(), id); .getStop(potentialStopId.toString()); .getStop(getStopIdFromStopCode(potentialStopId.toString())); if (potentialStop != null) { matches.add(potentialStop);
@Override public String convertStopId(String stopId) { AgencyAndId id = new AgencyAndId(_agencyId, stopId); AgencyAndId newId = _consolidatedStopsService.getConsolidatedStopIdForHiddenStopId(id); if (newId == null) return stopId; return newId.getId(); } }
result.addMatchedTripId(record.getTripId().toString()); } else if (record.getBlockId() != null) { result.addMatchedTripId(record.getBlockId().toString()); } else { result.addMatchedTripId(record.getBlockId().toString()); String agencyId = record.getBlockId().getAgencyId(); record.setVehicleId(new AgencyAndId(agencyId, blockDescriptor.getVehicleId()));
@Override public Set<String> getKeysForAffects(Situation situation, SituationAffects affects) { Set<String> v = new HashSet<String>(); if( situation != null) v.add(situation.getId().getAgencyId()); return v; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id.hashCode(); result = prime * result + (int) (serviceDate ^ (serviceDate >>> 32)); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IdKey other = (IdKey) obj; return _id.equals(other._id); } }
/** * * @param id * @return a full id with the default agency id ("a0") for the feed. */ public AgencyAndId id(String id) { return new AgencyAndId("a0", id); }
@Override public int compareTo(AgencyAndIdInstance o) { int c = this.id.compareTo(o.id); if (c == 0) c = this.serviceDate == o.serviceDate ? 0 : (this.serviceDate < o.serviceDate ? -1 : 1); return c; }
@Override public String toString() { return _id.toString(); } }
/** * Rename the id of the specified identity to avoid an raw GTFS identifier * collision in the merged output feed. * * @param context * @param entity */ @SuppressWarnings("unchecked") protected void rename(GtfsMergeContext context, IdentityBean<?> entity) { Object id = entity.getId(); if (id != null && id instanceof AgencyAndId) { IdentityBean<AgencyAndId> bean = (IdentityBean<AgencyAndId>) entity; AgencyAndId agencyAndId = bean.getId(); AgencyAndId newAgencyAndId; if (this.getDuplicateRenamingStrategy() == EDuplicateRenamingStrategy.AGENCY) { newAgencyAndId = MergeSupport.renameAgencyAndId(agencyAndId.getAgencyId()+"-", agencyAndId); _log.debug(agencyAndId.toString() + " renamed(1) to " + newAgencyAndId); } else { newAgencyAndId = MergeSupport.renameAgencyAndId(context, agencyAndId); _log.debug(agencyAndId.toString() + " renamed(2) to " + newAgencyAndId); } bean.setId(newAgencyAndId); } }
@SuppressWarnings("unchecked") public void translateFromObjectToCSV(CsvEntityContext context, BeanWrapper object, Map<String, Object> csvValues) { IdentityBean<AgencyAndId> entity = (IdentityBean<AgencyAndId>) object.getPropertyValue(_objFieldName); if (isOptional() && entity == null) return; AgencyAndId id = entity.getId(); csvValues.put(_csvFieldName, id.getId()); }
private String id(String agencyId, String id) { return AgencyAndId.convertToString(new AgencyAndId(agencyId, id)); } }
@Override public String toString() { return convertToString(this); }
private AgencyAndId computeUnmergedTripId(AgencyAndId tripId) { Matcher m = _mergedIdPattern.matcher(tripId.getId()); if (m.matches()) { return new AgencyAndId(tripId.getAgencyId(), m.group(1)); } else { return tripId; } }
stopAndId = AgencyAndIdLibrary.convertFromString(stopId); else if (stopId != null) stopAndId = new AgencyAndId(stopAgencyId, stopId); StopEntry stopEntry = _transitGraphDao.getStopEntryForId(stopAndId); if (stopEntry == null) { TripEntry tripEntry = blockTripEntry.getTrip(); if(tripEntry.getRoute().getId().toString().equals(routeId)) { if (tripEntry.getDirectionId() == null || tripEntry.getDirectionId().equals(directionId)) { return true;
@Cacheable @Override public List<String> getAllAgencyIds() { Set<String> agencyIds = new HashSet<String>(); for (TripEntry trip : _graph.getAllTrips()) { AgencyAndId id = trip.getId(); String agencyId = id.getAgencyId(); agencyIds.add(agencyId); } return new ArrayList<String>(agencyIds); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + blockId.hashCode(); result = prime * result + configurationIndex; return result; }
/**** * {@link Object} Interface ****/ @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof StopEntryImpl)) return false; StopEntryImpl stop = (StopEntryImpl) obj; return _id.equals(stop.getId()); }