コード例 #1
0
  private void setRandomTripMode(final Trip trip, final Plan plan, boolean ffcard, boolean owcard) {

    // carsharing is the new trip
    if (possibleModes.length == 2) {
      if (rng.nextBoolean()) {
        if (owcard)
          TripRouter.insertTrip(
              plan,
              trip.getOriginActivity(),
              Collections.singletonList(new LegImpl("onewaycarsharing")),
              trip.getDestinationActivity());
      } else {
        if (ffcard)
          TripRouter.insertTrip(
              plan,
              trip.getOriginActivity(),
              Collections.singletonList(new LegImpl("freefloating")),
              trip.getDestinationActivity());
      }
    } else if (possibleModes.length == 1 && possibleModes[0] != null) {
      if ((possibleModes[0].equals("freefloating") && ffcard)
          || (possibleModes[0].equals("onewaycarsharing") && owcard))
        TripRouter.insertTrip(
            plan,
            trip.getOriginActivity(),
            Collections.singletonList(new LegImpl(possibleModes[0])),
            trip.getDestinationActivity());
    } else
      TripRouter.insertTrip(
          plan, trip.getOriginActivity(), trip.getTripElements(), trip.getDestinationActivity());
  }
コード例 #2
0
  // package protected for tests
  final void removePassengerTrip(final JointTrip toRemove, final JointPlan jointPlan) {
    final Plan passengerPlan = jointPlan.getIndividualPlan(toRemove.getPassengerId());

    final Trip tripWithLeg =
        getTripWithLeg(passengerPlan, toRemove.getPassengerLeg(), stagesWithJointTypes);

    TripRouter.insertTrip(
        passengerPlan,
        tripWithLeg.getOriginActivity(),
        Collections.singletonList(PopulationUtils.createLeg(TransportMode.pt)),
        tripWithLeg.getDestinationActivity());
  }