Examples of TripEntryImpl


Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

  }

  @Test
  public void testGetTripId() {

    TripEntryImpl trip = new TripEntryImpl();
    trip.setId(new AgencyAndId("2", "T10"));
    Mockito.when(_dao.getTripEntryForId(trip.getId())).thenReturn(trip);

    Id tripId = _source.getTripId("T10");
    assertEquals("2", tripId.getAgencyId());
    assertEquals("T10", tripId.getId());
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

  }

  @Test
  public void testGetTrip() {

    TripEntryImpl trip = new TripEntryImpl();
    trip.setId(new AgencyAndId("2", "T10"));
    Mockito.when(_dao.getTripEntryForId(trip.getId())).thenReturn(trip);

    TripEntry trip2 = _source.getTrip("T10");
    assertSame(trip, trip2);

    trip2 = _source.getTrip("T11");
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

    StopEntryImpl stopA = stop("stopA", 47.0, -122.0);
    StopEntryImpl stopB = stop("stopB", 47.1, -122.1);
    StopEntryImpl stopC = stop("stopC", 47.2, -122.2);

    BlockEntryImpl blockA = block("blockA");
    TripEntryImpl tripA = trip("tripA", "sidA");
    TripEntryImpl tripB = trip("tripB", "sidA");

    tripA.setRoute(route);
    tripA.setDirectionId("0");
    tripB.setRoute(route);
    tripB.setDirectionId("1");

    route.setTrips(Arrays.asList((TripEntry) tripA, tripB));

    TripNarrative.Builder tnA = TripNarrative.builder();
    tnA.setTripHeadsign("Destination A");
    Mockito.when(_narrativeService.getTripForId(tripA.getId())).thenReturn(
        tnA.create());

    TripNarrative.Builder tnB = TripNarrative.builder();
    tnB.setTripHeadsign("Destination B");
    Mockito.when(_narrativeService.getTripForId(tripB.getId())).thenReturn(
        tnB.create());

    stopTime(0, stopA, tripA, time(9, 00), time(9, 00), 0);
    stopTime(1, stopB, tripA, time(9, 30), time(9, 30), 100);
    stopTime(2, stopC, tripA, time(10, 00), time(10, 00), 200);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

    block.setId(aid(id));
    return block;
  }

  public static TripEntryImpl trip(String id) {
    TripEntryImpl trip = new TripEntryImpl();
    trip.setId(aid(id));
    return trip;
  }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

    trip.setId(aid(id));
    return trip;
  }

  public static TripEntryImpl trip(String id, String serviceId) {
    TripEntryImpl trip = trip(id);
    trip.setServiceId(new LocalizedServiceId(aid(serviceId), timeZone()));
    return trip;
  }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

    return trip;
  }

  public static TripEntryImpl trip(String id, String serviceId,
      double totalTripDistance) {
    TripEntryImpl trip = trip(id, serviceId);
    trip.setTotalTripDistance(totalTripDistance);
    return trip;
  }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

    trip.setTotalTripDistance(totalTripDistance);
    return trip;
  }

  public static TripEntryImpl trip(String id, double totalTripDistance) {
    TripEntryImpl trip = trip(id);
    trip.setTotalTripDistance(totalTripDistance);
    return trip;
  }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

      List<FrequencyEntry> frequencies, TripEntryImpl... trips) {

    List<TripEntry> tripEntries = new ArrayList<TripEntry>();
    Set<LocalizedServiceId> serviceIds = new TreeSet<LocalizedServiceId>();
    for (int i = 0; i < trips.length; i++) {
      TripEntryImpl trip = trips[i];
      trip.setBlock(block);
      tripEntries.add(trip);
      if (trip.getServiceId() != null)
        serviceIds.add(trip.getServiceId());
    }
    Builder builder = BlockConfigurationEntryImpl.builder();
    builder.setBlock(block);
    builder.setServiceIds(new ServiceIdActivation(
        new ArrayList<LocalizedServiceId>(serviceIds),
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

          + "For more information on errors of this kind, see:\n"
          + "  https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching");
    }

    StopTimeEntryImpl first = stopTimes.get(0);
    TripEntryImpl trip = first.getTrip();
    StopTimeEntryImpl last = stopTimes.get(stopTimes.size() - 1);

    _log.error("error constructing stop-time distances along shape for trip="
        + trip.getId() + " shape=" + trip.getShapeId() + " firstStopTime="
        + first.getId() + " lastStopTime=" + last.getId());

    if (_shapeIdsWeHavePrinted.add(trip.getShapeId())) {
      StringBuilder b = new StringBuilder();
      for (int i = 0; i < shapePoints.getSize(); i++) {
        b.append(shapePoints.getLatForIndex(i));
        b.append(' ');
        b.append(shapePoints.getLonForIndex(i));
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl

        + "snapping them to the shape for that trip.  However, we could not find an assignment for each stop time "
        + "where the distance traveled along the shape for each stop time was strictly increasing (aka a stop time "
        + "seemed to travel backwards).  For more information on errors of this kind, see:\n"
        + "  https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching");

    TripEntryImpl trip = first.getTrip();
    _log.error("error constructing stop-time distances along shape for trip="
        + trip.getId() + " shape=" + trip.getShapeId() + " firstStopTime="
        + first.getId() + " lastStopTime=" + last.getId());

    StringBuilder b = new StringBuilder();
    int index = 0;

    b.append("# potential assignments:\n");
    b.append("# stopLat stopLon stopId\n");
    b.append("#   locationOnShapeLat locationOnShapeLon distanceAlongShape distanceFromShape shapePointIndex\n");
    b.append("#   ...\n");

    double prevMaxDistanceAlongShape = Double.NEGATIVE_INFINITY;

    for (List<PointAndIndex> possible : possibleAssignments) {
      StopTimeEntryImpl stopTime = stopTimes.get(index);
      StopEntryImpl stop = stopTime.getStop();
      b.append(stop.getStopLat());
      b.append(' ');
      b.append(stop.getStopLon());
      b.append(' ');
      b.append(index);
      b.append(' ');
      b.append(stop.getId());
      b.append('\n');

      double maxDistanceAlongShape = Double.NEGATIVE_INFINITY;
      double minDistanceAlongShape = Double.POSITIVE_INFINITY;

      for (PointAndIndex pindex : possible) {
        b.append("  ");
        b.append(projection.reverse(pindex.point));
        b.append(' ');
        b.append(_errorFormatter.format(pindex.distanceAlongShape));
        b.append(' ');
        b.append(_errorFormatter.format(pindex.distanceFromTarget));
        b.append(' ');
        b.append(pindex.index);
        b.append("\n");
        maxDistanceAlongShape = Math.max(maxDistanceAlongShape,
            pindex.distanceAlongShape);
        minDistanceAlongShape = Math.min(minDistanceAlongShape,
            pindex.distanceAlongShape);
      }

      if (minDistanceAlongShape < prevMaxDistanceAlongShape) {
        b.append("    ^ potential problem here ^\n");
      }

      prevMaxDistanceAlongShape = maxDistanceAlongShape;

      index++;
    }
    _log.error(b.toString());

    if (_shapeIdsWeHavePrinted.add(trip.getShapeId())) {
      b = new StringBuilder();
      index = 0;
      for (int i = 0; i < shapePoints.getSize(); i++) {
        b.append(shapePoints.getLatForIndex(i));
        b.append(' ');
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.