use of org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry in project onebusaway-application-modules by camsys.
the class ReferencesLibrary method getTripAsReference.
public static BlockTripReference getTripAsReference(BlockTripEntry trip) {
BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
BlockConfigurationReference blockConfigRef = getBlockAsReference(blockConfig);
int tripIndex = blockConfig.getTrips().indexOf(trip);
return new BlockTripReference(blockConfigRef, tripIndex);
}
use of org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry in project onebusaway-application-modules by camsys.
the class ReferencesLibrary method getReferenceAsTrip.
public static BlockTripEntry getReferenceAsTrip(BlockTripReference reference, TransitGraphDao dao) {
BlockConfigurationEntry blockConfig = getReferenceAsBlockConfiguration(reference.getBlockConfigurationReference(), dao);
List<BlockTripEntry> trips = blockConfig.getTrips();
int tripIndex = reference.getTripIndex();
return trips.get(tripIndex);
}
use of org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry in project onebusaway-application-modules by camsys.
the class BlockConfigurationEntriesFactory method processBlockConfigurations.
public void processBlockConfigurations(BlockEntryImpl block, List<TripEntryImpl> tripsInBlock) {
Map<LocalizedServiceId, List<TripEntryImpl>> tripsByServiceId = getTripsByServiceId(block, tripsInBlock);
List<ServiceIdActivation> combinations = _serviceIdOverlapCache.getOverlappingServiceIdCombinations(tripsByServiceId.keySet());
ArrayList<BlockConfigurationEntry> configurations = new ArrayList<BlockConfigurationEntry>();
for (ServiceIdActivation serviceIds : combinations) {
BlockConfigurationEntryImpl.Builder builder = processTripsForServiceIdConfiguration(block, tripsByServiceId, serviceIds);
configurations.add(builder.create());
}
Collections.sort(configurations, _blockConfigurationComparator);
configurations.trimToSize();
if (configurations.isEmpty())
_log.warn("no active block configurations found for block: " + block.getId());
block.setConfigurations(configurations);
}
use of org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry in project onebusaway-application-modules by camsys.
the class FrequencyEntriesFactory method applyFrequenciesToBlockTrips.
private void applyFrequenciesToBlockTrips(List<TripEntryImpl> tripsInBlock, Map<AgencyAndId, List<FrequencyEntry>> frequenciesAlongBlockByTripId) {
BlockEntryImpl blockEntry = tripsInBlock.get(0).getBlock();
List<BlockConfigurationEntry> configurations = blockEntry.getConfigurations();
for (int i = 0; i < configurations.size(); i++) {
BlockConfigurationEntryImpl blockConfig = (BlockConfigurationEntryImpl) configurations.get(i);
List<FrequencyEntry> frequencies = computeBlockFrequencies(blockEntry, blockConfig.getTrips(), frequenciesAlongBlockByTripId);
blockConfig.setFrequencies(frequencies);
}
}
use of org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry in project onebusaway-application-modules by camsys.
the class ArrivalAndDepartureServiceImpl method getStopTimeInstancesByBlockInstance.
private Map<BlockInstance, List<StopTimeInstance>> getStopTimeInstancesByBlockInstance(List<StopTimeInstance> stopTimes) {
Map<BlockInstance, List<StopTimeInstance>> r = new FactoryMap<BlockInstance, List<StopTimeInstance>>(new ArrayList<StopTimeInstance>());
for (StopTimeInstance stopTime : stopTimes) {
BlockStopTimeEntry blockStopTime = stopTime.getStopTime();
BlockTripEntry blockTrip = blockStopTime.getTrip();
BlockConfigurationEntry blockConfiguration = blockTrip.getBlockConfiguration();
long serviceDate = stopTime.getServiceDate();
BlockInstance blockInstance = new BlockInstance(blockConfiguration, serviceDate, stopTime.getFrequency());
r.get(blockInstance).add(stopTime);
}
return r;
}
Aggregations