#include "stdafx.h"
#include "ExitsInfoDTO.h"

int ExitsInfoDTO::getNumberOfExitsWithoutFlaw() {
	return numberOfExitsWithoutFlaw;
}

int ExitsInfoDTO::getNumberOfExitsWithFlaw() {
	return numberOfExitsWithFlaw;
}

double ExitsInfoDTO::getAverageTimeWithoutFlaw() {
	return averageTimeWithoutFlaw;
}

double ExitsInfoDTO::getAverageTimeWithFlaw() {
	return averageTimeWithFlaw;
}
void ExitsInfoDTO::updateExitsWithoutFlaw(double _time) {
	cout << "TimeWithoutFlaw " << _time << "\n";
	numberOfExitsWithoutFlaw++;
	serviceTimesWithoutFlaw->push_back(_time);

	vector<double> serviceTimesWithoutFlawAux = vector<double>();
	serviceTimesWithoutFlawAux = *serviceTimesWithoutFlaw;

	int size = (int)serviceTimesWithoutFlaw->size();
	double totalTimesWithoutFlaw = 0;
	while(serviceTimesWithoutFlawAux.size() > 0){
		int temp = (int)serviceTimesWithoutFlawAux.back();
		serviceTimesWithoutFlawAux.pop_back();
		totalTimesWithoutFlaw += temp;
	}

	serviceTimesWithoutFlawAux.clear();

	averageTimeWithoutFlaw = totalTimesWithoutFlaw / size;
}

void ExitsInfoDTO::updateExitsWithFlaw(double _time) {
	cout << "TimeWithFlaw " << _time << "\n";
	numberOfExitsWithFlaw++;
	serviceTimesWithFlaw->push_back(_time);

	vector<double> serviceTimesWithFlawAux = vector<double>();
	serviceTimesWithFlawAux = *serviceTimesWithFlaw;

	int size = (int)serviceTimesWithFlaw->size();
	double totalTimesWithFlaw = 0;
	while(serviceTimesWithFlawAux.size() > 0){
		int temp = (int)serviceTimesWithFlawAux.back();
		serviceTimesWithFlawAux.pop_back();
		totalTimesWithFlaw += temp;
	}

	serviceTimesWithFlawAux.clear();

	averageTimeWithFlaw = totalTimesWithFlaw / size;
}

int ExitsInfoDTO::getType() {
	return type;
}

void ExitsInfoDTO::setID(string _serviceName) {
	serviceName = _serviceName;
}

string ExitsInfoDTO::getID() {
	return serviceName;
}

AbstractSimulationResultDTO* ExitsInfoDTO::clone(){
	return new ExitsInfoDTO(*this);
}
