Search in sources :

Example 11 with StopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeIndicesFactory method createBlockStopTimeIndexForGroup.

private BlockStopTimeIndex createBlockStopTimeIndexForGroup(List<BlockStopTimeEntry> group) {
    int n = group.size();
    List<BlockConfigurationEntry> blockConfigs = new ArrayList<BlockConfigurationEntry>(n);
    int[] stopIndices = new int[n];
    ServiceInterval interval = null;
    for (int i = 0; i < n; i++) {
        BlockStopTimeEntry blockStopTime = group.get(i);
        StopTimeEntry stopTime = blockStopTime.getStopTime();
        blockConfigs.add(blockStopTime.getTrip().getBlockConfiguration());
        stopIndices[i] = blockStopTime.getBlockSequence();
        interval = ServiceInterval.extend(interval, stopTime.getArrivalTime(), stopTime.getDepartureTime());
    }
    return new BlockStopTimeIndex(blockConfigs, stopIndices, interval);
}
Also used : BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry) FrequencyBlockStopTimeIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockStopTimeIndex) BlockStopTimeIndex(org.onebusaway.transit_data_federation.services.blocks.BlockStopTimeIndex) ServiceInterval(org.onebusaway.gtfs.model.calendar.ServiceInterval) ArrayList(java.util.ArrayList) BlockConfigurationEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry)

Example 12 with StopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeLooseComparator method compare.

@Override
public int compare(T o1, T o2) {
    List<BlockStopTimeEntry> stopTimes1 = o1.getStopTimes();
    List<BlockStopTimeEntry> stopTimes2 = o2.getStopTimes();
    if (stopTimes1.isEmpty())
        throw new IllegalStateException("block trip has no stop times: " + o1);
    if (stopTimes2.isEmpty())
        throw new IllegalStateException("block trip has no stop times: " + o2);
    BlockStopTimeEntry bst1 = stopTimes1.get(0);
    BlockStopTimeEntry bst2 = stopTimes2.get(0);
    StopTimeEntry st1 = bst1.getStopTime();
    StopTimeEntry st2 = bst2.getStopTime();
    return st1.getDepartureTime() - st2.getDepartureTime();
}
Also used : StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)

Example 13 with StopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockTripLayoverTimeComparator method getLayoverStartTimeForTrip.

public static int getLayoverStartTimeForTrip(BlockTripEntry blockTrip) {
    BlockTripEntry prevTrip = blockTrip.getPreviousTrip();
    if (prevTrip == null)
        throw new IllegalStateException("blockTrip had no incoming trip, thus no layover");
    List<BlockStopTimeEntry> stopTimes = prevTrip.getStopTimes();
    BlockStopTimeEntry blockStopTime = stopTimes.get(stopTimes.size() - 1);
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    return stopTime.getDepartureTime();
}
Also used : BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)

Example 14 with StopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockConfigurationEntryImpl method getDistanceAlongBlockForIndex.

@Override
public double getDistanceAlongBlockForIndex(int index) {
    int tripIndex = tripIndices[index];
    BlockTripEntry blockTrip = trips.get(tripIndex);
    TripEntry trip = blockTrip.getTrip();
    List<StopTimeEntry> stopTimes = trip.getStopTimes();
    int stopTimeIndex = index - accumulatedStopTimeIndices[tripIndex];
    StopTimeEntry stopTime = stopTimes.get(stopTimeIndex);
    return blockTrip.getDistanceAlongBlock() + stopTime.getShapeDistTraveled();
}
Also used : BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) TripEntry(org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)

Example 15 with StopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry in project onebusaway-application-modules by camsys.

the class AbstractBlockStopTimeIndex method computeServiceInterval.

/**
 ***
 * Private Methods
 ***
 */
protected static ServiceInterval computeServiceInterval(HasBlockTrips blockIndex, int blockSequence) {
    ServiceInterval serviceInterval = null;
    List<BlockTripEntry> trips = blockIndex.getTrips();
    for (BlockTripEntry trip : trips) {
        BlockStopTimeEntry blockStopTime = trip.getStopTimes().get(blockSequence);
        StopTimeEntry stopTime = blockStopTime.getStopTime();
        serviceInterval = ServiceInterval.extend(serviceInterval, stopTime.getArrivalTime(), stopTime.getDepartureTime());
    }
    return serviceInterval;
}
Also used : BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) ServiceInterval(org.onebusaway.gtfs.model.calendar.ServiceInterval) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)

Aggregations

StopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry)50 BlockStopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)40 BlockTripEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)18 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)15 TripEntry (org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)15 StopEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopEntry)12 CoordinatePoint (org.onebusaway.geospatial.model.CoordinatePoint)10 ArrayList (java.util.ArrayList)6 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)6 ServiceInterval (org.onebusaway.gtfs.model.calendar.ServiceInterval)4 TimepointPredictionRecord (org.onebusaway.realtime.api.TimepointPredictionRecord)4 RouteEntry (org.onebusaway.transit_data_federation.services.transit_graph.RouteEntry)4 HashMap (java.util.HashMap)3 Min (org.onebusaway.collections.Min)3 Cacheable (org.onebusaway.container.cache.Cacheable)3 StopBean (org.onebusaway.transit_data.model.StopBean)3 PointAndOrientation (org.onebusaway.transit_data_federation.impl.shapes.PointAndOrientation)3 ScheduledBlockLocation (org.onebusaway.transit_data_federation.services.blocks.ScheduledBlockLocation)3 HashSet (java.util.HashSet)2 TimeIntervalBean (org.onebusaway.transit_data.model.TimeIntervalBean)2