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);
}
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();
}
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();
}
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();
}
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;
}
Aggregations