Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. ArrivalEvent.cpp:
  2.  
  3. void ArrivalEvent::performEvent(){
  4.     carId->currentRoad->cars.push_back(carId);
  5. }
  6.  
  7. FaultEvent.cpp:
  8. void FaultEvent::performEvent(){
  9.     carId->setFaultyTime(this->timeOfFault);
  10. }
  11.  
  12. Car.cpp:
  13. bool Car::operator<(const Car& rhs)const{
  14.     return this->distanceFrom < rhs.distanceFrom;
  15. }
  16.  
  17. Car::Car(string carId, string roadPlans,&map<Road> roadsMap){
  18.     id = carId;
  19.     createRoadPlan(roadPlans);
  20.     from = 0;
  21.     faultyTimeLeft = 0;
  22.     string start = this->roadPlan.at(0)->id;
  23.     string end = this->roadPlan.at(1)->id;
  24.     Road& current = roadsMap[start+","+end];
  25.     currentRoad* = current;
  26.  
  27.     }
  28. void Car::setFaultyTime(int faultyTime){
  29.     faultyTimeLeft = faultyTime;
  30.     Car* tmpc = &this;
  31.     currentRoad->faultyCars.push_back(tmpc);
  32. }
  33.  
  34. Car.h:
  35. virtual bool operator<(const Car& rhs)const;
  36.     void setFaultyTime(int faultyTime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement