Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2db0ce5446
Fetching contributors…

Cannot retrieve contributors at this time

66 lines (53 sloc) 1.238 kb
#include "passenger.h"
Passenger::Passenger(int from_, int to_): from(from_), to(to_) {
total += 1;
timeWait = 0;
timeMove = 0;
}
int Passenger::Total() {
return total;
}
int Passenger::MaxWaitTime() {
return maxWaitTime;
}
int Passenger::MinWaitTime() {
if (minWaitTime == INT_MAX) return -1;
return minWaitTime;
}
int Passenger::AverWaitTime() {
if(total == 0) return 0;
else return totalWaitTime / total;
}
int Passenger::MaxDuration() {
return maxDuration;
}
int Passenger::MinDuration() {
if(minDuration == INT_MAX) return -1;
else return minDuration;
}
int Passenger::AverDuration() {
if(nCompleteDuration == 0) return 0;
else return totalDuration / nCompleteDuration;
}
int Passenger::Get_from() {
return from;
}
int Passenger::Get_to() {
return to;
}
void Passenger::Wait(int t) {
totalWaitTime += t;
timeWait += t;
minWaitTime = std::min(minWaitTime, timeWait);
maxWaitTime = std::max(maxWaitTime, timeWait);
}
void Passenger::Move(int t) {
timeMove += 1;
}
void Passenger::Arrive() {
int duration = timeMove + timeWait;
totalDuration += duration;
nCompleteDuration += 1;
minDuration = std::min(minDuration, duration);
maxDuration = std::max(maxDuration, duration);
}
Jump to Line
Something went wrong with that request. Please try again.