Exemplo n.º 1
0
 /**
  * minimal Ride to check feasibility in a configuration
  * @param $direction
  * @param \DateTime $time
  * @param $duration //in Minutes
  * @param $additionalTime //from Passenger
  * @return RideNode
  */
 public static function registerFeasibleRide(\DateTime $time, $direction = DrivingMission::SAME_START, $duration, $additionalTime)
 {
     $ride = new RideNode(self::RIDE_FEASIBLE);
     if ($direction === DrivingMission::SAME_START) {
         $ride->startMinute = DateTimeService::getMinutesOfDay($time);
         $ride->duration = $duration + DispositionVariables::getBoardingTimes() + $additionalTime;
         $ride->endMinute = $ride->startMinute + $ride->duration;
     } else {
         $ride->endMinute = DateTimeService::getMinutesOfDay($time);
         $ride->duration = $duration + DispositionVariables::getBoardingTimes() + $additionalTime;
         $ride->startMinute = $ride->endMinute - $ride->duration;
     }
     return $ride;
 }
Exemplo n.º 2
0
 /**
  * @param DrivingOrder $drivingOrder
  * @return DrivingMission
  */
 public static function registerDrivingMissionFromOrder(DrivingOrder $drivingOrder)
 {
     $drivingMission = new DrivingMission();
     $drivingMission->setDirection(self::SAME_START);
     $drivingMission->setServiceOrder(array($drivingOrder->getId()));
     $boardingTime = DispositionVariables::getBoardingTimes();
     $extraMinutesPassenger = $drivingOrder->getPassenger()->getExtraMinutes();
     $additionalTimesOnRide = $boardingTime + $extraMinutesPassenger;
     $serviceMinuteOfDay = DateTimeService::getMinutesOfDay($drivingOrder->getPickUpTime());
     $serviceDuration = $drivingOrder->getRoute()->getDurationInMinutes() + $additionalTimesOnRide;
     $serviceDistance = $drivingOrder->getRoute()->getDistanceInMeters();
     $drivingMission->setServiceMinuteOfDay($serviceMinuteOfDay);
     $drivingMission->setServiceDuration($serviceDuration);
     $drivingMission->setServiceDistance($serviceDistance);
     //DrivingMission <-> Order
     $drivingMission->assignDrivingOrder($drivingOrder);
     $drivingOrder->assignDrivingMission($drivingMission);
     return $drivingMission;
 }